-
Notifications
You must be signed in to change notification settings - Fork 1
144 lines (124 loc) · 3.68 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: "ci"
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
release:
types: ["published"]
jobs:
hlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Set up hlint"
uses: haskell/actions/hlint-setup@v2
with:
version: "3.8"
- name: "Run hlint"
uses: haskell/actions/hlint-run@v2
with:
path: '["src/", "test/"]'
fail-on: warning
fourmolu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: haskell-actions/run-fourmolu@v9
with:
version: "0.15.0.0"
cabal:
name: cabal ${{ matrix.cabal }} / ghc ${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest"]
cabal: ["3.10.3.0"]
ghc:
- "9.4.8"
- "9.6.5"
- "9.8.2"
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/cabal-build"
name: Build
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
stack:
name: stack ${{ matrix.stack }} / ${{ matrix.resolver }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest"]
stack: ["2.15.5"]
resolver:
- "lts-21"
- "lts-22"
- "nightly"
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/stack-build"
name: Build
with:
resolver: ${{ matrix.resolver }}
stack-version: ${{ matrix.stack }}
publish:
name: "publish"
runs-on: "ubuntu-latest"
needs:
- hlint
- fourmolu
- cabal
- stack
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
id: setup-haskell-cabal
name: Setup Haskell and Cabal
with:
ghc-version: "9.8.2"
cabal-version: "3.10.3.0"
- name: Freeze
run: |
cabal freeze
head -n -1 cabal.project.freeze > deps
- uses: actions/cache@v3
name: Cache ~/.cabal/store
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: publish-${{ hashFiles('deps') }}
- name: "Bundle the package"
run: |
cabal sdist
- name: "Bundle the documentation"
run: |
cabal haddock --haddock-for-hackage --enable-doc
- name: "Publish package to Hackage"
if: github.event_name == 'release'
env:
HACKAGE_USER: ${{ secrets.HACKAGE_USER }}
HACKAGE_PASSWORD: ${{ secrets.HACKAGE_PASSWORD }}
run: |
cabal upload --publish -u $HACKAGE_USER -p $HACKAGE_PASSWORD ./dist-newstyle/sdist/*.tar.gz
- name: "Publish candidate package to Hackage"
if: github.event_name == 'push'
env:
HACKAGE_USER: ${{ secrets.HACKAGE_USER }}
HACKAGE_PASSWORD: ${{ secrets.HACKAGE_PASSWORD }}
run: |
cabal upload -u $HACKAGE_USER -p $HACKAGE_PASSWORD ./dist-newstyle/sdist/*.tar.gz
- name: "Publish docs to Hackage"
if: github.event_name == 'release'
env:
HACKAGE_USER: ${{ secrets.HACKAGE_USER }}
HACKAGE_PASSWORD: ${{ secrets.HACKAGE_PASSWORD }}
run: |
cabal upload --publish -u $HACKAGE_USER -p $HACKAGE_PASSWORD -d ./dist-newstyle/*-docs.tar.gz
- name: "Publish candidate docs to Hackage"
if: github.event_name == 'push'
env:
HACKAGE_USER: ${{ secrets.HACKAGE_USER }}
HACKAGE_PASSWORD: ${{ secrets.HACKAGE_PASSWORD }}
run: |
cabal upload -u $HACKAGE_USER -p $HACKAGE_PASSWORD -d ./dist-newstyle/*-docs.tar.gz