forked from aptos-labs/aptos-core
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (77 loc) · 3.41 KB
/
coverage.yaml
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
name: Test Coverage
on:
workflow_dispatch:
workflow_call:
schedule:
# every day at 9am PST
- cron: "0 16 * * *"
pull_request:
types: [ labeled, opened, synchronize, reopened ]
env:
CARGO_INCREMENTAL: "0"
CARGO_TERM_COLOR: always
# cancel redundant builds
concurrency:
# cancel redundant builds on PRs (only on PR, not on branches)
group: ${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.ref) || github.sha }}
cancel-in-progress: true
jobs:
rust-unit-coverage:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'CICD:run-coverage')
timeout-minutes: 120
runs-on: high-perf-docker
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # pin@v3
with:
fetch-depth: 0 # get all the history because cargo xtest --change-since origin/main requires it.
- uses: ./.github/actions/rust-setup
- run: rustup component add llvm-tools-preview
- uses: taiki-e/install-action@6f1ebcd9e21315fc37d7f7bc851dfcc8356d7da3 # pin@v1.5.6
with:
tool: nextest,cargo-llvm-cov
- run: docker run --detach -p 5432:5432 cimg/postgres:14.2
- run: cargo llvm-cov --ignore-run-fail --workspace --exclude smoke-test --exclude aptos-testcases --lcov --jobs 32 --output-path lcov_unit.info
env:
INDEXER_DATABASE_URL: postgresql://postgres@localhost/postgres
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3
with:
name: lcov_unit
path: lcov_unit.info
rust-smoke-coverage:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'CICD:run-coverage')
timeout-minutes: 120
runs-on: high-perf-docker
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # pin@v3
with:
fetch-depth: 0 # get all the history because cargo xtest --change-since origin/main requires it.
- uses: ./.github/actions/rust-setup
- run: rustup component add llvm-tools-preview
- uses: taiki-e/install-action@6f1ebcd9e21315fc37d7f7bc851dfcc8356d7da3 # pin@v1.5.6
with:
tool: nextest,cargo-llvm-cov
- run: docker run --detach -p 5432:5432 cimg/postgres:14.2
- run: cargo llvm-cov --ignore-run-fail --package smoke-test --lcov --output-path lcov_smoke.info
env:
INDEXER_DATABASE_URL: postgresql://postgres@localhost/postgres
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3
with:
name: lcov_smoke
path: lcov_smoke.info
upload-to-codecov:
if: (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'CICD:run-coverage')) && !cancelled()
needs: [ rust-unit-coverage, rust-smoke-coverage ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # pin@v3
- uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # pin@v3
with:
name: lcov_unit
- uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # pin@v3
with:
name: lcov_smoke
- name: Upload coverage to Codecov
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # pin@v3
with:
files: lcov_unit.info,lcov_smoke.info
fail_ci_if_error: true