Create code-coverage.yml #1
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
# This workflow will install dependencies, build the project, run tests with code coverage and upload the results to Codecov | |
name: Code Coverage | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install cmake and gtest | |
run: | | |
sudo apt-get install -y cmake lcov libgtest-dev | |
- name: Build project | |
run: | | |
cmake . | |
make | |
- name: Run tests | |
run: | | |
bin/ut_factory_injector | |
- name: Run code coverage | |
run: | | |
lcov --directory . --capture --output-file coverage.info | |
lcov --remove coverage.info '/usr/*' '*/tests/*' "${HOME}"'/.cache/*' --output-file coverage.info | |
lcov --list coverage.info | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: coverage.info |