Skip to content

Commit c5c162d

Browse files
committed
feat: use github actions for code coverage
1 parent 5f56209 commit c5c162d

File tree

2 files changed

+51
-34
lines changed

2 files changed

+51
-34
lines changed

.cirrus.yml

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,6 @@ jammy_task:
2727
jammy_test_artifacts:
2828
path: "bazel-testlogs/**/test.xml"
2929
format: junit
30-
coverage_script:
31-
- apt update && apt install -y lcov
32-
- bazel coverage
33-
--combined_report=lcov
34-
--local_resources=ram=24000
35-
--local_resources=cpu=8
36-
--remote_cache=http://$CIRRUS_HTTP_CACHE_HOST
37-
--remote_download_minimal
38-
--strategy=CoverageReport=local
39-
--experimental_fetch_all_coverage_outputs
40-
//...
41-
- genhtml --branch-coverage
42-
--output coverage_report
43-
"bazel-out/_coverage/_coverage_report.dat"
44-
jammy_coverage_artifacts:
45-
path: "coverage_report/**/*"
46-
type: text/html
4730

4831
noble_task:
4932
timeout_in: 120m
@@ -73,20 +56,3 @@ noble_task:
7356
noble_test_artifacts:
7457
path: "bazel-testlogs/**/test.xml"
7558
format: junit
76-
coverage_script:
77-
- apt update && apt install -y lcov
78-
- bazel coverage
79-
--combined_report=lcov
80-
--local_resources=ram=24000
81-
--local_resources=cpu=8
82-
--remote_cache=http://$CIRRUS_HTTP_CACHE_HOST
83-
--remote_download_minimal
84-
--strategy=CoverageReport=local
85-
--experimental_fetch_all_coverage_outputs
86-
//...
87-
- genhtml --branch-coverage
88-
--output coverage_report
89-
"bazel-out/_coverage/_coverage_report.dat"
90-
noble_coverage_artifacts:
91-
path: "coverage_report/**/*"
92-
type: text/html

.github/workflows/coverage.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: C3 Coverage
2+
on: [pull_request]
3+
jobs:
4+
# Only run coverage on Noble
5+
coverage:
6+
runs-on: ubuntu-latest
7+
concurrency:
8+
group: ci-${{ github.ref }}
9+
cancel-in-progress: true
10+
container:
11+
image: ghcr.io/dairlab/docker-dair/noble-dair-base:v1.42
12+
credentials:
13+
username: ${{ github.actor }}
14+
password: ${{ secrets.GITHUB_TOKEN }}
15+
options: --cpus 4
16+
steps:
17+
- name: Check out repository code
18+
uses: actions/checkout@v4
19+
- name: Install required dependencies
20+
run: apt update && apt install -y lcov
21+
- name: Restore coverage cache
22+
id: c3-cov-cache-restore
23+
uses: actions/cache/restore@v4
24+
with:
25+
path: ~/.cache/bazel
26+
key: c3-noble-bazel-cov-cache-${{ github.ref_name }}
27+
restore-keys: |
28+
c3-noble-bazel-cov-cache-
29+
- name: Generate Coverage
30+
run: bazel coverage
31+
--combined_report=lcov
32+
--local_resources=ram=24000
33+
--local_resources=cpu=4
34+
--jobs=4
35+
//...
36+
- name: Report code coverage
37+
uses: zgosalvez/[email protected]
38+
with:
39+
coverage-files: bazel-out/_coverage/_coverage_report.dat
40+
minimum-coverage: 90
41+
artifact-name: noble-code-coverage-report
42+
github-token: ${{ secrets.GITHUB_TOKEN }}
43+
update-comment: true
44+
- name: Save coverage cache
45+
id: c3-cov-cache-save
46+
if: always() && !cancelled() && steps.c3-cov-cache-restore.outputs.cache-hit != 'true'
47+
uses: actions/cache/save@v4
48+
with:
49+
key: ${{ steps.c3-cov-cache-restore.outputs.cache-primary-key }}
50+
path: ~/.cache/bazel
51+
- run: echo "🍏 This job's status is ${{ job.status }}."

0 commit comments

Comments
 (0)