-
Notifications
You must be signed in to change notification settings - Fork 4
172 lines (148 loc) · 5.05 KB
/
haskell.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
name: CI
on:
# Build every pull request, to check for regressions.
pull_request:
types: [opened, synchronize]
# Build when a PR is merged, to update the README's CI badge.
push:
branches: [main]
# Build once a month, to detect missing upper bounds.
schedule:
- cron: '0 0 1 * *'
jobs:
stack:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
# Check that the build passes with the recommended snapshot.
- name: stable
stack_yaml: "stack.yaml"
os: ubuntu-latest
# Check that the lower bounds are still correct by building with the
# lowest-supported version of everything, including our dependencies.
- name: oldest
stack_yaml: "oldest-supported-lts.yaml"
os: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
name: Cache Stack Artifacts
with:
path: |
~/.stack
.stack-work
key: ${{ runner.os }}-stack-${{ hashFiles(matrix.stack_yaml) }}
- uses: haskell/actions/setup@v1
id: setup-haskell-stack
name: Setup Stack
with:
enable-stack: true
stack-setup-ghc: true
stack-no-global: true
ghc-version: ${{ matrix.ghc }}
- name: Build
run: |
stack --stack-yaml=${{ matrix.stack_yaml }} build --test --bench --no-run-tests --no-run-benchmarks
- name: Test
run: |
stack --stack-yaml=${{ matrix.stack_yaml }} test
cabal:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# The purpose of that section is two-fold. First, because we are
# using cabal and not stack, cabal will pick the most recent version
# of our dependencies which has been released. This way, if a
# dependency releases a breaking change, the next monthly CI will
# pick that version and notify us if we are affected by the change.
#
# Second, since this project is a ghc plugin, we rely on details of
# the GHC library which change between versions. It is thus quite
# easy to accidentally make a change which works for the latest
# version of GHC but not with older versions. CI should thus test all
# the supported GHC versions.
- name: ghc-8.10
ghc: "8.10.7"
os: ubuntu-latest
- name: ghc-9.0
ghc: "9.0.2"
os: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: haskell/actions/setup@v1
id: setup-haskell-cabal
name: Setup Cabal
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
# This freeze file is regenerated on every build, so we will always test
# with the most recent version of our dependencies allowed by our upper
# bounds.
- name: Freeze
run: |
cabal configure --enable-tests --enable-benchmarks --test-show-details=direct
cabal freeze
# Only reuse the cached copy of our dependencies if our freeze file matches
# the cache's copy.
- uses: actions/cache@v2
name: Cache Cabal Artifacts
with:
path: |
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
dist-newstyle
key: ${{ runner.os }}-cabal-${{ hashFiles('cabal.project.freeze') }}
- name: Build
run: |
cabal build all
- name: Test
run: |
cabal test all
# a separate job just to check the error messages, because that requires
# building several failing projects and so the test framework is more complex.
error-messages:
name: Error Messages
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- ghc: "9.0"
os: ubuntu-latest
steps:
- uses: actions/checkout@v2
# ./test/error-messages/Test.hs is a cabal script, so we need Cabal.
- uses: haskell/actions/setup@v1
id: setup-haskell-cabal
name: Setup Cabal
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: false
# ./test/error-messages/Test.hs runs some stack projects, so we also need stack.
- uses: haskell/actions/setup@v1
id: setup-haskell-stack
name: Setup Stack
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
- uses: actions/cache@v2
id: cache-stack-and-cabal
name: Cache Stack and Cabal Artifacts
with:
# store the whole ~/.cabal, not just ~/.cabal/store, so we don't have to re-run 'cabal update'.
path: |
~/.cabal
dist-newstyle
~/.stack
**/.stack-work
key: ${{ runner.os }}-${{ matrix.ghc }}-error-messages-${{ hashFiles('stack.yaml') }}
# For some reason setup-haskell-cabal sometimes doesn't run 'cabal update'.
- name: Initialize Cabal
if: steps.cache-stack-and-cabal.outputs.cache-hit != 'true'
run: |
cabal update
- name: Test Error Messages
run: |
./test/error-messages/Test.hs `pwd`