Skip to content

Fix test workflow

Fix test workflow #13

Workflow file for this run

name: Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake g++ libgtest-dev lcov
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Debug
- name: Build
run: cmake --build ${{github.workspace}}/build --config Debug
- name: Run tests
working-directory: ${{github.workspace}}/build
run: |
ctest --output-on-failure
# Run the test executable directly to ensure coverage data is generated
./tests/cramer_tests
- name: Generate coverage report
working-directory: ${{github.workspace}}/build
run: |
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info '/usr/*' '*/tests/*' --output-file coverage.info
lcov --list coverage.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ${{github.workspace}}/build/coverage.info
fail_ci_if_error: true