Skip to content

Commit 41d3e2b

Browse files
committed
fix CI Hackage artifact generation
1 parent 9a333f0 commit 41d3e2b

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

.github/workflows/hackage.yml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# GitHub Actions worflow to build Hackage artifacts for a project: an sdist
2+
# archive, and Haddock docs for uploading to Hackage.
3+
#
4+
# I would love to do this in the same testing workflows, so we're not wasting
5+
# GitHub's resources, but workflow syntax is debilitating and they strip docs in
6+
# their provided GHCs, so there's too much complexity to handle it in one place.
7+
#
18
# This workflow is based on the expectation that GitHub's runners install GHC
29
# using ghcup with default settings (installs GHCs to `~/.ghcup/ghc/$VERSION`).
310

@@ -10,8 +17,8 @@ on:
1017

1118
env:
1219
# ghcup needs full version string (e.g. 9.0.1, not 9.0)
13-
ghc: "9.0.1"
14-
EXE_NAME: fortran-src
20+
ghc: "9.2.2"
21+
package_name: fortran-src
1522

1623
jobs:
1724
hackage:
@@ -44,7 +51,7 @@ jobs:
4451
uses: actions/cache@v2
4552
with:
4653
path: ~/.ghcup/ghc/${{ env.ghc }}
47-
key: haddock-${{ env.ghc }}-ghc
54+
key: hackage-ghc-${{ runner.os }}-ghc_${{ env.ghc }}
4855

4956
- name: Install GHC ${{ env.ghc }} if not present from cache
5057
run: |
@@ -64,27 +71,30 @@ jobs:
6471
path: |
6572
~/.cabal/store
6673
dist-newstyle
67-
key: haddock-${{ env.ghc }}-cabal-${{ hashFiles('cabal.project.freeze') }}
68-
restore-keys: haddock-${{ env.ghc }}-cabal
74+
key: hackage-deps-${{ runner.os }}-ghc_${{ env.ghc }}-${{ hashFiles('cabal.project.freeze') }}
75+
restore-keys: hackage-deps-${{ runner.os }}-ghc_${{ env.ghc }}
76+
77+
# TODO 2022-04-22: --haddock-options=--quickjump fixes a bug with not
78+
# propagating --haddock-quickjump to building dependency Haddocks
79+
- run: cabal build --enable-documentation --haddock-for-hackage --haddock-options=--quickjump
6980

70-
- run: cabal haddock --haddock-for-hackage --enable-documentation
7181
- run: cabal sdist
7282

7383
- name: Upload Hackage sdist
7484
uses: actions/upload-artifact@v2
7585
with:
76-
path: dist-newstyle/sdist/${{ env.EXE_NAME }}-*.tar.gz
77-
name: ${{ env.EXE_NAME }}-sdist-${{ github.sha }}.tar.gz
86+
path: dist-newstyle/sdist/${{ env.package_name }}-*.tar.gz
87+
name: ${{ env.package_name }}-sdist-${{ github.sha }}.tar.gz
7888
if-no-files-found: error
7989

8090
- name: Upload Hackage Haddock docs
8191
uses: actions/upload-artifact@v2
8292
with:
83-
path: dist-newstyle/${{ env.EXE_NAME }}-*-docs.tar.gz
84-
name: ${{ env.EXE_NAME }}-hackage-haddocks-${{ github.sha }}.tar.gz
93+
path: dist-newstyle/${{ env.package_name }}-*-docs.tar.gz
94+
name: ${{ env.package_name }}-hackage-haddocks-${{ github.sha }}.tar.gz
8595
if-no-files-found: error
8696

8797
- name: Delete prepared tarballs (else can't extract just newest next time)
8898
run: |
89-
rm dist-newstyle/${{ env.EXE_NAME }}-*-docs.tar.gz
90-
rm dist-newstyle/sdist/${{ env.EXE_NAME }}-*.tar.gz
99+
rm dist-newstyle/${{ env.package_name }}-*-docs.tar.gz
100+
rm dist-newstyle/sdist/${{ env.package_name }}-*.tar.gz

0 commit comments

Comments
 (0)