-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (148 loc) · 5.38 KB
/
build.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
# Builds and tests this Haskell project on "GitHub Actions"
#
# 2021-2024 Rudy Matela
#
# some docs: https://github.com/haskell-actions/setup
#
# The official haskell docker image: https://hub.docker.com/_/haskell
name: build
on: [push]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- run: git --version
- run: make --version
- run: ghc --version
- run: cabal --version
- name: Check out repository
uses: actions/checkout@v3
# check out needs to happen before cache so that hashing works
- name: Cache hash
run: echo Cache hash = ${{ hashFiles('*.cabal') }}
- name: Cache cabal (source) packages
uses: actions/cache@v3
with:
path: |
~/.cabal/packages
~/.cache/cabal
key: v1-${{ runner.os }}-cabal-packages-${{ hashFiles('*.cabal') }}
restore-keys: v1-${{ runner.os }}-cabal-packages-
- name: Cache installed cabal packages
uses: actions/cache@v3
with:
path: |
~/.cabal
!~/.cabal/packages
~/.config/cabal
~/.local/state/cabal
~/.ghc
key: v1-${{ runner.os }}-cabal-ghc-latest-${{ hashFiles('*.cabal') }}
restore-keys: v1-${{ runner.os }}-cabal-ghc-latest-${{ hashFiles('*.cabal') }}
# restore with exact match has some versions of cabal have trouble updating
- run: haddock --version || sudo apt-get install ghc-haddock
# blank line
# blank line for alignment with matrix scripts
- run: du -hd3 ~/.ghc ~/.cabal ~/.config/cabal ~/.cache/cabal ~/.local/state/cabal || true
- run: ghc-pkg list
- run: make install-dependencies
- run: ghc-pkg list
- run: du -hd3 ~/.ghc ~/.cabal ~/.config/cabal ~/.cache/cabal ~/.local/state/cabal || true
- run: make
- run: make test
- run: make haddock
- run: make test-sdist
- run: make test-via-cabal
test-with-ghc:
strategy:
max-parallel: 6
matrix:
ghc:
- '9.8'
- '9.6'
- '9.4'
- '9.2'
- '9.0'
- '8.10'
- '8.6'
- '8.2'
runs-on: ubuntu-latest
needs: build-and-test
container: haskell:${{ matrix.ghc }}
steps:
- run: git --version || true # git is missing in some images
- run: make --version || true # make is missing in some images
- run: ghc --version
- run: cabal --version
- name: Check out repository
uses: actions/checkout@v3
# check out needs to happen before cache so that hashing works
- name: Cache hash
run: echo Cache hash = ${{ hashFiles('*.cabal') }}
- name: Cache cabal (source) packages
uses: actions/cache@v3
with:
path: |
~/.cabal/packages
~/.cache/cabal
key: v1-${{ runner.os }}-cabal-packages-${{ hashFiles('*.cabal') }}
restore-keys: v1-${{ runner.os }}-cabal-packages-
- name: Cache installed cabal packages
uses: actions/cache@v3
with:
path: |
~/.cabal
!~/.cabal/packages
~/.config/cabal
~/.local/state/cabal
~/.ghc
key: v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}-${{ hashFiles('*.cabal') }}
restore-keys: v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}-${{ hashFiles('*.cabal') }}
# restore with exact match has some versions of cabal have trouble updating
- run: make --version || rm /etc/apt/sources.list.d/*.list # faster update
- run: make --version || apt-get update
- run: make --version || apt-get install make
- run: du -hd3 ~/.ghc ~/.cabal ~/.config/cabal ~/.cache/cabal ~/.local/state/cabal || true
- run: ghc-pkg list
- run: make install-dependencies
- run: ghc-pkg list
- run: du -hd3 ~/.ghc ~/.cabal ~/.config/cabal ~/.cache/cabal ~/.local/state/cabal || true
- run: make
- run: make test
- run: make haddock
- run: make test-sdist
- run: make test-via-cabal
test-with-stack:
runs-on: ubuntu-latest
needs: build-and-test
steps:
- name: Check out repository
uses: actions/checkout@v3
# check out needs to happen before cache so that hashing works
- name: Cache hash
run: echo Cache hash = ${{ hashFiles('stack.yaml') }}
- name: Cache stack folder
uses: actions/cache@v3
with:
path: ~/.stack
key: v1-${{ runner.os }}-stack-${{ hashFiles('stack.yaml') }}
restore-keys: v1-${{ runner.os }}-stack-
- name: Cache ghcup folder
uses: actions/cache@v3
with:
path: |
~/.ghcup
/usr/local/.ghcup/bin
/usr/local/.ghcup/db
/usr/local/.ghcup/ghc/9.0.2
key: v1-${{ runner.os }}-ghcup-${{ hashFiles('stack.yaml') }}
restore-keys: v1-${{ runner.os }}-ghcup-
- name: Setup Haskell's GHC and Cabal as required by current Stackage LTS
uses: haskell-actions/setup@v2
with: # lts-19.19
ghc-version: '9.0.2'
cabal-version: '3.4'
- run: du -hd2 ~/.stack ~/.ghcup /usr/local/.ghcup || true
- run: stack --version
- run: make test-via-stack
- run: du -hd2 ~/.stack ~/.ghcup /usr/local/.ghcup || true