-
Notifications
You must be signed in to change notification settings - Fork 3.7k
225 lines (210 loc) · 9.54 KB
/
lint-test.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: "Lint+Test"
on:
pull_request:
types: [labeled, opened, synchronize, reopened, auto_merge_enabled]
push:
branches:
- main
- devnet
- testnet
- mainnet
- aptos-node-v*
- aptos-release-v*
workflow_dispatch:
env:
HAS_BUILDPULSE_SECRETS: ${{ secrets.BUILDPULSE_ACCESS_KEY_ID != '' && secrets.BUILDPULSE_SECRET_ACCESS_KEY != '' }}
HAS_DATADOG_SECRETS: ${{ secrets.DD_API_KEY != '' }}
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:
# This job determines which files were changed
file_change_determinator:
runs-on: ubuntu-latest
outputs:
only_docs_changed: ${{ steps.determine_file_changes.outputs.only_docs_changed }}
steps:
- uses: actions/checkout@v3
- name: Run the file change determinator
id: determine_file_changes
uses: ./.github/actions/file-change-determinator
# Run all general lints (i.e., non-rust and docs lints). This is a PR required job.
general-lints:
needs: file_change_determinator
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
if: needs.file_change_determinator.outputs.only_docs_changed != 'true'
- name: Run general lints
uses: ./.github/actions/general-lints
if: needs.file_change_determinator.outputs.only_docs_changed != 'true'
with:
GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }}
- run: echo "Skipping general lints! Unrelated changes detected."
if: needs.file_change_determinator.outputs.only_docs_changed == 'true'
# Run the docs linter. This is a PR required job.
docs-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .node-version
- uses: pnpm/action-setup@v2
- run: pnpm lint
working-directory: developer-docs-site
- run: sudo apt update -y && sudo apt install -y aspell aspell-en
- run: pnpm spellcheck
working-directory: developer-docs-site
# Run the crypto hasher domain separation checks
rust-cryptohasher-domain-separation-check:
needs: file_change_determinator
runs-on: high-perf-docker
if: contains(github.event.pull_request.labels.*.name, 'CICD:non-required-tests')
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # pin@v3
- uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984
- uses: aptos-labs/aptos-core/.github/actions/rust-setup@main
with:
GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }}
- run: python3 scripts/check-cryptohasher-symbols.py
# Run all rust lints. This is a PR required job.
rust-lints:
needs: file_change_determinator
runs-on: high-perf-docker
steps:
- uses: actions/checkout@v3
if: needs.file_change_determinator.outputs.only_docs_changed != 'true'
- name: Run rust lints
uses: ./.github/actions/rust-lints
if: needs.file_change_determinator.outputs.only_docs_changed != 'true'
with:
GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }}
- run: echo "Skipping rust lints! Unrelated changes detected."
if: needs.file_change_determinator.outputs.only_docs_changed == 'true'
# Run all rust smoke tests. This is a PR required job.
rust-smoke-tests:
needs: file_change_determinator
if: | # Only run on each PR once an appropriate event occurs
(
github.event_name == 'workflow_dispatch' ||
github.event_name == 'push' ||
contains(github.event.pull_request.labels.*.name, 'CICD:run-e2e-tests') ||
github.event.pull_request.auto_merge != null) ||
contains(github.event.pull_request.body, '#e2e'
)
runs-on: high-perf-docker
steps:
- uses: actions/checkout@v3
if: needs.file_change_determinator.outputs.only_docs_changed != 'true'
- name: Run rust smoke tests
uses: ./.github/actions/rust-smoke-tests
if: needs.file_change_determinator.outputs.only_docs_changed != 'true'
with:
GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }}
- run: echo "Skipping rust smoke tests! Unrelated changes detected."
if: needs.file_change_determinator.outputs.only_docs_changed == 'true'
# Run all rust unit tests. This is a PR required job.
rust-unit-tests:
needs: file_change_determinator
runs-on: high-perf-docker
steps:
- uses: actions/checkout@v3
if: needs.file_change_determinator.outputs.only_docs_changed != 'true'
- name: Run rust unit tests
uses: ./.github/actions/rust-unit-tests
if: needs.file_change_determinator.outputs.only_docs_changed != 'true'
with:
GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }}
- run: echo "Skipping rust unit tests! Unrelated changes detected."
if: needs.file_change_determinator.outputs.only_docs_changed == 'true'
# Run the consensus only unit tests
rust-consensus-only-unit-test:
runs-on: high-perf-docker
if: contains(github.event.pull_request.labels.*.name, 'CICD:build-consensus-only-image')
steps:
- uses: actions/checkout@v3
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
with:
GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }}
- uses: taiki-e/install-action@v1.5.6
with:
tool: nextest
- run: cargo nextest run --locked --workspace --exclude smoke-test --exclude aptos-testcases --exclude aptos-api --exclude aptos-executor-benchmark --exclude aptos-backup-cli --retries 3 --no-fail-fast -F consensus-only-perf-test
env:
RUST_MIN_STACK: 4297152
# Run the rust network performance unit tests
rust-network-perf-unit-test:
runs-on: high-perf-docker
if: contains(github.event.pull_request.labels.*.name, 'CICD:non-required-tests')
steps:
- uses: actions/checkout@v3
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
with:
GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }}
- uses: taiki-e/install-action@v1.5.6
with:
tool: nextest
- run: | # Test the client and server
cargo nextest run --locked -p aptos-peer-monitoring-service-client --no-fail-fast -F network-perf-test
cargo nextest run --locked -p aptos-peer-monitoring-service-server --no-fail-fast -F network-perf-test
# Run the consensus only smoke test
rust-consensus-only-smoke-test:
runs-on: high-perf-docker
if: contains(github.event.pull_request.labels.*.name, 'CICD:build-consensus-only-image')
steps:
- uses: actions/checkout@v3
- uses: aptos-labs/aptos-core/.github/actions/rust-setup@main
with:
GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }}
- uses: taiki-e/install-action@v1.5.6
with:
tool: nextest
# prebuild aptos-node binary, so that tests don't start before node is built.
# also prebuild aptos-node binary as a separate step to avoid feature unification issues
- run: cargo build --locked --package=aptos-node -F consensus-only-perf-test --release && LOCAL_SWARM_NODE_RELEASE=1 CONSENSUS_ONLY_PERF_TEST=1 cargo nextest run --release --package smoke-test -E "test(test_consensus_only_with_txn_emitter)" --run-ignored all
# We always try to create the artifact, but it only creates on flaky or failed smoke tests -- when the directories are empty.
- name: Upload smoke test logs for failed and flaky tests
uses: actions/upload-artifact@v3
if: ${{ failure() || success() }}
with:
name: failed-consensus-only-smoke-test-logs
# Retain all smoke test data except for the db (which may be large).
path: |
/tmp/.tmp*
!/tmp/.tmp*/**/db/
retention-days: 14
# Run the network performance smoke test
rust-network-perf-smoke-test:
runs-on: high-perf-docker
if: contains(github.event.pull_request.labels.*.name, 'CICD:non-required-tests')
steps:
- uses: actions/checkout@v3
- uses: aptos-labs/aptos-core/.github/actions/rust-setup@main
with:
GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }}
- uses: taiki-e/install-action@v1.5.6
with:
tool: nextest
# prebuild aptos-node binary, so that tests don't start before node is built.
# also prebuild aptos-node binary as a separate step to avoid feature unification issues
- run: cargo build --locked --package=aptos-node -F network-perf-test --release && LOCAL_SWARM_NODE_RELEASE=1 NETWORK_PERF_TEST=1 cargo nextest run --release --package smoke-test -E "test(test_network_performance_monitoring)" --run-ignored all
# We always try to create the artifact, but it only creates on flaky or failed smoke tests -- when the directories are empty.
- name: Upload smoke test logs for failed and flaky tests
uses: actions/upload-artifact@v3
if: ${{ failure() || success() }}
with:
name: failed-consensus-only-smoke-test-logs
# Retain all smoke test data except for the db (which may be large).
path: |
/tmp/.tmp*
!/tmp/.tmp*/**/db/
retention-days: 14