diff --git a/.cirrus.yml b/.cirrus.yml index 23cc887..a1b3cf6 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -27,23 +27,6 @@ jammy_task: jammy_test_artifacts: path: "bazel-testlogs/**/test.xml" format: junit - coverage_script: - - apt update && apt install -y lcov - - bazel coverage - --combined_report=lcov - --local_resources=ram=24000 - --local_resources=cpu=8 - --remote_cache=http://$CIRRUS_HTTP_CACHE_HOST - --remote_download_minimal - --strategy=CoverageReport=local - --experimental_fetch_all_coverage_outputs - //... - - genhtml --branch-coverage - --output coverage_report - "bazel-out/_coverage/_coverage_report.dat" - jammy_coverage_artifacts: - path: "coverage_report/**/*" - type: text/html noble_task: timeout_in: 120m @@ -73,20 +56,3 @@ noble_task: noble_test_artifacts: path: "bazel-testlogs/**/test.xml" format: junit - coverage_script: - - apt update && apt install -y lcov - - bazel coverage - --combined_report=lcov - --local_resources=ram=24000 - --local_resources=cpu=8 - --remote_cache=http://$CIRRUS_HTTP_CACHE_HOST - --remote_download_minimal - --strategy=CoverageReport=local - --experimental_fetch_all_coverage_outputs - //... - - genhtml --branch-coverage - --output coverage_report - "bazel-out/_coverage/_coverage_report.dat" - noble_coverage_artifacts: - path: "coverage_report/**/*" - type: text/html diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..51ae2cd --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,51 @@ +name: C3 Coverage +on: [pull_request] +jobs: + # Only run coverage on Noble + coverage: + runs-on: ubuntu-latest + concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + container: + image: ghcr.io/dairlab/docker-dair/noble-dair-base:v1.42 + credentials: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + options: --cpus 4 + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Install required dependencies + run: apt update && apt install -y lcov + - name: Restore coverage cache + id: c3-cov-cache-restore + uses: actions/cache/restore@v4 + with: + path: ~/.cache/bazel + key: c3-noble-bazel-cov-cache-${{ github.ref_name }} + restore-keys: | + c3-noble-bazel-cov-cache- + - name: Generate Coverage + run: bazel coverage + --combined_report=lcov + --local_resources=ram=24000 + --local_resources=cpu=4 + --jobs=4 + //... + - name: Report code coverage + uses: zgosalvez/github-actions-report-lcov@v4.1.26 + with: + coverage-files: bazel-out/_coverage/_coverage_report.dat + minimum-coverage: 90 + artifact-name: noble-code-coverage-report + github-token: ${{ secrets.GITHUB_TOKEN }} + update-comment: true + - name: Save coverage cache + id: c3-cov-cache-save + if: always() && !cancelled() && steps.c3-cov-cache-restore.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + key: ${{ steps.c3-cov-cache-restore.outputs.cache-primary-key }} + path: ~/.cache/bazel + - run: echo "🍏 This job's status is ${{ job.status }}." \ No newline at end of file