Skip to content

Add random test and tree validaion #35

Add random test and tree validaion

Add random test and tree validaion #35

Workflow file for this run

name: CI
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
# [x] build
# [ ] static analysis
# [x] unit tests
# [ ] intergration tests
# [ ] artifacts
# [ ] deploy artifacts to storage or servers
# [ ] performance and something
# [x] coverage
jobs:
build-and-test:
strategy:
matrix:
compiler:
- gcc-13
- gcc-14
- clang-18
- clang-19
build_type: [Debug, Release]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build lcov
sudo apt-get install -y libgtest-dev libbenchmark-dev catch2
case "${{ matrix.compiler }}" in
gcc-13)
sudo apt-get install -y gcc-13 g++-13
echo "CC=gcc-13" >> $GITHUB_ENV
echo "CXX=g++-13" >> $GITHUB_ENV
;;
gcc-14)
sudo apt-get install -y gcc-14 g++-14
echo "CC=gcc-14" >> $GITHUB_ENV
echo "CXX=g++-14" >> $GITHUB_ENV
;;
clang-18)
sudo apt-get install -y clang-18 lld-18
echo "CC=clang-18" >> $GITHUB_ENV
echo "CXX=clang++-18" >> $GITHUB_ENV
;;
clang-19)
sudo apt-get install -y clang-19 lld-19
echo "CC=clang-19" >> $GITHUB_ENV
echo "CXX=clang++-19" >> $GITHUB_ENV
;;
esac
- name: Clean build directory
run: rm -rf build
- name: Configure CMake
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
${{ matrix.compiler == 'gcc-14' && matrix.build_type == 'Release' && '-DENABLE_COVERAGE=ON' || '' }}
- name: Build
run: cmake --build build
- name: Run unit tests
run: ctest --test-dir build --output-on-failure
- name: Capture coverage
if: matrix.compiler == 'gcc-14' && matrix.build_type == 'Release'
run: |
lcov --gcov-tool gcov-14 --directory build --capture --output-file coverage.info \
--ignore-errors mismatch,inconsistent,unused \
--rc geninfo_unexecuted_blocks=1
lcov --gcov-tool gcov-14 --remove coverage.info '/usr/*' \
'*/tests/bench_catch_tests/*' \
'*/tests/benchmark_tests/*' \
'*/tests/*.cpp' \
--output-file coverage.info \
--ignore-errors unused \
--rc geninfo_unexecuted_blocks=1
lcov --gcov-tool gcov-14 --list coverage.info
- name: Upload to Codecov
if: matrix.compiler == 'gcc-14' && matrix.build_type == 'Release'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.info