Skip to content

Commit 5560b9e

Browse files
authored
Add package output for docs (#2209)
This might work. The benchmarks are not part of the derivation. This could be done in a follow-up. Also separated some jobs into additional files because yaml files fail silently when incorrect and becomes hard to debug.
2 parents 182e6cb + f2a0912 commit 5560b9e

File tree

6 files changed

+151
-206
lines changed

6 files changed

+151
-206
lines changed

.github/workflows/ci-nix.yaml

Lines changed: 0 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,6 @@ jobs:
8787
- name: 📚 Documentation (Haddock)
8888
run: |
8989
nix build .#haddocks
90-
mkdir -p haddocks
91-
cp -aL result/* haddocks/
92-
93-
- name: 💾 Upload haddock artifact
94-
uses: actions/upload-artifact@v4
95-
with:
96-
name: haddocks
97-
path: haddocks
9890
9991
benchmarks:
10092
name: "Benchmarks"
@@ -178,153 +170,3 @@ jobs:
178170
issue-number: ${{ github.event.pull_request.number }}
179171
body-file: comment-body.md
180172
reactions: rocket
181-
182-
nix-flake-check:
183-
name: "nix flake check"
184-
runs-on: ${{ matrix.os }}
185-
strategy:
186-
matrix:
187-
os: [ubuntu-latest, macos-latest]
188-
steps:
189-
- name: Reclaim the bytes
190-
uses: data-intuitive/reclaim-the-bytes@v2
191-
with:
192-
# NOTE: Remove more when needed, but these take also time
193-
# See https://github.com/marketplace/actions/reclaim-the-bytes
194-
remove-android-sdk: false
195-
remove-docker-images: false
196-
197-
- name: 📥 Checkout repository
198-
uses: actions/checkout@v4
199-
200-
- name: ❄ Setup Nix/Cachix
201-
uses: ./.github/actions/nix-cachix-setup
202-
with:
203-
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
204-
205-
- name: ❄ Nix Flake Check
206-
run: |
207-
nix flake check -L
208-
209-
210-
build-specification:
211-
name: "Build specification using nix"
212-
runs-on: ubuntu-latest
213-
steps:
214-
- name: 📥 Checkout repository
215-
uses: actions/checkout@v4
216-
217-
- name: ❄ Setup Nix/Cachix
218-
uses: ./.github/actions/nix-cachix-setup
219-
with:
220-
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
221-
222-
- name: ❄ Build specification PDF
223-
run: |
224-
nix build .#spec && cp result/*.pdf .
225-
226-
- name: 💾 Upload specification
227-
uses: actions/upload-artifact@v4
228-
with:
229-
name: hydra-spec
230-
path: |
231-
./*.pdf
232-
233-
234-
documentation:
235-
name: Documentation
236-
needs: [haddock,benchmarks,build-test,build-specification]
237-
runs-on: ubuntu-latest
238-
steps:
239-
- name: 📥 Checkout repository
240-
uses: actions/checkout@v4
241-
with:
242-
# For the cardanonical json schemas
243-
submodules: true
244-
# Ensure we have all history with all commits
245-
fetch-depth: 0
246-
247-
- name: ❄ Setup Nix/Cachix
248-
uses: ./.github/actions/nix-cachix-setup
249-
with:
250-
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
251-
252-
- name: Set up and use the "ci" devShell
253-
uses: nicknovitski/nix-develop@v1
254-
with:
255-
arguments: ".#ci"
256-
257-
# Technically, we don't need this, given we're in a Nix shell;
258-
# but we will keep it for the caching.
259-
- name: 🚧 Setup Node.js
260-
uses: actions/setup-node@v4
261-
with:
262-
node-version: 18
263-
cache: 'yarn'
264-
cache-dependency-path: docs/yarn.lock
265-
266-
- name: 📥 Download benchmark results
267-
uses: actions/download-artifact@v5
268-
with:
269-
path: docs/benchmarks
270-
pattern: benchmarks-*
271-
merge-multiple: true
272-
273-
- name: 📥 Download haddock documentation
274-
uses: actions/download-artifact@v5
275-
with:
276-
name: haddocks
277-
path: docs/static/haddock
278-
279-
- name: 📥 Download specification PDF
280-
uses: actions/download-artifact@v5
281-
with:
282-
name: hydra-spec
283-
path: docs/static/
284-
285-
- name: 📚 Documentation sanity check
286-
working-directory: docs
287-
run: |
288-
yarn
289-
yarn build-dev
290-
291-
292-
# Compute the cost difference between this branch and master.
293-
tx-cost-diff:
294-
name: Compute cost differences
295-
runs-on: ubuntu-latest
296-
# Only run on PR
297-
if: github.event_name == 'pull_request'
298-
steps:
299-
- name: "Checkout the PR as the 'new' source"
300-
uses: actions/checkout@v4
301-
302-
- name: ❄ Setup Nix/Cachix
303-
uses: ./.github/actions/nix-cachix-setup
304-
with:
305-
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
306-
307-
- name: Set up and use the "ci" devShell
308-
uses: nicknovitski/nix-develop@v1
309-
with:
310-
arguments: ".#costDifferences"
311-
312-
- name: "Compute the difference markdown"
313-
run: |
314-
nix run ".#tx-cost-diff"
315-
316-
- name: 🔎 Find Comment
317-
uses: peter-evans/find-comment@v3
318-
id: find-comment
319-
with:
320-
issue-number: ${{ github.event.pull_request.number }}
321-
comment-author: 'github-actions[bot]'
322-
body-includes: Transaction cost differences
323-
324-
- name: ✏ Create or update comment
325-
uses: peter-evans/create-or-update-comment@v4
326-
with:
327-
comment-id: ${{ steps.find-comment.outputs.comment-id }}
328-
edit-mode: replace
329-
issue-number: ${{ github.event.pull_request.number }}
330-
body-file: diff.md

.github/workflows/docs.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Documentation"
2+
3+
on:
4+
merge_group:
5+
push:
6+
branches:
7+
- master
8+
- release
9+
pull_request:
10+
workflow_dispatch:
11+
12+
jobs:
13+
documentation:
14+
name: Documentation
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: 📥 Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: ❄ Setup Nix/Cachix
21+
uses: ./.github/actions/nix-cachix-setup
22+
with:
23+
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
24+
25+
- name: 📚 Build documentation
26+
working-directory: docs
27+
run: |
28+
nix build .#docs
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Nix Flake Check
2+
3+
on:
4+
merge_group:
5+
pull_request:
6+
7+
jobs:
8+
quality:
9+
name: Nix Flake Check
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Reclaim the bytes
13+
uses: data-intuitive/reclaim-the-bytes@v2
14+
with:
15+
# NOTE: Remove more when needed, but these take also time
16+
# See https://github.com/marketplace/actions/reclaim-the-bytes
17+
remove-android-sdk: false
18+
remove-docker-images: false
19+
20+
- name: 📥 Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: ❄ Setup Nix/Cachix
24+
uses: ./.github/actions/nix-cachix-setup
25+
with:
26+
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
27+
28+
- name: 📐 Check
29+
run: |
30+
nix flake check -L

.github/workflows/publish-docs.yaml

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ jobs:
2929
with:
3030
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
3131

32-
- name: Set up and use the "ci" devShell
33-
uses: nicknovitski/nix-develop@v1
34-
with:
35-
arguments: ".#ci"
36-
3732
- name: Get released workflow run id
3833
id: released-workflow
3934
uses: actions/github-script@v7
@@ -62,14 +57,6 @@ jobs:
6257
});
6358
return res.data.workflow_runs[0].id;
6459
65-
- name: 📥 Download released hydra-spec
66-
uses: actions/download-artifact@v5
67-
with:
68-
github-token: ${{ secrets.GITHUB_TOKEN || github.token }}
69-
run-id: ${{steps.released-workflow.outputs.result}}
70-
name: hydra-spec
71-
path: docs/static
72-
7360
- name: 📥 Download released benchmarks
7461
uses: actions/download-artifact@v5
7562
with:
@@ -79,26 +66,12 @@ jobs:
7966
merge-multiple: true
8067
path: docs/benchmarks
8168

82-
- name: 📥 Download released haddock documentation
83-
uses: actions/download-artifact@v5
84-
with:
85-
github-token: ${{ secrets.GITHUB_TOKEN || github.token }}
86-
run-id: ${{steps.released-workflow.outputs.result}}
87-
name: haddocks
88-
path: docs/static/haddock
89-
9069
- name: Build documentation
9170
working-directory: docs
9271
run: |
93-
# Only warn on broken links here as the individual documentation builds
94-
# should have failed with broken links originally.
95-
sed -i 's|onBrokenLinks: "throw"|onBrokenLinks: "warn"|' docusaurus.config.js
72+
nix build .#docs
9673
97-
yarn
98-
yarn build
99-
100-
mkdir -p /tmp/public
101-
mv build /tmp/public/head-protocol
74+
cp result/build /tmp/public/head-protocol -r
10275
# Clean the working copy
10376
git clean -dxf
10477
@@ -108,14 +81,6 @@ jobs:
10881
git reset origin/master --hard
10982
sed -i 's|head-protocol|head-protocol/unstable|' docusaurus.config.js
11083
111-
- name: 📥 Download latest hydra-spec
112-
uses: actions/download-artifact@v5
113-
with:
114-
github-token: ${{ secrets.GITHUB_TOKEN || github.token }}
115-
run-id: ${{steps.latest-workflow.outputs.result}}
116-
name: hydra-spec
117-
path: docs/static
118-
11984
- name: 📥 Download latest benchmarks
12085
uses: actions/download-artifact@v5
12186
with:
@@ -125,21 +90,12 @@ jobs:
12590
merge-multiple: true
12691
path: docs/benchmarks
12792

128-
- name: 📥 Download latest haddock documentation
129-
uses: actions/download-artifact@v5
130-
with:
131-
github-token: ${{ secrets.GITHUB_TOKEN || github.token }}
132-
run-id: ${{steps.latest-workflow.outputs.result}}
133-
name: haddocks
134-
path: docs/static/haddock
135-
13693
- name: Build /unstable documentation
13794
working-directory: docs
13895
run: |
139-
yarn
140-
yarn build
96+
nix build .#docs
14197
142-
mv build /tmp/public/head-protocol/unstable
98+
cp result/build /tmp/public/head-protocol/unstable/ -r
14399
144100
- name: 👉 Create redirects
145101
run: |
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "Compute cost differences"
2+
3+
on:
4+
merge_group:
5+
push:
6+
branches:
7+
- master
8+
- release
9+
pull_request:
10+
workflow_dispatch:
11+
12+
permissions:
13+
checks: write
14+
pull-requests: write
15+
16+
jobs:
17+
# Compute the cost difference between this branch and master.
18+
tx-cost-diff:
19+
name: Compute cost differences
20+
runs-on: ubuntu-latest
21+
# Only run on PR
22+
if: github.event_name == 'pull_request'
23+
steps:
24+
- name: "Checkout the PR as the 'new' source"
25+
uses: actions/checkout@v4
26+
27+
- name: ❄ Setup Nix/Cachix
28+
uses: ./.github/actions/nix-cachix-setup
29+
with:
30+
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
31+
32+
- name: Set up and use the "ci" devShell
33+
uses: nicknovitski/nix-develop@v1
34+
with:
35+
arguments: ".#costDifferences"
36+
37+
- name: "Compute the difference markdown"
38+
run: |
39+
nix run ".#tx-cost-diff"
40+
41+
- name: 🔎 Find Comment
42+
uses: peter-evans/find-comment@v3
43+
id: find-comment
44+
with:
45+
issue-number: ${{ github.event.pull_request.number }}
46+
comment-author: 'github-actions[bot]'
47+
body-includes: Transaction cost differences
48+
49+
- name: ✏ Create or update comment
50+
uses: peter-evans/create-or-update-comment@v4
51+
with:
52+
comment-id: ${{ steps.find-comment.outputs.comment-id }}
53+
edit-mode: replace
54+
issue-number: ${{ github.event.pull_request.number }}
55+
body-file: diff.md

0 commit comments

Comments
 (0)