-
Notifications
You must be signed in to change notification settings - Fork 485
97 lines (83 loc) · 3.09 KB
/
Copy pathcoverage.yml
File metadata and controls
97 lines (83 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Coverage
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: coverage-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
OCAMLRUNPARAM: b
jobs:
coverage:
runs-on: ubuntu-24.04-arm
permissions:
actions: write # For build cache overwriting
id-token: write # For CodeCov OIDC
env:
OS: ubuntu-24.04-arm
OCAML_COMPILER: 5.3.0
RUST_TARGET: aarch64-unknown-linux-gnu
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Node and dependencies
uses: ./.github/actions/setup-node
- name: Setup Linux dependencies
uses: ./.github/actions/setup-linux-dependencies
- name: Build rewatch
uses: ./.github/actions/build-rewatch
with:
cache-target: ${{ env.RUST_TARGET }}
- name: Setup OCaml ${{ env.OCAML_COMPILER }}
id: setup_ocaml
uses: ./.github/actions/setup-ocaml
with:
compiler: ${{ env.OCAML_COMPILER }}
os: ${{ env.OS }}
cache-prefix: opam-coverage-v1
dependency-flags: --deps-only --with-test --with-dev-setup
# --- Coverage build cache --------------------------------------------
# The bisect_ppx-instrumented dune build is a separate artifact from
# the main CI build, so it gets its own key. Only restore/save on
# master pushes — PRs share the master cache to stay fast but won't
# poison it.
- name: Coverage build state key
id: coverage-build-state-key
run: echo "value=coverage-build-state-v1-${{ env.OS }}-${{ steps.setup_ocaml.outputs.setup_version }}-${{ env.OCAML_COMPILER }}-${{ hashFiles('*.opam', 'compiler/**', 'dune-project') }}" >> $GITHUB_OUTPUT
- name: Restore coverage build state
if: github.base_ref == 'master' || github.ref == 'refs/heads/master'
id: coverage-build-state
uses: actions/cache/restore@v6
with:
path: |
~/.cache/dune
_build
key: ${{ steps.coverage-build-state-key.outputs.value }}
- name: Run coverage
run: opam exec -- make coverage
- name: Delete stale coverage build state
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
gh extension install actions/gh-actions-cache
gh actions-cache delete ${{ steps.coverage-build-state-key.outputs.value }} \
-R ${{ github.repository }} \
-B "$GITHUB_REF" \
--confirm || echo "not exist"
env:
GH_TOKEN: ${{ github.token }}
- name: Save coverage build state
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: actions/cache/save@v6
with:
path: |
~/.cache/dune
_build
key: ${{ steps.coverage-build-state-key.outputs.value }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v7
with:
files: _coverage/coverage.json
fail_ci_if_error: false
use_oidc: true