forked from aptos-labs/aptos-core
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (104 loc) · 4.48 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: "Test_Coverage"
on:
# Trigger if any of the conditions
# 1. Daily at 12am UTC from the main branch, or
# 2. PR with a specific label (see below)
schedule:
- cron: "0 0 * * *"
pull_request:
types: [labeled]
workflow_dispatch:
workflow_call:
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: |
contains(github.event.pull_request.labels.*.name, 'CICD:run-coverage') ||
(github.event_name == 'schedule' && github.ref_name == 'main')
# Note the tests run slowly due to instrutmentation. It takes CI 10 hrs
timeout-minutes: 720
runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # get all the history because cargo xtest --change-since origin/main requires it.
- uses: aptos-labs/aptos-core/.github/actions/rust-setup@main
- run: rustup component add llvm-tools-preview
- uses: taiki-e/install-action@4fedbddde88aab767a45a011661f832d68202716 # pin@v2.33.28
with:
tool: nextest,cargo-llvm-cov
- run: docker run --detach -p 5432:5432 cimg/postgres:14.2
- run: cargo llvm-cov nextest --lcov --output-path lcov_unit.info -vv --ignore-run-fail --workspace --exclude smoke-test --exclude aptos-testcases
env:
INDEXER_DATABASE_URL: postgresql://postgres@localhost/postgres
RUST_MIN_STACK: 33554432 # 32 MB of stack
MVP_TEST_ON_CI: true
SOLC_EXE: /home/runner/bin/solc
Z3_EXE: /home/runner/bin/z3
CVC5_EXE: /home/runner/bin/cvc5
DOTNET_ROOT: /home/runner/.dotnet
BOOGIE_EXE: /home/runner/.dotnet/tools/boogie
- uses: actions/upload-artifact@v4
with:
name: lcov_unit
path: lcov_unit.info
rust-smoke-coverage:
if: |
contains(github.event.pull_request.labels.*.name, 'CICD:run-coverage') ||
(github.event_name == 'schedule' && github.ref_name == 'main')
timeout-minutes: 720 # incremented from 240 due to execution time limit hit in cron
runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # get all the history because cargo xtest --change-since origin/main requires it.
- uses: aptos-labs/aptos-core/.github/actions/rust-setup@main
- run: rustup component add llvm-tools-preview
- uses: taiki-e/install-action@4fedbddde88aab767a45a011661f832d68202716 # pin@v2.33.28
with:
tool: nextest,cargo-llvm-cov
- run: docker run --detach -p 5432:5432 cimg/postgres:14.2
- run: cargo build --locked --package=aptos-node --features=failpoints,indexer --release && LLVM_PROFDATA_FLAGS="--failure-mode=all" LOCAL_SWARM_NODE_RELEASE=1 cargo llvm-cov nextest --lcov --output-path lcov_smoke.info -vv --ignore-run-fail --profile smoke-test -p smoke-test
env:
INDEXER_DATABASE_URL: postgresql://postgres@localhost/postgres
RUST_MIN_STACK: 33554432
MVP_TEST_ON_CI: true
SOLC_EXE: /home/runner/bin/solc
Z3_EXE: /home/runner/bin/z3
CVC5_EXE: /home/runner/bin/cvc5
DOTNET_ROOT: /home/runner/.dotnet
BOOGIE_EXE: /home/runner/.dotnet/tools/boogie
- uses: actions/upload-artifact@v4
with:
name: lcov_smoke
path: lcov_smoke.info
upload-to-codecov:
if: |
contains(github.event.pull_request.labels.*.name, 'CICD:run-coverage') ||
(github.event_name == 'schedule' && github.ref_name == 'main')
&& !cancelled()
needs: [ rust-unit-coverage, rust-smoke-coverage ]
runs-on: ubuntu-latest
continue-on-error: true # Don't fail if the codecov upload fails
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: lcov_unit
- uses: actions/download-artifact@v4
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