-
Notifications
You must be signed in to change notification settings - Fork 2
194 lines (186 loc) · 5.55 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
name: CI
on:
pull_request:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'
workflow_call:
jobs:
build_and_test:
name: build_and_test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13.1
env:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_DB: persistent_mtl
ports:
- 5432:5432
env:
TEST_POSTGRESQL: 1
steps:
-
uses: actions/checkout@v3
-
uses: actions/cache@v3
with:
path: ~/.stack
key: ${{ runner.os }}-stack-cache-${{ hashFiles('stack.yaml', 'package.yaml') }}
-
run: stack test --coverage
-
name: Check that files are unmodified
run: git diff --exit-code
-
name: Check for any outdated packages
run: cabal outdated --exit-code
-
name: Generate coverage data
run: |
HPC_LCOV_VERSION=1.1.1
curl -fsSL \
"https://github.com/brandonchinn178/hpc-lcov/releases/download/v${HPC_LCOV_VERSION}/hpc-lcov-${HPC_LCOV_VERSION}-linux-x86_64" \
-o /usr/local/bin/hpc-lcov
chmod +x /usr/local/bin/hpc-lcov
hpc-lcov
-
uses: codecov/codecov-action@v3
with:
files: lcov.info
compat_test:
strategy:
matrix:
ghc_version:
- '9.4'
- '9.6'
- '9.8'
persistent_version:
- '2.14'
include:
- ghc_version: '9.4.4'
persistent_version: '2.14'
oldest: true
name: compat_test (ghc-${{ matrix.ghc_version }}, persistent-${{ matrix.persistent_version }})
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v3
-
id: setup
name: Set up GHC ${{ matrix.ghc_version }}
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc_version }}
-
name: Configure the build
run:
cabal configure
--enable-test
--test-options='--color=always'
--test-show-details=streaming
--constraint='persistent ^>= ${{ matrix.persistent_version }}'
--constraint='persistent >= 2.14.0.2'
-
# https://github.com/bitemyapp/esqueleto/pull/381
if: ${{ matrix.ghc_version == '9.8' }}
name: Patch esqueleto
run: |
cabal configure --enable-append --allow-newer esqueleto:text
cat >> cabal.project.local <<EOF
source-repository-package
type: git
location: https://github.com/MercuryTechnologies/esqueleto.git
tag: 94d27de57072a823d97bd9868b33c45545c067c4
EOF
-
if: ${{ matrix.oldest }}
name: Use oldest dependencies
run:
cabal configure
--enable-append --prefer-oldest
--constraint 'array installed'
--constraint 'time installed'
--constraint 'persistent-sqlite > 2.13.0.3'
--constraint 'silently >= 0.0.3'
--constraint 'string-conversions >= 0.4'
-
name: Get build plan
run: cabal build --dry-run
-
name: Get current month to clear cache
run: echo "CURR_MONTH=$(date +%B)" | tee -a "$GITHUB_ENV"
-
uses: actions/cache@v3
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ runner.os }}-cabal-cache-${{ env.CURR_MONTH }}-${{ matrix.ghc_version }}-${{ hashFiles('**/plan.json') }}
restore-keys: |
${{ runner.os }}-cabal-cache-${{ env.CURR_MONTH }}-${{ matrix.ghc_version }}-
-
name: Build + Test
run: cabal test
lint:
runs-on: ubuntu-latest
env:
HLINT_VERSION: '3.5'
FOURMOLU_VERSION: '0.13.0.0'
steps:
-
uses: actions/checkout@v3
-
name: Install hlint
run: |
HLINT_ARCHIVE="hlint-${HLINT_VERSION}-x86_64-linux.tar.gz"
curl -sSLO "https://github.com/ndmitchell/hlint/releases/download/v${HLINT_VERSION}/${HLINT_ARCHIVE}"
tar xzf "${HLINT_ARCHIVE}" -C /usr/local/bin/ --strip-components=1 "hlint-${HLINT_VERSION}/hlint"
-
name: Install fourmolu
run: |
curl -sSL \
"https://github.com/fourmolu/fourmolu/releases/download/v${FOURMOLU_VERSION}/fourmolu-${FOURMOLU_VERSION}-linux-x86_64" \
-o /usr/local/bin/fourmolu
chmod +x /usr/local/bin/fourmolu
-
run: pip install pre-commit
-
run: pre-commit run --all-files -v --show-diff-on-failure
env:
SKIP: no-commit-to-branch
check_sdist:
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v3
-
uses: actions/cache@v3
with:
path: ~/.stack
key: ${{ runner.os }}-check_sdist-${{ hashFiles('stack.yaml', 'package.yaml') }}
-
name: Strip unreleased section from CHANGELOG
run: sed -i -n '/^# Unreleased/d; /^#/,$p' CHANGELOG.md
-
name: Create sdist bundle
run: stack sdist --test-tarball --tar-dir .
-
uses: actions/upload-artifact@v3
with:
name: persistent-mtl-sdist
path: persistent-mtl-*.tar.gz
check_codegen:
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v3
-
uses: actions/cache@v3
with:
path: ~/.stack
key: ${{ runner.os }}-check_codegen-${{ hashFiles('stack.yaml') }}
-
run: scripts/generate/run.sh
-
run: git diff --exit-code *.hs