-
-
Notifications
You must be signed in to change notification settings - Fork 21
78 lines (66 loc) · 1.95 KB
/
codecov.yml
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
name: Code Coverage # Run cargo-llvm-cov and upload to codecov.io
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]
paths-ignore:
- '**.rs'
- '.github/workflows/codecov.yml'
push:
branches:
- main
paths:
- '**.rs'
- '.github/workflows/codecov.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
jobs:
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Pnpm
uses: ./.github/actions/pnpm
- name: Install Rust Toolchain
uses: ./.github/actions/rustup
with:
shared-key: 'codecov'
save-cache: ${{ github.ref_name == 'main' }}
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install llvm-tools-preview for llvm-cov
run: rustup component add llvm-tools-preview
- name: Run
run: cargo llvm-cov --lcov --output-path lcov.info
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: codecov
path: lcov.info
# codecov often fails, use another workflow for retry
upload-codecov:
name: Upload coverage file
runs-on: ubuntu-latest
needs: coverage
# Check if the event is not triggered by a fork by checking whether CODECOV_TOKEN is set
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Checkout
if: env.CODECOV_TOKEN
uses: actions/checkout@v4
- name: Download coverage file
if: env.CODECOV_TOKEN
uses: actions/download-artifact@v3
with:
name: codecov
- name: Upload to codecov.io
if: env.CODECOV_TOKEN
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: lcov.info