Skip to content

Upload coverage

Upload coverage #34

name: Upload coverage
on:
workflow_run:
workflows: ['Run GCOVR Ci']
types:
- completed
jobs:
upload:
runs-on: ubuntu-22.04
if: ${{ github.event.workflow_run.conclusion != 'cancelled' }}
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11
with:
name: coverage.*
name_is_regexp: true
run_id: ${{ github.event.workflow_run.id }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload coverage files to Codacy
if: ${{ (github.repository == 'gcovr/gcovr') }}
run: |
# Search the coverage files and upload them
curl -Ls https://coverage.codacy.com/get.sh > get.sh
bash ./get.sh report --partial -l python --force-coverage-parser cobertura $(find . -name 'coverage.xml' -print | sed -e 's/^/ -r /' | tr -d '\n')
bash ./get.sh report --partial -l C --force-coverage-parser cobertura -r 'coverage/cobertura.xml'
bash ./get.sh report --partial -l C --force-coverage-parser clover -r 'coverage/clover.xml'
bash ./get.sh report --partial -l C --force-coverage-parser jacoco -r 'coverage/jacoco.xml' || echo ignored
bash ./get.sh report --partial -l C --force-coverage-parser lcov -r 'coverage/coverage.lcov' || echo ignored
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
- name: Finalize the upload to Codacy
if: ${{ always() && (github.repository == 'gcovr/gcovr') }}
run: |
bash <(curl -Ls https://coverage.codacy.com/get.sh) final
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}