Skip to content

Redis configuration #1608

Redis configuration

Redis configuration #1608

Workflow file for this run

name: "CI Tests"
on:
push:
branches:
- master
pull_request:
branches:
- master
- capio-v2
concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
codespell-check:
name: "Check codespell conformance"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: "Run codespell"
uses: codespell-project/actions-codespell@v2
with:
exclude_file: tests/unit/server/src/SourceText.hpp
docker-check:
name: "Check Docker image"
runs-on: ubuntu-22.04
strategy:
matrix:
cmake-build-type:
- "Debug"
- "Release"
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: "Build Docker image"
uses: docker/build-push-action@v5
with:
build-args: |
CAPIO_BUILD_TESTS=ON
CAPIO_LOG=${{ matrix.cmake-build-type == 'Debug' && 'ON' || 'OFF' }}
CMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }}
load: true
tags: alphaunito/capio:latest
- name: "Run unit tests with Docker"
working-directory: ${{ github.workspace }}
run: |
echo "Run CAPIO POSIX Unit tests"
docker run --rm \
--env CAPIO_DIR=/tmp \
--env CAPIO_LOG_LEVEL=-1 \
--name capio-docker \
alphaunito/capio:latest \
capio_posix_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO integration tests"
docker run --rm \
--env CAPIO_DIR=/tmp \
--env CAPIO_LOG_LEVEL=-1 \
--env LD_PRELOAD=libcapio_posix.so \
--name capio-docker \
alphaunito/capio:latest \
capio_integration_tests \
--gtest_break_on_failure \
--gtest_print_time=1
docker compose -f tests/docker-compose.yml up --abort-on-container-exit
format-check:
name: "Check ${{ matrix.path }} clang-format conformance"
runs-on: ubuntu-22.04
strategy:
matrix:
path:
- "src"
- "tests"
steps:
- uses: actions/checkout@v4
- name: "Run clang-format style check"
uses: jidicula/clang-format-action@v4.13.0
with:
clang-format-version: "16"
check-path: "${{ matrix.path }}"
unit-tests:
name: "Build ${{ matrix.build_type }} with ${{ matrix.cxx }}"
runs-on: ubuntu-22.04
strategy:
matrix:
build_type:
- Debug
- Release
cxx:
- g++-9
- g++-10
- g++-11
- g++-12
- g++-13
- clang-13
- clang-14
- clang-15
- clang-16
- clang-17
- clang-18
steps:
- uses: actions/checkout@v4
- name: "Install packages"
run: |
sudo apt install -y \
libcapstone-dev \
libopenmpi-dev \
ninja-build \
openmpi-bin \
pkg-config \
cmake
- name: "Get compiler version"
run: |
IFS='-' read -r -a COMPILER <<< "${{ matrix.cxx }}"
echo "CXX_VERSION=${COMPILER[1]}" >> $GITHUB_ENV
- name: "Install Clang"
if: ${{ startsWith(matrix.cxx, 'clang-') }}
run: |
wget -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh
chmod u+x /tmp/llvm.sh
sudo /tmp/llvm.sh ${{ env.CXX_VERSION }}
rm -f /tmp/llvm.sh
- name: "Fix missing libclang_rt.profile for Clang 14"
if: ${{ matrix.cxx == 'clang-14' }}
run: |
sudo apt download libclang-rt-14-dev
sudo dpkg --force-all -i libclang-rt-14-dev*
- name: "Install GCC"
if: ${{ startsWith(matrix.cxx, 'g++-') }}
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install -y ${{ matrix.cxx }}
- name: "Run CMake"
env:
CXX: ${{ startsWith(matrix.cxx, 'clang-') && 'clang++' || 'g++' }}-${{ env.CXX_VERSION }}
run: |
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCAPIO_LOG=${{ matrix.build_type == 'Debug' && 'ON' || 'OFF' }} \
-DENABLE_COVERAGE=${{ matrix.build_type == 'Debug' && 'ON' || 'OFF' }} \
-DCAPIO_BUILD_TESTS=ON \
-G Ninja \
-B ../build \
-S ${GITHUB_WORKSPACE}
cmake --build ../build -j $(nproc)
sudo cmake --install ../build --prefix /usr/local
- name: "Run tests"
id: run-tests
timeout-minutes: 2
env:
CAPIO_DIR: ${{ github.workspace }}
CAPIO_LOG_LEVEL: -1
run: |
export LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}"
echo "Run CAPIO SERVER unit tests"
capio_server_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO POSIX Unit tests"
capio_posix_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO SERVER unit tests"
capio_server_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO syscall Unit tests"
LD_PRELOAD=libcapio_posix.so \
capio_syscall_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO integration tests"
rm -rf /dev/shm/CAPIO*
LD_PRELOAD=libcapio_posix.so \
capio_integration_tests \
--gtest_break_on_failure \
--gtest_print_time=1
- name: "Show client logs on failure"
if: ${{ always() && steps.run-tests.outcome == 'failure' && matrix.build_type == 'Debug' }}
run: tail -v -n +1 capio_logs/posix/$(hostname)/posix_thread_*.log
- name: "Show server logs on failure"
if: ${{ always() && steps.run-tests.outcome == 'failure' && matrix.build_type == 'Debug' }}
run: tail -v -n +1 capio_logs/server/$(hostname)/server_thread_*.log
- name: "Generate coverage report"
if: ${{ matrix.build_type == 'Debug' }}
run: |
pip install --upgrade gcovr
gcovr \
--gcov-ignore-parse-errors \
--exclude-throw-branches \
--xml coverage.xml \
--gcov-executable "${{ startsWith(matrix.cxx, 'clang-') && format('llvm-cov-{0} gcov', env.CXX_VERSION) || format('gcov-{0}', env.CXX_VERSION) }}" \
../build
- name: "Upload coverage report"
if: ${{ matrix.build_type == 'Debug' }}
uses: actions/upload-artifact@v4
with:
name: ${{ format('{0}-tests', matrix.cxx) }}
path: ./coverage.xml
retention-days: 1
if-no-files-found: error
upload-to-codecov:
name: "Codecov report upload"
needs: [ "unit-tests" , "codespell-check" , "format-check" ]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: "Download artifacts"
uses: actions/download-artifact@v4
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}