moved #4
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: Code Coverage | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
code-coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: 'recursive' | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc g++ cmake lcov gcovr | |
sudo apt-get install -y libgtest-dev | |
cd /usr/src/gtest | |
sudo cmake CMakeLists.txt | |
sudo make | |
sudo cp ./lib/libgtest*.a /usr/lib | |
- name: Configure CMake | |
run: cmake -S . -B build -DBUILD_COVERAGE=ON | |
- name: Build | |
run: cmake --build build --config Release | |
- name: Run tests | |
run: | | |
cd build/test/unittest | |
./cpp-oasvalidator-unittests | |
- name: Generate Coverage Report | |
if: github.ref == 'refs/heads/main' | |
run: | | |
lcov --capture --directory . --output-file coverage.info | |
lcov --remove coverage.info '/usr/*' --output-file coverage.info | |
lcov --list coverage.info | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |