Skip to content

Commit bc37b40

Browse files
committed
Combine workflows into one
1 parent a61fe4a commit bc37b40

File tree

2 files changed

+28
-53
lines changed

2 files changed

+28
-53
lines changed

.github/workflows/haddock-pages.yml renamed to .github/workflows/haskell-ci.yml

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,56 @@
1-
name: Publish API docs
1+
name: Test and Publish API docs
22

33
on: [push, pull_request, workflow_dispatch]
44

55
env:
66
HADDOCK_DIR: haddock-html
7+
HADDOCK_BUILD_DIR: haddock_build
78
PAGES_DIR: gh-pages
89

910
jobs:
1011

11-
haddock:
12+
build_test_doc:
13+
name: Build, Test, API docs
1214
runs-on: ubuntu-latest
1315
steps:
1416

15-
- name: Set up haskell
17+
- name: Checkout repository content
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Haskell
1621
uses: haskell-actions/setup@v2
22+
id: setup
1723
with:
1824
ghc-version: '9.2.7'
1925
cabal-version: '3.6.2.0'
2026

21-
- name: Checkout repository content
22-
uses: actions/checkout@v4
27+
- name: Configure the build
28+
# generates dist-newstyle/cache/plan.json
29+
run: |
30+
cabal configure --enable-tests --enable-benchmarks
31+
cabal build all --dry-run
2332
2433
- name: Configure cache
2534
uses: actions/cache@v4
2635
with:
27-
path: |
28-
~/.cabal/packages
29-
~/.cabal/store
30-
dist-newstyle
31-
key: cabal-${{ hashFiles('**/*.cabal', '**/*.cabal.project', '**/*.cabal.project.freeze') }}
36+
path: ${{ steps.setup.outputs.cabal-store }}
37+
key: cabal-${{ hashFiles('**/plan.json') }}
3238
restore-keys: cabal-
3339

34-
- name: Prepare cabal
35-
run: cabal update
40+
- name: Install dependencies
41+
run: cabal build --only-dependencies all
42+
43+
- name: Build project
44+
run: cabal build all
45+
46+
- name: Run tests
47+
run: cabal test --test-show-details=streaming all
3648

3749
- name: Generate haddock API docs
38-
run: cabal haddock --builddir=haddock_build --haddock-hyperlinked-source --haddock-html-location='https://hackage.haskell.org/package/$pkg-$version/docs'
50+
run: cabal haddock --builddir=$HADDOCK_BUILD_DIR --haddock-hyperlinked-source --haddock-html-location='https://hackage.haskell.org/package/$pkg-$version/docs'
3951

4052
- name: Find generated HTML
41-
run: mv $(find haddock_build -wholename '*doc/html/circular-enum' | head -n 1) $HADDOCK_DIR
53+
run: mv $(find $HADDOCK_BUILD_DIR -wholename '*doc/html/circular-enum' | head -n 1) $HADDOCK_DIR
4254

4355
- name: Store generated API docs
4456
uses: actions/upload-artifact@v4
@@ -52,7 +64,8 @@ jobs:
5264
path: ${{ env.HADDOCK_DIR }}
5365

5466
deploy:
55-
needs: haddock
67+
name: Deploy API docs
68+
needs: build_test_doc
5669
if: github.ref == 'refs/heads/main'
5770
runs-on: ubuntu-latest
5871
permissions:

.github/workflows/test.yml

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

0 commit comments

Comments
 (0)