Skip to content

Commit 5c059d7

Browse files
authored
Generate Haddocks in CI (#813)
1 parent 3ae029d commit 5c059d7

2 files changed

Lines changed: 29 additions & 10 deletions

File tree

.github/workflows/build.yaml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,19 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
# The 'cabal-flags' option is typically non-empty for new
21-
# GHC releases, for which we may need `--allow-newer` flags
22-
# while dependencies are updated.
2320
include:
2421
- ghc-version: "8.10.7"
25-
duckdb: false
2622
- ghc-version: "9.0.2"
27-
duckdb: false
2823
- ghc-version: "9.2.8"
29-
duckdb: false
3024
- ghc-version: "9.4.8"
31-
duckdb: false
3225
- ghc-version: "9.6.7"
3326
duckdb: true
3427
- ghc-version: "9.8.4"
3528
duckdb: true
3629
- ghc-version: "9.10.3"
3730
duckdb: true
31+
# Only one GHC version should have 'upload-documentation: true'
32+
upload-documentation: true
3833
- ghc-version: "9.12.2"
3934
duckdb: true
4035
- ghc-version: "9.14.1"
@@ -60,7 +55,8 @@ jobs:
6055
- name: Generate freeze file
6156
run: |
6257
cabal update
63-
cabal configure --disable-optimization
58+
# Building documentation is slightly more expensive, so we only enable it
59+
cabal configure --disable-optimization ${{ matrix.upload-documentation && '--enable-doc' || '' }}
6460
cabal freeze
6561
6662
# Exclude the timestamp of Hackage index update from our cache key, to
@@ -74,7 +70,7 @@ jobs:
7470
path: |
7571
dist-newstyle
7672
${{ steps.setup-haskell.outputs.cabal-store }}
77-
key: ${{ runner.os }}-${{ hashFiles('dependencies-versions', 'cabal.project.local') }}-cabal-install
73+
key: ${{ runner.os }}-${{ hashFiles('dependencies-versions', 'cabal.project.local') }}-${{ matrix.upload-documentation && 'withdocs' || 'nodocs' }}-cabal-install
7874

7975
- name: Install DuckDB artifact
8076
if: ${{ matrix.duckdb }}
@@ -101,7 +97,28 @@ jobs:
10197
- name: Run benchmarks
10298
if: ${{ matrix.duckdb }}
10399
run: |
104-
BEAM_BENCH_ROWS=100000 cabal -v0 bench beam-backend-bench:beam-postgres && cabal -v0 bench beam-backend-bench:beam-sqlite && cabal -v0 bench beam-backend-bench:beam-duckdb
100+
BEAM_BENCH_ROWS=100000 cabal -v0 bench beam-backend-bench:beam-postgres \
101+
&& cabal -v0 bench beam-backend-bench:beam-sqlite \
102+
&& cabal -v0 bench beam-backend-bench:beam-duckdb
103+
104+
# For releases, Haddock documentation may not be be automatically
105+
# generated by Hackage due to missing dependencies (e.g. libduckdb, libpq).
106+
#
107+
# Therefore, we build Haddock documentation suitable for upload to Hackage, which are
108+
# used when doing manual releases. We only do this for a single GHC version to reuse the work already done in
109+
# this matrix entry.
110+
- name: Build Haddock documentation for Hackage
111+
if: ${{ matrix.upload-documentation }}
112+
run: |
113+
cabal haddock all --haddock-for-hackage
114+
115+
- name: Upload Haddock artifacts
116+
if: ${{ matrix.upload-documentation && github.ref == 'refs/heads/master' }}
117+
uses: actions/upload-artifact@v4
118+
with:
119+
name: ${{ runner.os }}-haddock-artifact
120+
path: dist-newstyle/*-docs.tar.gz
121+
retention-days: 7
105122

106123
release-artifacts:
107124
# Only build release artifacts if `continuous-integration` is successful

RELEASE-CHECKLIST.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ For any given package that you want to release:
77
[ ] Commit and push;
88
[ ] Wait for the Github Actions pipeline to complete;
99
[ ] Download the release artifacts from the build on Github Actions;
10+
[ ] Download the documentation artifacts from the build on Github Actions;
1011
[ ] Release to Hackage: `cabal upload --publish <release-artifact>`.
12+
[ ] Upload documentation to Hackage: `cabal upload --publish --documentation <documentation-artifact>`.

0 commit comments

Comments
 (0)