graph namespace #893
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 | |
COVERAGE_FILE: coverage.info | |
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 compiler | |
run: | | |
sudo apt-get update | |
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 }} --timeout 30 -C Debug -j4 | |
- name: Collect data | |
run: | | |
sudo apt-get install lcov -y | |
lcov --capture -d ${{env.TESTS_DIR}} -o ${{env.COVERAGE_FILE}} --include "$PWD/include/*" | |
- name: Upload raw coverage artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: raw-coverage-reports | |
path: | | |
${{env.TESTS_DIR}}/*.gcno | |
${{env.TESTS_DIR}}/*.gcda | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{env.COVERAGE_ARTIFACT_NAME}} | |
path: ${{env.COVERAGE_FILE}} | |
generate-html-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: Generate html | |
run: | | |
sudo apt-get install genhtml -y | |
genhtml --title "Simple-Utility Coverage Report" --prefix "$PWD/include/" --output-directory html ${{env.COVERAGE_FILE}} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Simple-Utility-HTML-Report | |
path: html/ | |
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.COVERAGE_FILE}} | |
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.COVERAGE_FILE }} | |
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.COVERAGE_FILE}} | |
format: lcov | |
fail-on-error: true |