-
Notifications
You must be signed in to change notification settings - Fork 88
355 lines (308 loc) Β· 10.3 KB
/
ci-nix.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
name: "CI"
# Limit concurrent runs of this workflow within a single PR
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
- release
- magic-nix
pull_request:
schedule:
# Everyday at 4:00 AM
- cron: "0 4 * * *"
permissions:
checks: write
pull-requests: write
jobs:
build-test:
name: "Build & test"
runs-on: ubuntu-latest
strategy:
matrix:
include:
# - package: plutus-cbor
# - package: plutus-merkle-tree
# - package: hydra-plutus
# - package: hydra-tui
- package: hydra-node
# - package: hydra-cluster
steps:
- name: π₯ Checkout repository
uses: actions/checkout@v4
# - name: β Install nix
- uses: DeterminateSystems/nix-installer-action@main
# - uses: cachix/install-nix-action@V27
with:
extra-conf: |
accept-flake-config = true
log-lines = 1000
# - name: β Setup nix cache
# - uses: DeterminateSystems/magic-nix-cache-action@main
# with:
# diagnostic-endpoint: ""
# diff-store: true
# upstream-cache: "https://cardano-scaling.cachix.org"
- uses: cachix/cachix-action@v15
with:
name: cardano-scaling
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
- run: |
cat ~/.config/nix/nix.conf
- name: β Test
if: ${{ matrix.package != 'hydra-tui' }}
run: |
cd ${{ matrix.package }}
nix build .#${{ matrix.package }}-tests
# nix develop .#${{ matrix.package }}-tests --command tests
- name: β Test (TUI)
id: test_tui
if: ${{ matrix.package == 'hydra-tui' }}
# https://giters.com/gfx/example-github-actions-with-tty
# The default shell does not allocate a TTY which breaks some tests
shell: 'script -q -e -c "bash {0}"'
env:
TERM: "xterm"
run: |
cd ${{ matrix.package }}
nix build .#${{ matrix.package }}-tests
nix develop .#${{ matrix.package }}-tests --build
- name: πΎ Upload build & test artifacts
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.package }}
path: |
./**/test-results.xml
./**/hspec-results.md
if-no-files-found: ignore
# NOTE: This depends on the path used in hydra-cluster e2e tests
- name: πΎ Upload logs
if: always()
uses: actions/upload-artifact@v4
with:
name: hydra-cluster-e2e-test-logs
path: /tmp/nix-shell.*/hydra-cluster-e2e-*/logs/*
if-no-files-found: ignore
# publish-test-results:
# name: Publish test results
# needs: [build-test]
# runs-on: ubuntu-latest
# steps:
# - name: π₯ Download test results
# uses: actions/download-artifact@v4
# with:
# pattern: test-results-*
# merge-multiple: true
# - name: β Publish test results to PR
# uses: EnricoMi/publish-unit-test-result-action@v2
# with:
# junit_files: ./**/test-results.xml
# haddock:
# name: "Build haddock using nix"
# runs-on: ubuntu-latest
# steps:
# - name: π₯ Checkout repository
# uses: actions/checkout@v4
# - name: β Prepare nix
# uses: cachix/install-nix-action@V27
# with:
# extra_nix_config: |
# accept-flake-config = true
# log-lines = 1000
# - name: β Cachix cache of nix derivations
# uses: cachix/cachix-action@v15
# with:
# name: cardano-scaling
# authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
# - name: π Documentation (Haddock)
# run: |
# nix build .#haddocks
# mkdir -p haddocks
# cp -aL result/* haddocks/
# - name: πΎ Upload haddock artifact
# uses: actions/upload-artifact@v4
# with:
# name: haddocks
# path: haddocks
# benchmarks:
# name: "Benchmarks"
# runs-on: ubuntu-latest
# strategy:
# matrix:
# include:
# - package: hydra-node
# bench: tx-cost
# options: '--output-directory $(pwd)/../benchmarks'
# - package: hydra-node
# bench: micro
# options: '-o $(pwd)/../benchmarks/ledger-bench.html'
# - package: hydra-cluster
# bench: bench-e2e
# options: 'datasets datasets/1-node.json datasets/3-nodes.json --output-directory $(pwd)/../benchmarks --timeout 1000s'
# - package: plutus-merkle-tree
# bench: on-chain-cost
# options: '$(pwd)/../benchmarks'
# steps:
# - name: π₯ Checkout repository
# uses: actions/checkout@v4
# - name: β Prepare nix
# uses: cachix/install-nix-action@V27
# with:
# extra_nix_config: |
# accept-flake-config = true
# log-lines = 1000
# - name: β Cachix cache of nix derivations
# uses: cachix/cachix-action@v15
# with:
# name: cardano-scaling
# authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
# - name: π Benchmark
# run: |
# mkdir -p benchmarks
# cd ${{ matrix.package }}
# nix build .#${{ matrix.package }}-bench
# nix develop .#${{ matrix.package }}-bench --command ${{ matrix.bench }} ${{ matrix.options }}
# - name: πΎ Upload build & test artifacts
# uses: actions/upload-artifact@v4
# with:
# name: benchmarks-${{matrix.package}}-${{matrix.bench}}
# path: benchmarks
# # NOTE: This depends on the path used in hydra-cluster bench
# - name: πΎ Upload logs
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: hydra-cluster-bench-logs
# path: /tmp/nix-shell.*/bench-*/**/*.log
# if-no-files-found: ignore
# publish-benchmark-results:
# name: Publish benchmark results
# if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
# # TODO: this is actually only requires the tx-cost benchmark results
# needs: [benchmarks]
# runs-on: ubuntu-latest
# steps:
# - name: π₯ Download generated documentation
# uses: actions/download-artifact@v4
# with:
# path: artifact
# pattern: benchmarks-*
# merge-multiple: true
# - name: β Prepare comment body
# id: comment-body
# run: |
# # Drop first 5 header lines and demote headlines one level
# cat <(cat artifact/transaction-cost.md | sed '1,5d;s/^#/##/') <(cat artifact/end-to-end-benchmarks.md | sed '1,5d;s/^#/##/') | grep -v '^:::' > comment-body.md
# - name: π Find Comment
# uses: peter-evans/find-comment@v3
# id: find-comment
# with:
# issue-number: ${{ github.event.pull_request.number }}
# comment-author: 'github-actions[bot]'
# body-includes: Transaction costs
# - name: β Create or update comment
# uses: peter-evans/create-or-update-comment@v4
# with:
# comment-id: ${{ steps.find-comment.outputs.comment-id }}
# edit-mode: replace
# issue-number: ${{ github.event.pull_request.number }}
# body-file: comment-body.md
# reactions: rocket
# nix-flake-check:
# name: "nix flake check"
# runs-on: ubuntu-latest
# steps:
# - name: π₯ Checkout repository
# uses: actions/checkout@v4
# - name: β Prepare nix
# uses: cachix/install-nix-action@V27
# with:
# extra_nix_config: |
# accept-flake-config = true
# log-lines = 1000
# - name: β Cachix cache of nix derivations
# uses: cachix/cachix-action@v15
# with:
# name: cardano-scaling
# authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
# - name: β Nix Flake Check
# run: |
# nix flake check -L
# build-specification:
# name: "Build specification using nix"
# runs-on: ubuntu-latest
# steps:
# - name: π₯ Checkout repository
# uses: actions/checkout@v4
# - name: β Prepare nix
# uses: cachix/install-nix-action@V27
# with:
# extra_nix_config: |
# accept-flake-config = true
# log-lines = 1000
# - name: β Cachix cache of nix derivations
# uses: cachix/cachix-action@v15
# with:
# name: cardano-scaling
# authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
# - name: β Build specification PDF
# run: |
# nix build .#spec && cp result/*.pdf .
# - name: πΎ Upload specification
# uses: actions/upload-artifact@v4
# with:
# name: hydra-spec
# path: |
# ./*.pdf
# documentation:
# name: Documentation
# needs: [haddock,benchmarks,build-test,build-specification]
# runs-on: ubuntu-latest
# steps:
# - name: π₯ Checkout repository
# uses: actions/checkout@v4
# with:
# # For the cardanonical json schemas
# submodules: true
# # Ensure we have all history with all commits
# fetch-depth: 0
# - name: π§ Setup Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 16
# cache: 'yarn'
# cache-dependency-path: docs/yarn.lock
# - name: β Test API reference
# working-directory: docs
# run: |
# yarn
# yarn validate
# - name: π₯ Download benchmark results
# uses: actions/download-artifact@v4
# with:
# path: docs/benchmarks
# pattern: benchmarks-*
# merge-multiple: true
# - name: π₯ Download haddock documentation
# uses: actions/download-artifact@v4
# with:
# name: haddocks
# path: docs/static/haddock
# - name: π₯ Download test results
# uses: actions/download-artifact@v4
# with:
# pattern: test-results-*
# merge-multiple: true
# path: docs/benchmarks/tests
# - name: π₯ Download specification PDF
# uses: actions/download-artifact@v4
# with:
# name: hydra-spec
# path: docs/static/
# - name: π Documentation sanity check
# working-directory: docs
# run: |
# yarn
# yarn build-dev