graph namespace #916
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: coverage | |
env: | |
GXX_VERSION: 12 | |
TESTS_DIR: out/tests | |
COBERTURA_REPORT: cobertura.xml | |
COVERALLS_REPORT: coveralls.json | |
HTML_REPORT_DIR: html/ | |
COVERAGE_ARTIFACT_NAME: coverage-report | |
on: | |
push: | |
branches: | |
- master | |
- development | |
paths-ignore: | |
- 'README.md' | |
- 'docs/' | |
pull_request: | |
branches: | |
- '**' | |
paths-ignore: | |
- 'README.md' | |
- 'docs/' | |
jobs: | |
create-coverage-report: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install prerequisites | |
run: | | |
sudo apt-get update | |
sudo apt-get install pip -y | |
sudo pip install gcovr | |
sudo apt-get install g++-${{ env.GXX_VERSION }} -y | |
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${{ env.GXX_VERSION }} ${{ env.GXX_VERSION }}00 --slave /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GXX_VERSION }} | |
sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GXX_VERSION }} ${{ env.GXX_VERSION }}00 | |
- name: Compile tests | |
env: | |
LDFLAGS: "-fprofile-arcs" | |
CXXFLAGS: "-g -O0 --coverage -fno-inline -fprofile-abs-path -fkeep-inline-functions -fkeep-static-functions" | |
CC: gcc | |
CXX: g++ | |
run: | | |
cmake -B ${{ env.TESTS_DIR }}/.. -S . | |
cmake --build ${{ env.TESTS_DIR }}/.. -j4 | |
- name: Run tests | |
env: | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
run: ctest --test-dir ${{env.TESTS_DIR}} -C Debug -j4 | |
- name: Run gcovr | |
run: | | |
gcovr --root ${{env.TESTS_DIR}} --filter include/Simple-Utility --keep -j 4 \ | |
--exclude-lines-by-pattern "\s*assert\(" \ | |
--exclude-unreachable-branches \ | |
--exclude-noncode-lines \ | |
--exclude-throw-branches \ | |
--decisions \ | |
--cobertura ${{env.COBERTURA_REPORT}} --cobertura-pretty \ | |
--html-nested ${{env.HTML_REPORT_DIR}} --html-title "Simple-Utility Coverage Report" \ | |
--coveralls ${{env.COVERALLS_REPORT}} --coveralls-pretty | |
- name: Upload gcov coverage report artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: gcov-files | |
path: "${{env.TESTS_DIR}}/*.gcov" | |
- name: Upload generated report artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{env.COVERAGE_ARTIFACT_NAME}} | |
path: | | |
${{env.COBERTURA_REPORT}} | |
${{env.COVERALLS_REPORT}} | |
${{env.HTML_REPORT_DIR}} | |
codacy-report: | |
needs: create-coverage-report | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: ${{env.COVERAGE_ARTIFACT_NAME}} | |
- name: Upload coverage to Codacy | |
uses: codacy/codacy-coverage-reporter-action@v1 | |
with: | |
project-token: ${{secrets.CODACY_PROJECT_TOKEN}} | |
coverage-reports: ${{env.COBERTURA_REPORT}} | |
codecov-report: | |
needs: create-coverage-report | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: ${{env.COVERAGE_ARTIFACT_NAME}} | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
name: $GITHUB_REPOSITORY | |
token: ${{secrets.CODECOV_TOKEN}} | |
files: ${{env.COBERTURA_REPORT}} | |
fail_ci_if_error: true | |
verbose: true | |
coveralls-report: | |
needs: create-coverage-report | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: ${{env.COVERAGE_ARTIFACT_NAME}} | |
- name: Upload coverage to Coveralls | |
uses: coverallsapp/github-action@v2 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
file: ${{env.COVERALLS_REPORT}} | |
format: coveralls | |
fail-on-error: true |