-
Notifications
You must be signed in to change notification settings - Fork 0
200 lines (175 loc) · 5.76 KB
/
ci.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# SPDX-FileCopyrightText: 2020 Kowainik
# SPDX-FileCopyrightText: 2020 Serokell <https://serokell.io/>
#
# SPDX-License-Identifier: MPL-2.0
# Sources:
# • https://github.com/kowainik/validation-selective/blob/5b46cd4810bbaa09b704062ebbfa2bb47137425d/.github/workflows/ci.yml
# • https://kodimensional.dev/github-actions
name: CI
# Trigger the workflow on push or pull request
on:
pull_request:
push:
jobs:
xrefcheck:
name: Verify cross references
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: serokell/xrefcheck-action@v1
with:
xrefcheck-version: 0.3.0
reuse:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1
hlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Set up HLint'
uses: haskell/actions/hlint-setup@v2
with:
version: '3.1.6'
- name: 'Run HLint'
uses: haskell/actions/hlint-run@v2
with:
path: .
fail-on: status
stylish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache binaries
id: cache-stylish
uses: actions/cache@v3
with:
path: ~/.local/bin
key: bin-stylish
- name: Setup
if: steps.cache-stylish.outputs.cache-hit != 'true'
run: |
mkdir -p "$HOME/.local/bin"
wget https://github.com/haskell/stylish-haskell/releases/download/v0.14.2.0/stylish-haskell-v0.14.2.0-linux-x86_64.tar.gz
tar -zxf stylish-haskell-v0.14.2.0-linux-x86_64.tar.gz \
--strip-components 1 \
-C "$HOME/.local/bin" \
stylish-haskell-v0.14.2.0-linux-x86_64/stylish-haskell
chmod +x "$HOME/.local/bin"/stylish-haskell
- name: Stylish Haskell
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
./scripts/validate-stylish.sh
whitespace:
name: Find Trailing Whitespace
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: harupy/[email protected]
cabal:
name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
cabal: ["3.10"]
# If you update this list of supported compiler versions,
# make sure to:
# * Update the `tested-with` section of `package.yaml`.
# * Update the list of required checks in the repo's settings.
# * Go to: https://github.com/serokell/tztime/settings/branches
# * Edit the "main" branch
# * Scroll to "Branch protection rules" > "Require status checks to pass before merging"
# * Remove versions we're not testing anymore / Add versions we're now testing.
ghc:
- "8.10.7"
- "9.0.2"
- "9.2.8"
- "9.4.7"
exclude:
- os: macOS-latest
ghc: "8.10.7"
- os: windows-latest
ghc: "8.10.7"
- os: macOS-latest
ghc: "9.0.2"
- os: windows-latest
ghc: "9.0.2"
- os: macOS-latest
ghc: "9.2.8"
- os: windows-latest
ghc: "9.2.8"
steps:
- uses: actions/checkout@v3
- uses: haskell/actions/setup@v2
id: setup-haskell-cabal
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- uses: actions/cache@v3
name: Cache cabal-store
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal
- name: Build
run: |
cabal update
cabal build --project-file=cabal.project.ci --enable-tests --enable-benchmarks --write-ghc-environment-files=always
- name: Test
run: |
cabal test --project-file=cabal.project.ci all --enable-tests
- name: Haddock
run: |
cabal haddock --project-file=cabal.project.ci --haddock-for-hackage
stack:
name: stack / ghc ${{ matrix.ghc }}
runs-on: ubuntu-latest
strategy:
matrix:
stack: ["2.9.3"]
ghc: ["8.10.7", "9.4.7"]
include:
- ghc: "8.10.7"
stackyaml: stack.min.yaml
- ghc: "9.4.7"
stackyaml: stack.yaml
steps:
- uses: actions/checkout@v3
- uses: haskell/actions/setup@v2
name: Setup Haskell Stack
with:
ghc-version: ${{ matrix.ghc }}
stack-version: ${{ matrix.stack }}
enable-stack: true
- uses: actions/cache@v3
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-${{ matrix.ghc }}-stack
- name: Build
run: |
stack build --system-ghc \
--stack-yaml ${{ matrix.stackyaml }} \
--test --bench --no-run-tests --no-run-benchmarks \
--ghc-options '-Werror' \
--haddock --no-haddock-deps
- name: Test
run: |
stack test --system-ghc \
--stack-yaml ${{ matrix.stackyaml }}
# TODO:
# Once hpack releases more recent binaries (see: https://github.com/sol/hpack/issues/514),
# We should change this step to download the binaries for stack2cabal 1.0.13 and hpack >=0.34.4,
# and then run `./hpack && ./stack2cabal --no-run-hpack`
# When this action fails with diffs involving hpack versions,
# try changing hpack version in snapshot-stack2cabal.yaml
- name: Validate cabal files
# Run this step only against the stack file we use for development.
if: matrix.stackyaml == 'stack.yaml'
run: |
stack --version;
stack install stack2cabal --resolver snapshot-stack2cabal.yaml --system-ghc
./scripts/validate-cabal-files.sh