Skip to content

Commit b810c38

Browse files
committed
Merge branch 'improve-ci'
2 parents 2db7198 + 4d93724 commit b810c38

File tree

3 files changed

+97
-81
lines changed

3 files changed

+97
-81
lines changed

.github/workflows/haddock-pages.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

.github/workflows/haskell-ci.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Test and Publish API docs
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
env:
6+
HADDOCK_DIR: haddock-html
7+
HADDOCK_BUILD_DIR: haddock_build
8+
PAGES_DIR: gh-pages
9+
10+
jobs:
11+
12+
build_test_doc:
13+
name: Test & Docs (${{ matrix.ghc-version }} on ${{ matrix.os }})
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ubuntu-latest]
19+
ghc-version: ['9.2', '9.4', '9.6', '9.8', '9.10', '9.12']
20+
include:
21+
- os: windows-latest
22+
ghc-version: '9.6'
23+
- os: macos-latest
24+
ghc-version: '9.6'
25+
26+
steps:
27+
28+
- name: Checkout repository content
29+
uses: actions/checkout@v4
30+
31+
- name: Set up GHC ${{ matrix.ghc-version }}
32+
uses: haskell-actions/setup@v2
33+
id: setup
34+
with:
35+
ghc-version: ${{ matrix.ghc-version }}
36+
37+
- name: Configure the build
38+
# generates dist-newstyle/cache/plan.json
39+
run: |
40+
cabal configure --enable-tests --enable-benchmarks
41+
cabal build all --dry-run
42+
43+
- name: Configure cache
44+
uses: actions/cache@v4
45+
env:
46+
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-${{ steps.setup.outputs.cabal-version }}
47+
with:
48+
path: ${{ steps.setup.outputs.cabal-store }}
49+
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
50+
restore-keys: ${{ env.key }}-plan-
51+
52+
- name: Install dependencies
53+
run: cabal build --only-dependencies all
54+
55+
- name: Build project
56+
run: cabal build all
57+
58+
- name: Run tests
59+
run: cabal test --test-show-details=streaming all
60+
61+
- name: Generate haddock API docs
62+
if: matrix.os == 'ubuntu-latest' && matrix.ghc-version == '9.6'
63+
run: cabal haddock --builddir=$HADDOCK_BUILD_DIR --haddock-hyperlinked-source --haddock-html-location='https://hackage.haskell.org/package/$pkg-$version/docs'
64+
65+
- name: Find generated HTML
66+
if: matrix.os == 'ubuntu-latest' && matrix.ghc-version == '9.6'
67+
run: mv $(find $HADDOCK_BUILD_DIR -wholename '*doc/html/circular-enum' | head -n 1) $HADDOCK_DIR
68+
69+
- name: Store generated API docs
70+
if: matrix.os == 'ubuntu-latest' && matrix.ghc-version == '9.6'
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: Haddock API docs
74+
path: ${{ env.HADDOCK_DIR }}
75+
76+
- name: Prepare API docs for pages deployment
77+
if: matrix.os == 'ubuntu-latest' && matrix.ghc-version == '9.6'
78+
uses: actions/upload-pages-artifact@v3
79+
with:
80+
path: ${{ env.HADDOCK_DIR }}
81+
82+
deploy:
83+
name: Deploy API docs
84+
needs: build_test_doc
85+
if: github.ref == 'refs/heads/main'
86+
runs-on: ubuntu-latest
87+
permissions:
88+
pages: write
89+
id-token: write
90+
environment:
91+
name: github-pages
92+
url: ${{ steps.deployment.outputs.page_url }}
93+
steps:
94+
95+
- name: Deploy to GitHub Pages
96+
id: deployment
97+
uses: actions/deploy-pages@v4

.github/workflows/test.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)