forked from cowprotocol/services
-
Notifications
You must be signed in to change notification settings - Fork 0
291 lines (279 loc) · 12.1 KB
/
pull-request.yaml
File metadata and controls
291 lines (279 loc) · 12.1 KB
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
name: pull request
on:
pull_request:
# We require PRs to be up to date before merging so technically it is not needed run the rust job
# on main. However for the cache to be usable in PRs we do need the job on main.
push:
branches: [ main ]
jobs:
lint:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- run: rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # v1.0.6
with:
profile: minimal
toolchain: nightly
components: rustfmt
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff
with:
just-version: 1.39.0
- run: |
rustup --version
rustup show
cargo --version
cargo +nightly fmt --version
cargo clippy --version
- run: just fmt --check
- run: just clippy
trivy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Run Trivy
uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # v0.32.0
with:
scan-type: 'fs'
format: 'sarif'
output: 'trivy-results.sarif'
- name: Upload Trivy scan results to GitHub Security
uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
with:
sarif_file: 'trivy-results.sarif'
nitpicker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: ethanis/nitpicker@e891622bbd9a6ec97a473bcfacfca7332caf2862 # v1.7
with:
nitpicks: ".github/nitpicks.yml"
token: "${{ secrets.GITHUB_TOKEN }}"
doc-tests:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff
with:
just-version: 1.39.0
- run: rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
- run: just test-doc
unit-tests:
timeout-minutes: 60
runs-on: ubuntu-latest
env:
# Shrink artifact size by not including debug info. Makes build faster and shrinks cache.
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- run: rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
- uses: taiki-e/install-action@e4767ccc6762bc4347ef2275c75ea77f5f36e27f # nextest
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff
with:
just-version: 1.39.0
- run: cargo build --tests
- run: just test-unit
test-db:
timeout-minutes: 60
runs-on: ubuntu-latest
env:
# Shrink artifact size by not including debug info. Makes build faster and shrinks cache.
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- run: rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
# Start the build process in the background. The following cargo test command will automatically
# wait for the build process to be done before proceeding.
- run: cargo build -p orderbook -p database -p autopilot --tests &
- uses: taiki-e/install-action@e4767ccc6762bc4347ef2275c75ea77f5f36e27f # nextest
- uses: yu-ichiro/spin-up-docker-compose-action@b7808421e139a485cb455f78e66605ca9dbe4334 # v1.2
with:
file: docker-compose.yaml
up-opts: -d db
- uses: yu-ichiro/spin-up-docker-compose-action@b7808421e139a485cb455f78e66605ca9dbe4334 # v1.2
with:
file: docker-compose.yaml
up-opts: migrations --abort-on-container-failure
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff
with:
just-version: 1.39.0
- run: just test-db
test-local-node:
timeout-minutes: 60
runs-on: ubuntu-latest
env:
# Shrink artifact size by not including debug info. Makes build faster and shrinks cache.
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_TERM_COLOR: always
TOML_TRACE_ERROR: 1
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- run: rustup toolchain install stable --profile minimal
- uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
# Start the build process in the background. The following cargo test command will automatically
# wait for the build process to be done before proceeding.
- run: cargo build -p e2e --tests &
- uses: taiki-e/install-action@e4767ccc6762bc4347ef2275c75ea77f5f36e27f # nextest
- uses: yu-ichiro/spin-up-docker-compose-action@b7808421e139a485cb455f78e66605ca9dbe4334 # v1.2
with:
file: docker-compose.yaml
up-opts: -d db
- uses: yu-ichiro/spin-up-docker-compose-action@b7808421e139a485cb455f78e66605ca9dbe4334 # v1.2
with:
file: docker-compose.yaml
up-opts: migrations --abort-on-container-failure
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff
with:
just-version: 1.39.0
- run: just test-e2e-local
test-forked-node:
# Do not run this job on forks since some secrets are required for it.
if: |
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
(github.event_name == 'push' && github.ref == 'refs/heads/main')
timeout-minutes: 60
runs-on: ubuntu-latest
env:
# Shrink artifact size by not including debug info. Makes build faster and shrinks cache.
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_TERM_COLOR: always
FORK_URL_MAINNET: ${{ secrets.FORK_URL_MAINNET }}
FORK_URL_GNOSIS: ${{ secrets.FORK_URL_GNOSIS }}
TOML_TRACE_ERROR: 1
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- run: rustup toolchain install stable --profile minimal
- uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0
with:
# the latest version introduced a bug caused forked node tests to fail
# only switch back to latest stable version after it was fixed in anvil
version: v1.0.0
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
# Start the build process in the background. The following cargo test command will automatically
# wait for the build process to be done before proceeding.
- run: cargo build -p e2e --tests &
- uses: taiki-e/install-action@e4767ccc6762bc4347ef2275c75ea77f5f36e27f # nextest
- uses: yu-ichiro/spin-up-docker-compose-action@b7808421e139a485cb455f78e66605ca9dbe4334 # v1.2
with:
file: docker-compose.yaml
up-opts: -d db
- uses: yu-ichiro/spin-up-docker-compose-action@b7808421e139a485cb455f78e66605ca9dbe4334 # v1.2
with:
file: docker-compose.yaml
up-opts: migrations --abort-on-container-failure
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff
with:
just-version: 1.39.0
- run: just test-e2e-forked
test-driver:
timeout-minutes: 60
runs-on: ubuntu-latest
env:
# Shrink artifact size by not including debug info. Makes build faster and shrinks cache.
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_TERM_COLOR: always
TOML_TRACE_ERROR: 1
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- run: rustup toolchain install stable --profile minimal
- uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
- uses: taiki-e/install-action@e4767ccc6762bc4347ef2275c75ea77f5f36e27f # nextest
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff
with:
just-version: 1.39.0
# Build the driver's tests.
- run: cargo build -p driver --tests
# Don't spawn any docker containers. The driver's tests will spawn anvil itself.
- run: just test-driver
openapi:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- run: npm install @apidevtools/swagger-cli @stoplight/spectral-cli
- run: node_modules/.bin/swagger-cli validate crates/orderbook/openapi.yml
- run: node_modules/.bin/swagger-cli validate crates/driver/openapi.yml
- run: node_modules/.bin/swagger-cli validate crates/solvers/openapi.yml
- run: node_modules/.bin/spectral lint crates/orderbook/openapi.yml
- run: node_modules/.bin/spectral lint crates/driver/openapi.yml
- run: node_modules/.bin/spectral lint crates/solvers/openapi.yml
run-flaky-test:
# to debug a flaky test set `if` to true and configure the flaky test in the `run` step
if: ${{ false }}
timeout-minutes: 60
runs-on: ubuntu-latest
env:
# Shrink artifact size by not including debug info. Makes build faster and shrinks cache.
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_TERM_COLOR: always
TOML_TRACE_ERROR: 1
FORK_URL_MAINNET: ${{ secrets.FORK_URL_MAINNET }}
FORK_URL_GNOSIS: ${{ secrets.FORK_URL_GNOSIS }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- run: rustup toolchain install stable --profile minimal
- uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
# Start the build process in the background. The following cargo test command will automatically
# wait for the build process to be done before proceeding.
- run: cargo build -p e2e --tests &
- uses: taiki-e/install-action@e4767ccc6762bc4347ef2275c75ea77f5f36e27f # nextest
- uses: yu-ichiro/spin-up-docker-compose-action@b7808421e139a485cb455f78e66605ca9dbe4334 # v1.2
with:
file: docker-compose.yaml
up-opts: -d db
- uses: yu-ichiro/spin-up-docker-compose-action@b7808421e139a485cb455f78e66605ca9dbe4334 # v1.2
with:
file: docker-compose.yaml
up-opts: migrations --abort-on-container-failure
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff
with:
just-version: 1.39.0
- name: Run test in a loop
run: |
attempt=1
while true; do
echo "Running test attempt #$attempt"
if ! just test-e2e forked_node_mainnet_repay_debt_with_collateral_of_safe; then
exit 1
fi
attempt=$((attempt+1))
done