-
Notifications
You must be signed in to change notification settings - Fork 1
379 lines (379 loc) · 14.3 KB
/
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
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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
name: Test
on:
push:
branches:
- trunk
paths:
- crates/**
- dev/**
- plugins/**
- tools/**
- Cargo.toml
- Cargo.lock
- rustfmt.toml
- clippy.toml
- .cargo/**
- .ci/github-workflows/**
- .config/nextest.toml
- .github/workflows/test.yaml
- schemas/graphql/schema.graphql
pull_request:
branches:
- trunk
env:
CARGO_TERM_COLOR: always
jobs:
compile-xtask-linux:
name: Compile xtask (Linux)
runs-on: ubuntu-latest
env:
UXTASK_USE_GLOBAL_CARGO: '1'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install lld
run: sudo apt-get install -y lld
- name: Install rust
run: rustup toolchain install nightly --no-self-update && rustup default nightly
- name: Compile xtask
run: cargo build -p upsilon-xtask --bin upsilon-xtask --verbose
- name: Copy xtask to artifact
run: mkdir -p ./ci-artifacts && cp target/debug/upsilon-xtask ./ci-artifacts/upsilon-xtask
- name: Upload xtask
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-xtask
path: ./ci-artifacts/upsilon-xtask
style-checks:
name: Style checks
runs-on: ubuntu-latest
needs: compile-xtask-linux
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install lld
run: sudo apt-get install -y lld
- name: Install rust
run: rustup toolchain install nightly --no-self-update && rustup default nightly
- name: Install rustfmt
run: rustup component add rustfmt
- name: Download xtask
uses: actions/download-artifact@v3
with:
name: ${{ runner.os }}-xtask
path: ./ci-artifacts/downloaded-xtask
- name: Move downloaded xtask to artifact path
run: mkdir -p ./ci-artifacts && mv ./ci-artifacts/downloaded-xtask/upsilon-xtask ./ci-artifacts/upsilon-xtask && chmod +x ./ci-artifacts/upsilon-xtask
- name: Run fmt check
run: ./ci-artifacts/upsilon-xtask fmt-check
- name: Git checks
run: ./ci-artifacts/upsilon-xtask git-checks --checkout
if: success() || failure()
- name: Check Cargo.toml dependencies order
run: ./ci-artifacts/upsilon-xtask check-cargo-dep-order
if: success() || failure()
- name: Check Cargo.toml dependencies from workspace.dependencies
run: ./ci-artifacts/upsilon-xtask check-cargo-dep-from-workspace
if: success() || failure()
gql-schema-up-to-date:
name: GraphQL schema is up-to-date
runs-on: ubuntu-latest
needs: compile-xtask-linux
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install lld
run: sudo apt-get install -y lld
- name: Install rust
run: rustup toolchain install nightly --no-self-update && rustup default nightly
- name: Download xtask
uses: actions/download-artifact@v3
with:
name: ${{ runner.os }}-xtask
path: ./ci-artifacts/downloaded-xtask
- name: Move downloaded xtask to artifact path
run: mkdir -p ./ci-artifacts && mv ./ci-artifacts/downloaded-xtask/upsilon-xtask ./ci-artifacts/upsilon-xtask && chmod +x ./ci-artifacts/upsilon-xtask
- name: Run gql schema check
run: ./ci-artifacts/upsilon-xtask graphql-schema-check
ci-files-up-to-date:
name: CI files are up-to-date
runs-on: ubuntu-latest
needs: compile-xtask-linux
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install lld
run: sudo apt-get install -y lld
- name: Install rust
run: rustup toolchain install nightly --no-self-update && rustup default nightly
- name: Download xtask
uses: actions/download-artifact@v3
with:
name: ${{ runner.os }}-xtask
path: ./ci-artifacts/downloaded-xtask
- name: Move downloaded xtask to artifact path
run: mkdir -p ./ci-artifacts && mv ./ci-artifacts/downloaded-xtask/upsilon-xtask ./ci-artifacts/upsilon-xtask && chmod +x ./ci-artifacts/upsilon-xtask
- name: Run ci files up to date check
run: ./ci-artifacts/upsilon-xtask check-ci-files-up-to-date
lint:
name: Lint
runs-on: ubuntu-latest
needs: compile-xtask-linux
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install lld
run: sudo apt-get install -y lld
- name: Install openssl
run: sudo apt-get install -y libssl-dev
- name: Install rust
run: rustup toolchain install nightly --no-self-update && rustup default nightly
- name: Install clippy
run: rustup component add clippy
- name: Download xtask
uses: actions/download-artifact@v3
with:
name: ${{ runner.os }}-xtask
path: ./ci-artifacts/downloaded-xtask
- name: Move downloaded xtask to artifact path
run: mkdir -p ./ci-artifacts && mv ./ci-artifacts/downloaded-xtask/upsilon-xtask ./ci-artifacts/upsilon-xtask && chmod +x ./ci-artifacts/upsilon-xtask
- name: Lint
run: ./ci-artifacts/upsilon-xtask lint
test-linux:
name: Test (Linux)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install lld
run: sudo apt-get install -y lld
- name: Install openssl
run: sudo apt-get install -y libssl-dev
- name: Install rust
run: rustup toolchain install nightly --no-self-update && rustup default nightly
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Print environment
run: "\n env\n "
- name: Collect other system information
run: "\n git --version\n "
- name: Compile xtask
run: cargo build -p upsilon-xtask --bin upsilon-xtask --verbose
- name: Compile binaries and tests
run: cargo xtask test --verbose --no-run --profile ci --custom-bin-dir ./bin-dir
- name: Run tests
run: cargo xtask test --verbose --no-fail-fast --profile ci --no-build-dev --custom-bin-dir ./bin-dir
- name: Run doctests
run: cargo xtask test --verbose --no-fail-fast --doc --profile ci --no-build-dev
test-linux-with-difftests:
name: Test (Linux with difftests)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install lld
run: sudo apt-get install -y lld
- name: Install openssl
run: sudo apt-get install -y libssl-dev
- name: Install rust
run: rustup toolchain install nightly --no-self-update && rustup default nightly
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Print environment
run: "\n env\n "
- name: Collect other system information
run: "\n git --version\n "
- name: Compile xtask
run: cargo build -p upsilon-xtask --bin upsilon-xtask --verbose
- name: Compile binaries and tests (with difftests)
run: cargo xtask test --verbose --no-run --profile difftests --custom-bin-dir ./bin-dir
- name: Run tests (with difftests)
run: cargo xtask test --verbose --no-fail-fast --profile difftests --no-build-dev --custom-bin-dir ./bin-dir
test-linux-only-difftests:
name: Test (Linux only difftests)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Get old commit
id: get-old-commit
run: "\n if [ \"$PUSH_BEFORE\" != \"\" ]; then\n echo \"OLD_COMMIT=$PUSH_BEFORE\" >> $GITHUB_OUTPUT\n else\n if [ \"$PULL_REQUEST_BASE_SHA\" != \"\" ]; then\n echo \"OLD_COMMIT=$PULL_REQUEST_BASE_SHA\" >> $GITHUB_OUTPUT\n else\n echo \"Error: neither PUSH_BEFORE nor PULL_REQUEST_BASE_SHA is set\" >&2\n exit 1\n fi\n fi\n "
env:
PUSH_BEFORE: ${{ github.event.before }}
PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}
- name: Install lld
run: sudo apt-get install -y lld
- name: Install openssl
run: sudo apt-get install -y libssl-dev
- name: Install rust
run: rustup toolchain install nightly --no-self-update && rustup default nightly
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Print environment
run: "\n env\n "
- name: Collect other system information
run: "\n git --version\n "
- name: Compile xtask
run: cargo build -p upsilon-xtask --bin upsilon-xtask --verbose
- name: Compile binaries and tests (with difftests)
run: cargo xtask test --verbose --no-run --profile difftests --custom-bin-dir ./bin-dir
- name: Run tests (only difftests)
run: cargo xtask test-quick --from-index --verbose --no-fail-fast --profile difftests --algo git-diff-files --commit ${{ steps.get-old-commit.outputs.OLD_COMMIT }}
compile-openssl-win:
name: Compile openssl (Windows)
runs-on: windows-latest
steps:
- name: Setup env
run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Restore built openssl
id: restore_build_openssl
uses: actions/cache/restore@v3
env:
OPENSSL_TRIPLE: x64-windows-static-md
with:
path: ${{ env.VCPKG_ROOT }}\installed\${{ env.OPENSSL_TRIPLE }}
key: build-openssl-win
- name: Install openssl
run: vcpkg install openssl:x64-windows-static-md
if: steps.restore_build_openssl.outputs.cache-hit != 'true'
- name: Save built openssl
uses: actions/cache/save@v3
env:
OPENSSL_TRIPLE: x64-windows-static-md
with:
path: ${{ env.VCPKG_ROOT }}\installed\${{ env.OPENSSL_TRIPLE }}
key: build-openssl-win
if: steps.restore_build_openssl.outputs.cache-hit != 'true'
- name: Upload openssl artifacts
uses: actions/upload-artifact@v3
env:
OPENSSL_TRIPLE: x64-windows-static-md
with:
name: openssl-artifacts
path: ${{ env.VCPKG_ROOT }}\installed\${{ env.OPENSSL_TRIPLE }}\*
if-no-files-found: error
compile-xtask-win:
name: Compile xtask (Windows)
runs-on: windows-latest
needs: compile-openssl-win
env:
UXTASK_USE_GLOBAL_CARGO: '1'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Restore built openssl
uses: actions/download-artifact@v3
with:
path: target-openssl\openssl
name: openssl-artifacts
- name: Set up openssl env
run: echo "OPENSSL_DIR=$(Get-Location)\target-openssl\openssl" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Install rust
run: rustup toolchain install nightly --no-self-update && rustup default nightly
- name: Print environment
shell: pwsh
run: 'ls env:'
- name: Collect other system information
run: "\n git --version\n "
- name: Compile xtask
run: cargo build -p upsilon-xtask --bin upsilon-xtask --verbose
- name: Create xtask artifact dir
run: mkdir ./ci-artifacts
- name: Copy xtask to artifact
run: cp .\target\debug\upsilon-xtask.exe ./ci-artifacts/upsilon-xtask.exe
- name: Upload xtask
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-xtask
path: ./ci-artifacts/upsilon-xtask.exe
test-win:
name: Test (Windows)
runs-on: windows-latest
needs:
- compile-openssl-win
- compile-xtask-win
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Restore built openssl
uses: actions/download-artifact@v3
with:
path: target-openssl\openssl
name: openssl-artifacts
- name: Set up openssl env
run: echo "OPENSSL_DIR=$(Get-Location)\target-openssl\openssl" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Install rust
run: rustup toolchain install nightly --no-self-update && rustup default nightly
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Print environment
shell: pwsh
run: 'ls env:'
- name: Collect other system information
run: "\n git --version\n "
- name: Download xtask
uses: actions/download-artifact@v3
with:
name: ${{ runner.os }}-xtask
path: ./ci-artifacts/downloaded-xtask
- name: Move downloaded xtask to artifact path
run: mv ./ci-artifacts/downloaded-xtask/upsilon-xtask.exe ./ci-artifacts/upsilon-xtask.exe
- name: Compile binaries and tests
run: ./ci-artifacts/upsilon-xtask.exe test --verbose --no-run --profile ci --custom-bin-dir ./bin-dir
- name: Run tests
run: ./ci-artifacts/upsilon-xtask.exe test --verbose --no-fail-fast --profile ci --no-build-dev --custom-bin-dir ./bin-dir
doctest-win:
name: Doctest (Windows)
runs-on: windows-latest
needs:
- compile-openssl-win
- compile-xtask-win
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Restore built openssl
uses: actions/download-artifact@v3
with:
path: target-openssl\openssl
name: openssl-artifacts
- name: Set up openssl env
run: echo "OPENSSL_DIR=$(Get-Location)\target-openssl\openssl" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Install rust
run: rustup toolchain install nightly --no-self-update && rustup default nightly
- name: Print environment
shell: pwsh
run: 'ls env:'
- name: Collect other system information
run: "\n git --version\n "
- name: Download xtask
uses: actions/download-artifact@v3
with:
name: ${{ runner.os }}-xtask
path: ./ci-artifacts/downloaded-xtask
- name: Move downloaded xtask to artifact path
run: mv ./ci-artifacts/downloaded-xtask/upsilon-xtask.exe ./ci-artifacts/upsilon-xtask.exe
- name: Run doctests
run: ./ci-artifacts/upsilon-xtask.exe test --verbose --no-fail-fast --doc --profile ci --no-build-dev