-
Notifications
You must be signed in to change notification settings - Fork 85
266 lines (232 loc) · 8.24 KB
/
ci.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
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
name: CI
on:
push:
branches: [main]
pull_request:
types:
- opened
- reopened
- synchronize
- auto_merge_enabled
- edited # for when the PR title is edited
merge_group:
types: [checks_requested]
env:
PROTOC_VERSION: v25.1
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install commitlint
run: npm install --global @commitlint/cli @commitlint/config-conventional
- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
- name: Validate PR title with commitlint
if: github.event_name != 'merge_group' && github.event_name != 'push'
run: echo "${{ github.event.pull_request.title }}" | commitlint --verbose
executable-run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
with:
version: ${{env.PROTOC_VERSION}}
- run: mkdir data
- name: Build node
run: cargo build -r
- name: Run executable
run: >
target/release/papyrus_node --base_layer.node_url ${{ secrets.CI_BASE_LAYER_NODE_URL }}
& sleep 30 ; kill $!
executable-run-no-rpc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
with:
version: ${{env.PROTOC_VERSION}}
- run: mkdir data
- name: Build node
run: cargo build -r --no-default-features
- name: Run executable
run: >
target/release/papyrus_node --base_layer.node_url ${{ secrets.CI_BASE_LAYER_NODE_URL }}
& sleep 30 ; kill $!
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
with:
version: ${{env.PROTOC_VERSION}}
- run: npm install -g [email protected]
- run: |
cargo test --workspace -r
env:
SEED: 0
integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
with:
version: ${{env.PROTOC_VERSION}}
- run: >
cargo test -r --test '*' -- --include-ignored --skip test_gw_integration_testnet;
cargo run -r -p papyrus_node --bin central_source_integration_test --features="futures-util tokio-stream"
test-no-rpc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
- run: |
cargo test -p papyrus_node --no-default-features
env:
SEED: 0
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
components: rustfmt
toolchain: nightly-2024-01-12
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
with:
version: ${{env.PROTOC_VERSION}}
- run: cargo +nightly-2024-01-12 fmt --all -- --check
udeps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
name: "Rust Toolchain Setup"
with:
toolchain: nightly-2024-01-12
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
with:
version: ${{env.PROTOC_VERSION}}
- name: "Download and run cargo-udeps"
run: |
wget -O - -c https://github.com/est31/cargo-udeps/releases/download/v0.1.35/cargo-udeps-v0.1.35-x86_64-unknown-linux-gnu.tar.gz | tar -xz
cargo-udeps-*/cargo-udeps udeps
env:
RUSTUP_TOOLCHAIN: nightly-2024-01-12
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
with:
version: ${{env.PROTOC_VERSION}}
- run: echo "Skipping clippy for now"
- run: >
cargo clippy --all-targets --all-features -- -D warnings -D future-incompatible
-D nonstandard-style -D rust-2018-idioms -D unused -D clippy::unwrap_used
-A clippy::blocks_in_conditions # This is because of a bug in tracing: https://github.com/tokio-rs/tracing/issues/2876
doc:
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
with:
version: ${{env.PROTOC_VERSION}}
- run: cargo doc -r --document-private-items --no-deps
check:
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
with:
version: ${{env.PROTOC_VERSION}}
- run: cargo check -r --all-features
codecov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Set-Up
run: |
sudo apt-get update
sudo apt-get install -y clang llvm libudev-dev
- uses: Noelware/[email protected]
with:
version: ${{env.PROTOC_VERSION}}
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- uses: Swatinem/rust-cache@v2
- run: npm install -g [email protected]
- name: Coverage
run: cargo llvm-cov --codecov -r --output-path codecov.json
env:
SEED: 0
- name: Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
fail_ci_if_error: true
version: "v0.1.15"
check-starknet_api-dependency:
runs-on: ubuntu-latest
if: github.base_ref == 'main' # this step is only run if the pr is to the main branch
steps:
- uses: actions/checkout@v4
- run: sudo apt-get install jq
- run: ./check_starknet_api_version_dependency.sh # this script checks that if the starknet_api dependency is by git rev then this rev (commit) is on main
build-papyrus-utilities-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# enable docker layer caching, speeds up the building of the image
- uses: satackey/[email protected]
continue-on-error: true # ignore the failure of a step and avoid terminating the job.
- run: DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker build -f papyrus_utilities.Dockerfile .
random-table-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# run this job only if the path 'crates/papyrus_storage/src/db/**' is changed, because it takes around 2 minutes.
- uses: dorny/paths-filter@v3
id: changes
with:
# The 'base' and 'ref' parameters are set to be able to run the job in a 'merge_group' event. in a 'pull_request' event
# those parameters are ignored.
base: ${{ github.event.merge_group.base_ref}}
ref: ${{ github.event.merge_group.head_ref }}
filters: |
target_directory:
- 'crates/papyrus_storage/src/db/**'
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# repeat this job 32 times. this is a random test for part of the code that may cause a corrupted database.
- run: for run in {1..32}; do cargo test -r -p papyrus_storage -- --include-ignored common_prefix_compare_with_simple_table_random; done
if: steps.changes.outputs.target_directory == 'true'