Skip to content

Commit 7fc02ca

Browse files
committed
coverage: do not update cache if build failed
1 parent 9ceb923 commit 7fc02ca

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

.github/workflows/coverage.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: C3 Coverage
2-
on:
2+
on:
33
push:
44
branches:
55
- main
@@ -11,11 +11,11 @@ jobs:
1111
concurrency:
1212
group: ci-${{ github.ref }}
1313
cancel-in-progress: true
14-
container:
14+
container:
1515
image: ghcr.io/dairlab/docker-dair/noble-dair-base:v1.42
1616
credentials:
17-
username: ${{ github.actor }}
18-
password: ${{ secrets.GITHUB_TOKEN }}
17+
username: ${{ github.actor }}
18+
password: ${{ secrets.GITHUB_TOKEN }}
1919
options: --cpus 4
2020
steps:
2121
- name: Check out repository code
@@ -30,13 +30,14 @@ jobs:
3030
key: c3-bazel-cov-cache-${{ hashFiles('**/BUILD.bazel') }}
3131
restore-keys: |
3232
c3-bazel-cov-cache-
33-
- name: Generate Coverage
33+
- name: Generate Coverage
34+
id: generate-coverage
3435
run: bazel coverage
35-
--combined_report=lcov
36-
--local_resources=ram=24000
37-
--local_resources=cpu=4
38-
--jobs=4
39-
//...
36+
--combined_report=lcov
37+
--local_resources=ram=24000
38+
--local_resources=cpu=4
39+
--jobs=4
40+
//...
4041
- name: Report code coverage
4142
uses: zgosalvez/[email protected]
4243
with:
@@ -47,7 +48,7 @@ jobs:
4748
update-comment: true
4849
- name: Save coverage cache
4950
id: c3-cov-cache-save
50-
if: always() && !cancelled() && steps.c3-cov-cache-restore.outputs.cache-hit != 'true'
51+
if: always() && !cancelled() && steps.c3-cov-cache-restore.outputs.cache-hit != 'true' && steps.generate-coverage.outcome == 'success'
5152
uses: actions/cache/save@v4
5253
with:
5354
key: ${{ steps.c3-cov-cache-restore.outputs.cache-primary-key }}

0 commit comments

Comments
 (0)