-
Notifications
You must be signed in to change notification settings - Fork 4
111 lines (96 loc) · 3.29 KB
/
ci.yaml
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
name: CI
on: [push, pull_request]
jobs:
validate:
name: GHC ${{ matrix.ghc }}, Cabal ${{ matrix.cabal }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
# In 2022 State of Haskell:
# 41% 8.10
# 25% 9.0
# 48% 9.2
# 26% 9.4
# 10% 9.6
# As such, we'll keep supporting 8.10 as an LTS of sorts for now.
ghc: ['8.10', '9.2', '9.4', '9.6', latest]
cabal: ['3.6', latest]
exclude:
- ghc: '9.4'
cabal: '3.6'
- ghc: '9.6'
cabal: '3.6'
- ghc: 'latest'
cabal: '3.6'
env:
CONFIG: "--enable-tests --enable-doc"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Haskell
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Determine Dependencies
run: |
cabal update
cabal freeze $CONFIG
- name: Check Cache
uses: actions/cache@v2
with:
path: |
~/.cabal/store
dist-newstyle
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-
- name: Build
run: cabal build gigaparsec $CONFIG
- name: Test
run: |
cabal test $CONFIG --test-options="--color always"
- name: Doc
# Define the `__HADDOCK__` C macro only for the documentation generation.
# This is used when generating the type-specialised docs, but allows
# the actual haskell library to export the non-specialised versions.
run: cabal haddock gigaparsec --haddock-options=--optghc=-cpp --haddock-options=--optghc=-D__HADDOCK__ $CONFIG
deploy:
name: Deploy Docs
needs: validate
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-20.04
strategy:
matrix:
ghc: [latest]
cabal: [latest]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Haskell
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Determine Dependencies
run: |
cabal update
cabal freeze $CONFIG
- name: Check Cache
uses: actions/cache@v2
with:
path: |
~/.cabal/store
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-
- name: Doc
run: cabal haddock gigaparsec --enable-doc --haddock-hyperlink-source --haddock-quickjump --haddock-html-location='https://hackage.haskell.org/package/$pkg-$version/docs' --haddock-options=--optghc=-cpp --haddock-options=--optghc=-D__HADDOCK__
- name: Prepare to upload built htmls
run: cp -r ./$(find dist-newstyle -path '*/doc/html/gigaparsec') site
- name: Deploy haddock
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: site