-
Notifications
You must be signed in to change notification settings - Fork 13
133 lines (121 loc) · 3.38 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Build
on:
workflow_dispatch:
pull_request:
types:
- synchronize
- opened
- reopened
push:
branches:
- main
schedule:
# Run once per day (at UTC 18:00) to maintain cache:
- cron: 0 18 * * *
jobs:
build:
name: ${{ matrix.os }}-ghc-${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
env:
cabal-build-dir: b
strategy:
matrix:
os:
- ubuntu-latest
- macOS-latest
- windows-latest
cabal:
- '3.10'
ghc:
- '8.10'
- '9.0'
- '9.2'
- '9.4'
- '9.6'
- '9.8'
- '9.10'
exclude:
# TODO: https://github.com/IntersectMBO/bech32/issues/72
# To work around the above issue, we exclude the following versions:
- os: macOS-latest
ghc: '8.10'
- os: macOS-latest
ghc: '9.0'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Environment
uses: haskell-actions/setup@v2
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Configure
run: >
cabal configure
--builddir=${{ env.cabal-build-dir }}
--enable-tests
--enable-benchmarks
--enable-documentation
--test-show-details=direct
--write-ghc-environment-files=always
- name: Freeze
run: >
cabal freeze
--builddir=${{ env.cabal-build-dir }}
- name: Cache
uses: actions/cache@v4
env:
hash: ${{ hashFiles('cabal.project.freeze') }}
with:
key: ${{ matrix.os }}-ghc-${{ matrix.ghc }}-${{ env.hash }}
restore-keys: |
${{ matrix.os }}-ghc-${{ matrix.ghc }}-
path: |
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
${{ env.cabal-build-dir }}
- name: Dependencies
run: >
cabal build all
--builddir=${{ env.cabal-build-dir }}
--only-dependencies
- name: Build
run: >
cabal build all
--builddir=${{ env.cabal-build-dir }}
--enable-tests
--enable-benchmarks
- name: Test
run: >
cabal test all
--builddir=${{ env.cabal-build-dir }}
- name: Benchmark
run: >
cabal bench all
--builddir=${{ env.cabal-build-dir }}
|| true
- name: Documentation (Generation)
run: >
cabal haddock all
--builddir=${{ env.cabal-build-dir }}
--enable-documentation
--haddock-hyperlink-source
--haddock-html-location
'https://hackage.haskell.org/package/$pkg-$version/docs'
- name: Documentation (Staging)
if: |
github.ref == 'refs/heads/main'
&& matrix.os == 'ubuntu-latest'
&& matrix.ghc == '9.10'
run: >
mv ${{ env.cabal-build-dir }}/build/*/*/*/doc/html/* gh-pages
touch gh-pages/.nojekyll
- name: Documentation (Deployment)
if: |
github.ref == 'refs/heads/main'
&& matrix.os == 'ubuntu-latest'
&& matrix.ghc == '9.10'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: gh-pages