forked from fedimint/fedimint
-
Notifications
You must be signed in to change notification settings - Fork 0
652 lines (579 loc) · 24.9 KB
/
ci-nix.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
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
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
# This is a basic workflow to help you get started with Actions
name: "CI (nix)"
env:
PERFIT_SERVER: https://perfit.dev.fedimint.org
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch and release tags
push:
branches: [ "main", "master", "devel", "releases/v*" ]
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches: [ "main", "master", "devel", "releases/v*" ]
merge_group:
branches: [ "main", "master", "devel", "releases/v*" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
self-care:
name: Flake self-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check Nix flake inputs
if: github.event_name == 'pull_request' && github.base_ref == 'master'
uses: DeterminateSystems/flake-checker-action@v9
with:
fail-mode: true
nixpkgs-keys: nixpkgs
lint:
name: "Lint"
runs-on: [self-hosted, linux]
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-23.11
extra_nix_config: |
connect-timeout = 15
stalled-download-timeout = 15
- uses: cachix/cachix-action@v15
with:
name: fedimint
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
continue-on-error: true
# run the same check that git `pre-commit` hook would, just in case
- name: Commit check
run: nix develop --ignore-environment .#lint --command ./misc/git-hooks/pre-commit
- name: Check udeps
run: nix build -L .#nightly.test.workspaceCargoUdeps
- name: Check `nix flake show`
run: nix flake show .#
shell:
if: github.repository == 'fedimint/fedimint'
strategy:
matrix:
host:
- linux
- macos
include:
- host: linux
runs-on: [self-hosted, linux]
build-in-pr: false
timeout: 30
- host: macos
runs-on: macos-14
build-in-pr: false
timeout: 30
name: "Dev Shell on ${{ matrix.host }}"
runs-on: ${{ matrix.runs-on }}
timeout-minutes: ${{ matrix.timeout }}
steps:
- uses: actions/checkout@v4
if: github.event_name != 'pull_request' || matrix.build-in-pr
- uses: cachix/install-nix-action@v30
if: github.event_name != 'pull_request' || matrix.build-in-pr
with:
nix_path: nixpkgs=channel:nixos-23.11
extra_nix_config: |
connect-timeout = 15
stalled-download-timeout = 15
- uses: cachix/cachix-action@v15
if: github.event_name != 'pull_request' || matrix.build-in-pr
with:
name: fedimint
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
continue-on-error: true
- name: Build dev shell
if: github.event_name != 'pull_request' || matrix.build-in-pr
run: nix develop -L -c true
build:
if: github.repository == 'fedimint/fedimint'
strategy:
matrix:
host:
- linux
- macos
include:
- host: linux
runs-on: [self-hosted, linux]
build-in-pr: true
timeout: 90
run-tests: true
- host: macos
runs-on: macos-14
build-in-pr: false
# TODO: Too slow; see https://github.com/actions/runner-images/issues/1336
timeout: 75
run-tests: false
name: "Build on ${{ matrix.host }}"
runs-on: ${{ matrix.runs-on }}
timeout-minutes: ${{ matrix.timeout }}
steps:
- uses: actions/checkout@v4
if: github.event_name != 'pull_request' || matrix.build-in-pr
- name: Prepare
if: github.event_name != 'pull_request' || matrix.build-in-pr
uses: ./.github/actions/prepare
- uses: cachix/install-nix-action@v30
if: github.event_name != 'pull_request' || matrix.build-in-pr
with:
nix_path: nixpkgs=channel:nixos-23.11
extra_nix_config: |
connect-timeout = 15
stalled-download-timeout = 15
- uses: cachix/cachix-action@v15
if: github.event_name != 'pull_request' || matrix.build-in-pr
with:
name: fedimint
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
continue-on-error: true
- name: Build workspace
if: github.event_name != 'pull_request' || matrix.build-in-pr
run: |
env \
PERFIT_ACCESS_TOKEN="${{ secrets.PERFIT_ACCESS_TOKEN }}" \
nix run 'github:rustshop/perfit?rev=a2ea3bae86b0e70d2ebdbca1fd16a843b7f0a3bd#perfit' -- \
run \
--metric Ym4MS7aDRj6b64woEHq4bw \
--metadata "commit=${LAST_COMMIT_SHA}" \
-- \
nix build -L .#ci.workspaceBuild
- name: Clippy workspace
if: github.event_name != 'pull_request' || matrix.build-in-pr
run: nix build -L .#ci.workspaceClippy
- name: Run cargo doc
if: (github.event_name != 'pull_request' || matrix.build-in-pr) && (matrix.host != 'macos')
run: nix build -L .#ci.workspaceDoc
- name: Test docs
if: (github.event_name != 'pull_request' || matrix.build-in-pr) && (matrix.host != 'macos')
run: nix build -L .#ci.workspaceTestDoc
- name: Tests
if: (github.event_name != 'pull_request' || matrix.build-in-pr) && matrix.run-tests
run: |
env \
PERFIT_ACCESS_TOKEN="${{ secrets.PERFIT_ACCESS_TOKEN }}" \
nix run 'github:rustshop/perfit?rev=a2ea3bae86b0e70d2ebdbca1fd16a843b7f0a3bd#perfit' -- \
run \
--metric HEnBvtqET8iKgJOMMkFoXw \
--metadata "commit=${LAST_COMMIT_SHA}" \
-- \
nix build -L .#wasm32-unknown.ci.ciTestAll
- name: Tests (5 times more)
if: github.event_name == 'merge_group' && matrix.run-tests
run: |
env \
PERFIT_ACCESS_TOKEN="${{ secrets.PERFIT_ACCESS_TOKEN }}" \
nix run 'github:rustshop/perfit?rev=a2ea3bae86b0e70d2ebdbca1fd16a843b7f0a3bd#perfit' -- \
run \
--metric _fJdigFYTj6zSGjwx3-WUg \
--metadata "commit=${LAST_COMMIT_SHA}" \
-- \
nix build -L .#wasm32-unknown.ci.ciTestAll5Times
- name: Wasm Tests
if: (github.event_name != 'pull_request' || matrix.build-in-pr) && matrix.run-tests && (matrix.host != 'macos')
run: |
env \
PERFIT_ACCESS_TOKEN="${{ secrets.PERFIT_ACCESS_TOKEN }}" \
nix run 'github:rustshop/perfit?rev=a2ea3bae86b0e70d2ebdbca1fd16a843b7f0a3bd#perfit' -- \
run \
--metric 4DtvtPWIQWe--cY6K-wSCg \
--metadata "commit=${LAST_COMMIT_SHA}" \
-- \
nix build -L .#wasm32-unknown.ci.wasmTest
audit:
if: github.repository == 'fedimint/fedimint'
name: "Audit"
runs-on: [self-hosted, linux]
timeout-minutes: 10
# sometimes we can't fix these immediately, yet
# we don't want to stop the world because of it
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-23.11
extra_nix_config: |
connect-timeout = 15
stalled-download-timeout = 15
- uses: cachix/cachix-action@v15
with:
name: fedimint
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
continue-on-error: true
- name: Run cargo audit
run: |
nix flake update advisory-db || nix flake lock --update-input advisory-db
nix build -L .#ci.cargoAudit
- name: Run cargo deny
run: |
nix build -L .#ci.cargoDeny
# Code Coverage will build using a completely different profile (neither debug/release)
# Which means we can not reuse much from `build` job. Might as well run it as another
# build in parallel
ccov:
if: github.repository == 'fedimint/fedimint'
name: "Code coverage"
runs-on: [self-hosted, linux]
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- name: Prepare
uses: ./.github/actions/prepare
- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-23.11
extra_nix_config: |
connect-timeout = 15
stalled-download-timeout = 15
- uses: cachix/cachix-action@v15
with:
name: fedimint
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
continue-on-error: true
- name: Validate codecov.yaml configuration
run: nix run nixpkgs#curl -- --fail-with-body -X POST --data-binary @.codecov.yml https://codecov.io/validate
- name: Build and run tests with Code Coverage
run: |
env \
PERFIT_ACCESS_TOKEN="${{ secrets.PERFIT_ACCESS_TOKEN }}" \
nix run 'github:rustshop/perfit?rev=a2ea3bae86b0e70d2ebdbca1fd16a843b7f0a3bd#perfit' -- \
run \
--metric pq4AyxybSD--isFtVmPGpg \
--metadata "commit=${LAST_COMMIT_SHA}" \
-- \
nix build -L .#ci.workspaceTestCov
- name: Ensure lcov.info exists
run: test -f result/lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: result/lcov.info
- name: Build and run tests with Code Coverage (5 times more)
if: github.event_name == 'merge_group'
run: nix build -L .#ci.workspaceTest5TimesCov
cross:
name: "Cross-compile on ${{ matrix.host }} to ${{ matrix.toolchain }}"
needs: [lint, shell]
strategy:
matrix:
host:
- linux
- macos
toolchain:
- aarch64-android
- armv7-android
- x86_64-android
- wasm32-unknown
include:
- host: linux
runs-on: [self-hosted, linux]
build-in-pr: true
# TODO: debugging network issues, should reduce to 20 minutes
# https://github.com/fedimint/fedimint/issues/4488
timeout: 60
- host: macos
runs-on: macos-14
build-in-pr: false
# TODO: Too slow; see https://github.com/actions/runner-images/issues/1336
timeout: 120
exclude:
# there's not enough macos runners available for our CI, so test only the more important cross-compilation toolchains
# if they work, rest probably works as well
- host: macos
toolchain: armv7-android
- host: macos
toolchain: x86_64-android
runs-on: ${{ matrix.runs-on }}
timeout-minutes: ${{ matrix.timeout }}
steps:
- uses: actions/checkout@v4
if: github.event_name != 'pull_request' || matrix.build-in-pr
- uses: cachix/install-nix-action@v30
if: github.event_name != 'pull_request' || matrix.build-in-pr
with:
nix_path: nixpkgs=channel:nixos-23.11
extra_nix_config: |
connect-timeout = 15
stalled-download-timeout = 15
- uses: cachix/cachix-action@v15
if: github.event_name != 'pull_request' || matrix.build-in-pr
with:
name: fedimint
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
continue-on-error: true
- name: Build client packages for ${{ matrix.toolchain }}
if: github.event_name != 'pull_request' || matrix.build-in-pr
run: |
nix build -L .#${{ matrix.toolchain }}.ci.client-pkgs
- name: Build fedimint-client-wasm package for ${{ matrix.toolchain }}
if: (github.event_name != 'pull_request' || matrix.build-in-pr) && (matrix.toolchain == 'wasm32-unknown')
run: |
nix build -L .#${{ matrix.toolchain }}.ci.fedimint-client-wasm
containers:
if: github.repository == 'fedimint/fedimint'
name: "Containers"
runs-on: [self-hosted, linux]
timeout-minutes: 60
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Prepare
uses: ./.github/actions/prepare
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-23.11
extra_nix_config: |
connect-timeout = 15
stalled-download-timeout = 15
- uses: cachix/cachix-action@v15
with:
name: fedimint
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
continue-on-error: true
- name: Build fedimintd container
run: |
if [ "$GITHUB_EVENT_NAME" == "pull_request" ] || [ "$GITHUB_EVENT_NAME" == "merge_group" ]; then
nix build -L .#ci.container.fedimintd
else
nix build -L .#container.fedimintd
fi
echo "fedimintd_container_tag=$(docker load < result | awk '{ print $3 }')" >> $GITHUB_ENV
- name: Build fedimint-cli container
run: |
if [ "$GITHUB_EVENT_NAME" == "pull_request" ] || [ "$GITHUB_EVENT_NAME" == "merge_group" ]; then
nix build -L .#ci.container.fedimint-cli
else
nix build -L .#container.fedimint-cli
fi
echo "fedimint_cli_container_tag=$(docker load < result | awk '{ print $3 }')" >> $GITHUB_ENV
- name: Build gatewayd container
run: |
if [ "$GITHUB_EVENT_NAME" == "pull_request" ] || [ "$GITHUB_EVENT_NAME" == "merge_group" ]; then
nix build -L .#ci.container.gatewayd
else
nix build -L .#container.gatewayd
fi
echo "gatewayd_container_tag=$(docker load < result | awk '{ print $3 }')" >> $GITHUB_ENV
- name: Build cln-light-gateway container
run: |
if [ "$GITHUB_EVENT_NAME" == "pull_request" ] || [ "$GITHUB_EVENT_NAME" == "merge_group" ]; then
nix build -L .#ci.container.cln-light-gateway
else
nix build -L .#container.cln-light-gateway
fi
echo "cln_light_gateway_container_tag=$(docker load < result | awk '{ print $3 }')" >> $GITHUB_ENV
- name: Build gateway-cli container
run: |
if [ "$GITHUB_EVENT_NAME" == "pull_request" ] || [ "$GITHUB_EVENT_NAME" == "merge_group" ]; then
nix build -L .#ci.container.gateway-cli
else
nix build -L .#container.gateway-cli
fi
echo "gateway-cli_container_tag=$(docker load < result | awk '{ print $3 }')" >> $GITHUB_ENV
- name: Build devtools container
run: |
if [ "$GITHUB_EVENT_NAME" == "pull_request" ] || [ "$GITHUB_EVENT_NAME" == "merge_group" ]; then
nix build -L .#ci.container.devtools
else
nix build -L .#container.devtools
fi
echo "devtools_container_tag=$(docker load < result | awk '{ print $3 }')" >> $GITHUB_ENV
- name: Login to Docker Hub
if: github.ref == 'refs/heads/master' || github.ref_type == 'tag'
uses: docker/login-action@v3
with:
username: fedimint
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Publish
if: github.ref == 'refs/heads/master'
run: |
nix_tag=${{ env.fedimintd_container_tag }} && hub_tag="fedimint/fedimintd:${LAST_COMMIT_SHA}" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
nix_tag=${{ env.fedimint_cli_container_tag }} && hub_tag="fedimint/fedimint-cli:${LAST_COMMIT_SHA}" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
nix_tag=${{ env.gatewayd_container_tag }} && hub_tag="fedimint/gatewayd:${LAST_COMMIT_SHA}" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
nix_tag=${{ env.cln_light_gateway_container_tag }} && hub_tag="fedimint/cln-light-gateway:${LAST_COMMIT_SHA}" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
nix_tag=${{ env.gateway-cli_container_tag }} && hub_tag="fedimint/gateway-cli:${LAST_COMMIT_SHA}" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
nix_tag=${{ env.devtools_container_tag }} && hub_tag="fedimint/devtools:${LAST_COMMIT_SHA}" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
- name: Publish master tag
if: github.ref == 'refs/heads/master'
run: |
nix_tag=${{ env.fedimintd_container_tag }} && hub_tag="fedimint/fedimintd:master" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
nix_tag=${{ env.fedimint_cli_container_tag }} && hub_tag="fedimint/fedimint-cli:master" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
nix_tag=${{ env.gatewayd_container_tag }} && hub_tag="fedimint/gatewayd:master" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
nix_tag=${{ env.cln_light_gateway_container_tag }} && hub_tag="fedimint/cln-light-gateway:master" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
nix_tag=${{ env.gateway-cli_container_tag }} && hub_tag="fedimint/gateway-cli:master" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
nix_tag=${{ env.devtools_container_tag }} && hub_tag="fedimint/devtools:master" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
- name: Publish tagged release
if: github.ref_type == 'tag'
run: |
nix_tag=${{ env.fedimintd_container_tag }} && hub_tag="fedimint/fedimintd:${GITHUB_REF_NAME}" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
nix_tag=${{ env.fedimint_cli_container_tag }} && hub_tag="fedimint/fedimint-cli:${GITHUB_REF_NAME}" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
nix_tag=${{ env.gatewayd_container_tag }} && hub_tag="fedimint/gatewayd:${GITHUB_REF_NAME}" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
nix_tag=${{ env.cln_light_gateway_container_tag }} && hub_tag="fedimint/cln-light-gateway:${GITHUB_REF_NAME}" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
nix_tag=${{ env.gateway-cli_container_tag }} && hub_tag="fedimint/gateway-cli:${GITHUB_REF_NAME}" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
nix_tag=${{ env.devtools_container_tag }} && hub_tag="fedimint/devtools:${GITHUB_REF_NAME}" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"
pkgs:
if: github.repository == 'fedimint/fedimint' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/releases') || github.ref_type == 'tag')
name: "Release packages: ${{ matrix.build.flake-output }}"
strategy:
matrix:
build:
- flake-output: fedimint-pkgs
bins: fedimintd,fedimint-cli,fedimint-dbtool,fedimint-recoverytool
deb: fedimint
- flake-output: gateway-pkgs
bins: gateway-cli,gatewayd,gateway-cln-extension
deb: fedimint-gateway
- flake-output: devimint
bins: devimint,devimint-faucet
deb: devimint
runs-on: [self-hosted, linux]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-23.11
extra_nix_config: |
connect-timeout = 15
stalled-download-timeout = 15
- uses: cachix/cachix-action@v15
with:
name: fedimint
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
continue-on-error: true
- name: Set BUILD_ID to tag or commit hash
run: |
if [[ $GITHUB_REF_TYPE == "tag" ]]; then
echo "BUILD_ID=${GITHUB_REF_NAME}" >> $GITHUB_ENV
else
echo "BUILD_ID=${GITHUB_SHA}" >> $GITHUB_ENV
fi
- name: Build ${{ matrix.build.flake-output }}
env:
# seems like cachix needs this explicitly set in the env
CACHIX_AUTH_TOKEN: '${{ secrets.CACHIX_AUTH_TOKEN }}'
run: |
>&2 echo "Building: ${{ matrix.build.flake-output }}"
nix build -L .#${{ matrix.build.flake-output }}
mkdir -p bins
bins="${{ matrix.build.bins }}"
for bin in ${bins//,/ } ; do
if [[ $GITHUB_REF_TYPE == "tag" ]]; then
>&2 echo "Building: $bin"
nix build -L .#$bin
>&2 echo "Pushing to cachix: $bin"
cachix push fedimint -c 8 -j 8 $(nix-store --query --references $(readlink -f result)) $(readlink -f result)
>&2 echo "Pining in cachix: fedimint-release-$bin:$BUILD_ID"
cachix pin fedimint "fedimint-release-$bin:$BUILD_ID" $(readlink -f result)
fi
# Note: keep in sync with sign.sh
>&2 echo "Building bundled: $bin"
nix bundle --bundler .# ".#$bin" -o "bins/$bin-$BUILD_ID" && sha256sum "bins/$bin-$BUILD_ID"
done
- name: Check version ${{ matrix.build.bins }}
run: |
bins="${{ matrix.build.bins }}"
for bin in ${bins//,/ } ; do
>&2 echo "Checking version: $bin"
nix run .#$bin version-hash && echo "$GITHUB_SHA" && test "$(nix run .#$bin version-hash)" = "${GITHUB_SHA}"
done
- name: Check sha256sum ${{ matrix.build.bins }}
run: |
bins="${{ matrix.build.bins }}"
for bin in ${bins//,/ } ; do
>&2 echo "Checking sha256sum: $bin"
nix build -L .#$bin && sha256sum "./result/bin/$bin"
done
- name: Upload Binaries
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.build.flake-output}}-linux-x86_64"
path: "bins/**"
- name: Release Binaries
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: "bins/**"
prerelease: ${{ contains(github.ref, 'rc') }}
- name: Build DEB package
run: |
bins="${{ matrix.build.bins }}"
for bin in ${bins//,/ } ; do
>&2 echo "Bundling DEB: $bin"
nix bundle -L --bundler .#toDEB --accept-flake-config -o debs/$bin .#$bin
# workaround: https://github.com/actions/upload-artifact/issues/92
cp -a debs/$bin/*.deb debs/
done
- name: Build RPM package
run: |
bins="${{ matrix.build.bins }}"
for bin in ${bins//,/ } ; do
>&2 echo "Bundling RPM: $bin"
nix bundle -L --bundler .#toRPM --accept-flake-config -o rpms/$bin .#$bin
# workaround: https://github.com/actions/upload-artifact/issues/92
cp -a rpms/$bin/*.rpm rpms/
done
- name: Upload DEB packages
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.build.flake-output }}-deb-bundle"
path: "debs/**.deb"
- name: Release DEB packages
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: "debs/**.deb"
prerelease: ${{ contains(github.ref, 'rc') }}
- name: Upload RPM packages
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.build.flake-output }}-rpm-bundle"
path: "rpms/**.rpm"
- name: Release RPM packages
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: "rpms/**.rpm"
prerelease: ${{ contains(github.ref, 'rc') }}
status:
name: Status
needs: [lint, shell, build, cross, ccov, containers, pkgs]
if: ${{ always() }}
runs-on: [self-hosted, linux]
steps:
- name: Check status of all jobs
if: >-
${{
contains(needs.*.result, 'failure') ||
contains(needs.*.result, 'cancelled')
}}
run: exit 1
notifications:
if: always() && github.repository == 'fedimint/fedimint' && github.event_name != 'merge_group'
name: "Notifications"
timeout-minutes: 1
runs-on: [self-hosted, linux]
# note: we don't depend on `audit` because it will
# be often broken, and we can't fix it immediately
needs: [ lint, build, shell, cross, ccov, containers, pkgs ]
steps:
- name: Discord notifications on failure
# https://stackoverflow.com/a/74562058/134409
if: ${{ always() && contains(needs.*.result, 'failure') }}
# https://github.com/marketplace/actions/actions-status-discord
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
# current job is a success, but that's not what we're interested in
status: failure