Skip to content

Commit 90fa6bc

Browse files
committed
Simplify the haddock workflow
Review feedback, pulling the workflow improvements from #6581: - Enter the dev shell once with rrbutani/use-nix-shell-action (as cardano-api and cardano-cli do for this job) instead of paying `nix develop` in each step; the cabal steps become one-liners. - Let `accept-flake-config` pick up the substituters from the flake's nixConfig instead of keeping a copy in the workflow that can drift, and pass an access token for nix's GitHub fetches. - Upload ~/.cache/cabal/logs on failure: when building docs for a dependency fails, cabal only prints a one-line summary to stdout and the actual haddock error (e.g. the tyConStupidTheta panic this PR works around) is only visible in those logs.
1 parent b78bf67 commit 90fa6bc

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

.github/workflows/github-page.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,28 @@ jobs:
2626
extra_nix_config: |
2727
experimental-features = nix-command flakes
2828
allow-import-from-derivation = true
29-
extra-substituters = https://cache.iog.io/
30-
extra-trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
29+
# The substituters (cache.iog.io) come from the flake's nixConfig:
30+
accept-flake-config = true
31+
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
3132
3233
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
3334
with:
3435
persist-credentials: false
3536

3637
# The `.#haddock` shell (see flake.nix) provides a GHC whose haddock does not
3738
# panic on `type data` declarations (GHC issue #25739): GHC 9.6.7's does.
38-
- name: Fetch nix cache and update cabal indices
39-
run: |
40-
nix develop .#haddock --command \
41-
cabal update
39+
- uses: rrbutani/use-nix-shell-action@59a52b2b9bbfe3cc0e7deb8f9059abe37a439edf # v1
40+
with:
41+
devShell: .#haddock
42+
43+
- name: Update cabal indices
44+
run: cabal update
4245

4346
- name: Build whole project
44-
run: |
45-
nix develop .#haddock --command \
46-
cabal build all
47+
run: cabal build all
4748

4849
- name: Build documentation
49-
run: |
50-
nix develop .#haddock --command \
51-
cabal haddock-project --local --output=./haddocks --internal --foreign-libraries
50+
run: cabal haddock-project --local --output=./haddocks --internal --foreign-libraries
5251

5352
- name: Compress haddocks
5453
run: |
@@ -62,6 +61,16 @@ jobs:
6261
name: haddocks
6362
path: ./haddocks.tgz
6463

64+
# cabal only prints a summary line when building docs for a dependency
65+
# fails; the actual haddock error is hidden in these logs.
66+
- name: Upload cabal logs
67+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
68+
if: ${{ failure() }}
69+
continue-on-error: true
70+
with:
71+
name: cabal-haddock-logs
72+
path: ~/.cache/cabal/logs/
73+
6574
- name: Deploy documentation to gh-pages 🚀
6675
if: github.ref == 'refs/heads/master'
6776
uses: peaceiris/actions-gh-pages@e9c66a37f080288a11235e32cbe2dc5fb3a679cc # v4

0 commit comments

Comments
 (0)