-
Notifications
You must be signed in to change notification settings - Fork 74
463 lines (442 loc) · 16.8 KB
/
Copy pathpr-workflow.yml
File metadata and controls
463 lines (442 loc) · 16.8 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
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
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
name: "pr-workflow"
concurrency:
group: ${{ github.workflow }}-pr-workflow-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
workflow_call:
inputs:
github_event_name:
required: true
type: string
github_event_pull_request_head_repo_id:
required: true
type: number
github_workflow:
required: true
type: string
github_event_pull_request_head_sha:
required: true
type: string
flow:
required: true
type: string
sha_to_check:
required: true
type: string
secrets:
NIXBUILD_TOKEN:
required: true
CACHIX_AUTH_TOKEN:
required: true
DOCKER_HUB_USERNAME:
required: true
DOCKER_HUB_ACCESS_TOKEN:
required: true
PABLO_PROJ_JSON:
required: true
VERCEL_TOKEN:
required: true
CANCEL_GITHUB_TOKEN:
required: true
permissions:
pull-requests: write
jobs:
dependency-review:
outputs:
ok: ${{ steps.ok.outputs.ok }}
concurrency:
group: ${{ inputs.github_workflow }}-dependency-review-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
needs:
- privilege-check
runs-on:
- ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
if: ${{ inputs.github_event_name != 'merge_group' && inputs.github_event_name != 'push' }}
- uses: amannn/action-semantic-pull-request@v5
if: ${{ inputs.github_event_name != 'merge_group' && inputs.github_event_name != 'push' }}
with:
requireScope: false
subjectPattern: (.*[a-zA-Z].*){16,}
subjectPatternError: |
https://regexper.com/#%28.*%5Ba-zA-Z%5D.*%29%7B16%2C%7D
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: dependency-review
if: ${{ inputs.github_event_name != 'merge_group' && inputs.github_event_name != 'push' }}
uses: actions/dependency-review-action@v3
with:
# GHSA-pfrx-2q88-qq97, GHSA-w5p7-h5w8-2hfq, GHSA-wcg3-cvx6-7396 are ignored because they are casued by the static Docusaurus build. Please remove when Docusaurus gets updated.
# GHSA-969w-q74q-9j8v, GHSA-44mr-8vmm-wjhg, GHSA-wh6w-3828-g9qf are ignored because they are transitive dependencies still used by the master branch of Substrate. Please remove when Substrate update the according dependencies.
# GHSA-fjx5-qpf4-xjf2 is ignored because it is a transitive dependencies still used by the master branch of ibc-proto-rs. Please remove when ibc-rs-proto updates it.
allow-ghsas: GHSA-pfrx-2q88-qq97, GHSA-w5p7-h5w8-2hfq, GHSA-wcg3-cvx6-7396, GHSA-969w-q74q-9j8v, GHSA-44mr-8vmm-wjhg, GHSA-wh6w-3828-g9qf, GHSA-ff4p-7xrq-q5r8, GHSA-xm67-587q-r2vw, GHSA-fjx5-qpf4-xjf2
- id: ok
run: echo "ok=true" >> "$GITHUB_OUTPUT"
privilege-check:
name: "privilege-check"
if: ${{ inputs.flow == 'push' || inputs.github_event_name == 'merge_group' || (inputs.github_event_name == 'pull_request_target' && inputs.github_event_pull_request_head_repo_id != 383289760) || (inputs.github_event_name == 'pull_request' && inputs.github_event_pull_request_head_repo_id == 383289760) }}
continue-on-error: false
runs-on: ubuntu-latest
steps:
- run: |
echo "${{ inputs.github_event_name }}""
echo "${{ inputs.flow }}""
echo "${{ github.ref_name }}"
echo "${{ inputs.github_event_pull_request_head_repo_id }}"
lfs-check:
name: lfs-check
needs:
- privilege-check
continue-on-error: false
runs-on: ubuntu-latest
concurrency:
group: ${{ inputs.github_workflow }}-lfs-check-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.github_event_pull_request_head_sha || github.sha }}
persist-credentials: false
submodules: false
lfs: true
- uses: actionsdesk/lfs-warning@v3.2
name: lfs-warning
with:
labelName: lfs-detected!
filesizelimit: 20KB
exclusionPatterns: |
**/*.rs
**/*.ts
**/*.md
**/*.json
**/*.lock
**/*.nix
**/*.sol
**/*.toml
flake/eth-pos-devnet
- run: echo ${{ steps.lfs-warning.outputs.lfsFiles }}
nix-flake-check:
name: "nix-flake-check"
outputs:
ok: ${{ steps.ok.outputs.ok }}
needs:
- privilege-check
runs-on:
- ubuntu-latest-m
continue-on-error: false
concurrency:
group: ${{ inputs.github_workflow }}-nix-flake-check-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
with:
lfs: true
ref: ${{ inputs.github_event_pull_request_head_sha || github.sha }}
persist-credentials: false
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: cachix/cachix-action@master
with:
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
name: composable
skipAddingSubstituter: false
skipPush: false
- run: |
nix --version
nix show-config
nix run .#nix-flake-check --accept-flake-config
- id: ok
run: echo "ok=true" >> "$GITHUB_OUTPUT"
# build-all-outputs-packages-arm:
# outputs:
# ok: ${{ steps.ok.outputs.ok }}
# name: build-all-outputs-packages-arm
# needs:
# - privilege-check
# runs-on:
# - aarch64-linux-80C-128GB-2048GB
# concurrency:
# group: ${{ inputs.github_workflow }}-build-all-outputs-packages-arm-${{ github.event.pull_request.number || github.ref }}
# cancel-in-progress: true
# steps:
# - name: Set up Cachix
# if: ${{ inputs.flow == 'push' }}
# uses: cachix/cachix-action@586bf280495080c5a6d4868237ad28a860e4b309
# with:
# authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
# name: composable
# installCommand: "true"
# - uses: actions/checkout@v3
# if: ${{ inputs.flow == 'push' }}
# with:
# lfs: true
# ref: ${{ inputs.github_event_pull_request_head_sha || github.sha }}
# persist-credentials: false
# - name: Build all packages
# if: ${{ inputs.flow == 'push' }}
# uses: "./.github/templates/watch-exec"
# with:
# command: nix -- build .#all-outputs
# - id: ok
# run: echo "ok=true" >> "$GITHUB_OUTPUT"
build-all-outputs-packages:
outputs:
ok: ${{ steps.ok.outputs.ok }}
name: build-all-outputs-packages
needs:
- privilege-check
- build-all-deps-packages
runs-on:
- x86_64-linux-32C-128GB-2TB
concurrency:
group: ${{ inputs.github_workflow }}-build-all-outputs-packages-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
steps:
- name: Set up Cachix
if: ${{ inputs.flow == 'push' || inputs.flow == 'pr_from_branch' }}
uses: cachix/cachix-action@586bf280495080c5a6d4868237ad28a860e4b309
with:
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
name: composable
installCommand: "true"
- uses: actions/checkout@v3
if: ${{ inputs.flow == 'push' || inputs.flow == 'pr_from_branch' }}
with:
lfs: true
ref: ${{ inputs.github_event_pull_request_head_sha || github.sha }}
persist-credentials: false
- name: Build all packages
if: ${{ inputs.flow == 'push' || inputs.flow == 'pr_from_branch' }}
uses: "./.github/templates/watch-exec"
with:
command: nix -- build .#all-outputs
- id: ok
run: echo "ok=true" >> "$GITHUB_OUTPUT"
build-all-checks-packages:
outputs:
ok: ${{ steps.ok.outputs.ok }}
name: build-all-checks-packages
needs:
- privilege-check
- build-all-outputs-packages
runs-on:
- x86_64-linux-32C-128GB-2TB
concurrency:
group: ${{ inputs.github_workflow }}-build-all-checks-packages-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
steps:
- name: Set up Cachix
if: ${{ inputs.flow == 'push' || inputs.flow == 'pr_from_branch' }}
uses: cachix/cachix-action@586bf280495080c5a6d4868237ad28a860e4b309
with:
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
name: composable
installCommand: "true"
- uses: actions/checkout@v3
if: ${{ inputs.flow == 'push' || inputs.flow == 'pr_from_branch' }}
with:
lfs: true
ref: ${{ inputs.github_event_pull_request_head_sha || github.sha }}
persist-credentials: false
- name: Build all packages
if: ${{ inputs.flow == 'push' || inputs.flow == 'pr_from_branch' }}
uses: "./.github/templates/watch-exec"
with:
command: nix -- build .#all-checks
- id: ok
run: echo "ok=true" >> "$GITHUB_OUTPUT"
build-all-deps-packages:
name: build-all-deps-packages
outputs:
ok: ${{ steps.ok.outputs.ok }}
needs:
- privilege-check
runs-on:
- x86_64-linux-32C-128GB-2TB
concurrency:
group: ${{ inputs.github_workflow }}-build-all-deps-packages-${{ matrix.runner }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
steps:
- name: Set up Cachix
if: ${{ inputs.flow == 'push' || inputs.flow == 'pr_from_branch' || inputs.flow == 'pr_from_fork' }}
uses: cachix/cachix-action@586bf280495080c5a6d4868237ad28a860e4b309
with:
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
name: composable
installCommand: "true"
- uses: actions/checkout@v3
if: ${{ inputs.flow == 'push' || inputs.flow == 'pr_from_branch' || inputs.flow == 'pr_from_fork' }}
with:
lfs: true
ref: ${{ inputs.github_event_pull_request_head_sha || github.sha }}
persist-credentials: false
- name: build-all-deps-packages
if: ${{ inputs.flow == 'push' || inputs.flow == 'pr_from_branch' || inputs.flow == 'pr_from_fork' }}
uses: "./.github/templates/watch-exec"
with:
command: nix -- build .#all-deps
- id: ok
run: echo "ok=true" >> "$GITHUB_OUTPUT"
draft-release-check:
name: "draft-release-check"
if: ${{ failure() || cancelled() || success() }}
continue-on-error: false
runs-on: ubuntu-latest
needs:
- build-all-checks-packages
- dependency-review
- nix-flake-check
- mantis-e2e
steps:
- run: |
echo "nix-flake-check" ${{ needs.nix-flake-check.outputs.ok }}
echo "dependency-review" ${{ needs.dependency-review.outputs.ok }}
echo "build-all-checks-packages" ${{ needs.build-all-checks-packages.outputs.ok }}
echo "mantis-e2e" ${{ needs.mantis-e2e.outputs.ok }}
- if: ${{ needs.nix-flake-check.outputs.ok == 'true' && needs.dependency-review.outputs.ok == 'true' && needs.build-all-checks-packages.outputs.ok == 'true' && needs.mantis-e2e.outputs.ok == 'true' }}
run: |
echo "All dependencies built well"
exit 0
- if: ${{ !(needs.nix-flake-check.outputs.ok == 'true' && needs.dependency-review.outputs.ok == 'true' && needs.build-all-checks-packages.outputs.ok == 'true' && needs.mantis-e2e.outputs.ok == 'true' ) }}
run: |
echo "Some of dependencies (see jobs graph, needs attributes, and output of this job) failed"
exit 42
draft-release-artifacts:
name: "draft-release-artifacts"
runs-on:
- x86_64-linux-32C-128GB-2TB
needs:
- draft-release-check
if: ${{ inputs.github_event_name == 'push' }}
permissions:
pull-requests: write
contents: write
concurrency:
group: ${{ inputs.github_workflow }}-draft-release-artifacts-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Set up Cachix
uses: cachix/cachix-action@586bf280495080c5a6d4868237ad28a860e4b309
with:
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
name: composable
installCommand: "true"
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Download artifacts
run: |
nix run .#generate-release-artifacts --print-build-logs
- name: Release artifacts
uses: softprops/action-gh-release@v1
with:
draft: true
prerelease: false
fail_on_unmatched_files: true
generate_release_notes: true
body_path: release-artifacts/release.txt
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
target_commitish: ${{ github.sha }}
files: |
release-artifacts/to-upload/*
push-docker-images:
name: push-docker-images
if: ${{ inputs.flow == 'push' }}
needs:
- draft-release-check
runs-on:
- x86_64-linux-32C-128GB-2TB
concurrency:
group: ${{inputs.flow}}-${{ inputs.github_workflow }}-push-docker-images-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: false
steps:
- name: Set up Cachix
uses: cachix/cachix-action@586bf280495080c5a6d4868237ad28a860e4b309
with:
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
name: composable
installCommand: "true"
- uses: actions/checkout@v3
with:
lfs: true
ref: ${{ inputs.github_event_pull_request_head_sha || github.sha }}
persist-credentials: false
- name: Build all packages
uses: "./.github/templates/watch-exec"
with:
command: nix -- build .#all
- name: Publish cmc-api to docker hub
uses: "./.github/templates/docker-publish"
with:
image_path: result/docker-image-cmc-api.tar.gz
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
name: cmc-api
artifact: cmc-api:latest
- name: Publish devnet-xc to docker hub
uses: "./.github/templates/docker-publish"
with:
image_path: result/docker-image-devnet-xc.tar.gz
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
name: devnet-xc
artifact: devnet-xc:latest
tag: ${{ inputs.github_event_name == 'push' && 'main' || ''}}
- name: Publish hyperspace-composable-rococo-picasso-rococo to docker hub
uses: "./.github/templates/docker-publish"
with:
image_path: result/hyperspace-composable-rococo-picasso-rococo.tar.gz
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
name: hyperspace-composable-rococo-picasso-rococo
artifact: hyperspace-composable-rococo-picasso-rococo:latest
- name: Publish hyperspace-composable-polkadot-picasso-kusama to docker hub
uses: "./.github/templates/docker-publish"
with:
image_path: result/hyperspace-composable-polkadot-picasso-kusama.tar.gz
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
name: hyperspace-composable-polkadot-picasso-kusama
artifact: hyperspace-composable-polkadot-picasso-kusama:latest
mantis-e2e:
name: mantis-e2e
outputs:
ok: ${{ steps.ok.outputs.ok }}
needs:
- build-all-checks-packages
runs-on:
- ubuntu-latest-m
concurrency:
group: ${{ inputs.github_workflow }}-mantis-e2e-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
with:
lfs: true
ref: ${{ inputs.github_event_pull_request_head_sha || github.sha }}
persist-credentials: false
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: cachix/cachix-action@master
with:
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
name: composable
skipAddingSubstituter: false
skipPush: false
- name: Devnet integration tests
run: |
nix run .#mantis-e2e --accept-flake-config --impure
- id: ok
run: echo "ok=true" >> "$GITHUB_OUTPUT"