test: added empty test files and updated cmake to handle test data #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Test | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential cmake ninja-build libpng-dev libpng++-dev lcov | |
- name: Configure CMake | |
run: cmake -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS="--coverage" -B ${{ github.workspace }}/build -G Ninja | |
- name: Build | |
run: cmake --build ${{ github.workspace }}/build | |
- name: Initialize Coverage Data | |
working-directory: ${{ github.workspace }}/build | |
run: | | |
lcov --directory modules --zerocounters | |
lcov --capture --initial --directory modules --output-file coverage.base | |
- name: Test | |
working-directory: ${{ github.workspace }}/build | |
run: ctest | |
- name: Capture Coverage Data | |
working-directory: ${{ github.workspace }}/build | |
run: | | |
lcov --capture --directory modules --output-file coverage.test | |
lcov --add-tracefile coverage.base --add-tracefile coverage.test --output-file coverage.total | |
lcov --remove coverage.total '/usr/*' "${{ github.workspace }}/build/*" --output-file coverage.info | |
genhtml coverage.info --output-directory coverage | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: build/coverage.info | |
fail_ci_if_error: true | |
verbose: true |