18
18
MINIO_ACCESS_KEY : minio
19
19
MINIO_SECRET_KEY : minio123
20
20
MINIO_LOCAL : 1
21
- MINIO_SECURE : 1
22
21
23
22
jobs :
24
23
ormolu :
@@ -35,12 +34,12 @@ jobs:
35
34
- uses : actions/checkout@v4
36
35
37
36
- name : " Set up HLint"
38
- uses : haskell/ actions/hlint-setup@v2
37
+ uses : haskell- actions/hlint-setup@v2
39
38
with :
40
39
version : " 3.5"
41
40
42
41
- name : " Run HLint"
43
- uses : haskell/ actions/hlint-run@v2
42
+ uses : haskell- actions/hlint-run@v2
44
43
with :
45
44
path : ' ["src/", "test/", "examples"]'
46
45
fail-on : warning
@@ -51,57 +50,70 @@ jobs:
51
50
needs : ormolu
52
51
strategy :
53
52
matrix :
54
- os : [ubuntu-latest, windows-latest] # Removed macos-latest due to cert issues.
53
+ os : [ubuntu-latest, windows-latest, macos-latest]
55
54
cabal : ["3.8", "latest"]
56
55
ghc :
57
56
- " 9.6"
58
57
- " 9.4"
59
58
- " 9.2"
60
59
- " 9.0"
61
60
- " 8.10"
62
- # exclude:
63
- # - os: windows-latest
64
- # ghc: "9.4"
65
- # cabal: "3.6"
61
+ exclude :
62
+ - os : macos-latest
63
+ ghc : " 8.10"
64
+ - os : macos-latest
65
+ ghc : " 9.0"
66
+ # Cabal 3.8 supports GHC < 9.6
67
+ - cabal : " 3.8"
68
+ ghc : " 9.6"
66
69
67
70
steps :
68
71
- uses : actions/checkout@v4
69
72
if : github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
70
73
71
- - uses : haskell/ actions/setup@v2
72
- id : setup-haskell-cabal
74
+ - uses : haskell- actions/setup@v2
75
+ id : setup
73
76
name : Setup Haskell
74
77
with :
75
78
ghc-version : ${{ matrix.ghc }}
76
79
cabal-version : ${{ matrix.cabal }}
80
+ cabal-update : true
77
81
78
82
- name : Configure
79
83
run : |
80
- cabal configure --enable-tests --enable-benchmarks --test-show-details=direct -fexamples -fdev -flive-test
84
+ cabal configure --enable-tests --enable-benchmarks --test-show-details=direct -fexamples -fdev -flive-test
85
+ cabal build all --dry-run
86
+ # The last step generates dist-newstyle/cache/plan.json for the cache key.
81
87
82
- - name : Freeze
83
- run : |
84
- cabal freeze
85
-
86
- - uses : actions/cache@v3
87
- name : Cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle
88
+ - name : Restore cached dependencies
89
+ uses : actions/cache/restore@v4
90
+ id : cache
91
+ env :
92
+ key : ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
88
93
with :
89
- path : |
90
- ~/.cabal/packages
91
- ~/.cabal/store
92
- dist-newstyle
93
- key : ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal', '**/cabal.project', '**/cabal.project.freeze') }}
94
- restore-keys : ${{ runner.os }}-${{ matrix.ghc }}-
94
+ path : ${{ steps.setup.outputs.cabal-store }}
95
+ key : ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
96
+ restore-keys : ${{ env.key }}-
95
97
96
98
- name : Install dependencies
97
- run : |
98
- cabal build --only-dependencies
99
+ # If we had an exact cache hit, the dependencies will be up to date.
100
+ if : steps.cache.outputs.cache-hit != 'true'
101
+ run : cabal build all --only-dependencies
102
+
103
+ # Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
104
+ - name : Save cached dependencies
105
+ uses : actions/cache/save@v4
106
+ # If we had an exact cache hit, trying to save the cache would error because of key clash.
107
+ if : steps.cache.outputs.cache-hit != 'true'
108
+ with :
109
+ path : ${{ steps.setup.outputs.cabal-store }}
110
+ key : ${{ steps.cache.outputs.cache-primary-key }}
99
111
100
112
- name : Build
101
113
run : |
102
- cabal build
114
+ cabal build all
103
115
104
- - name : Setup MinIO for testing (Linux)
116
+ - name : Setup TLS certs for MinIO for testing (Linux)
105
117
if : matrix.os == 'ubuntu-latest'
106
118
run : |
107
119
mkdir -p /tmp/minio /tmp/minio-config/certs
@@ -110,13 +122,14 @@ jobs:
110
122
sudo cp /tmp/minio-config/certs/public.crt /usr/local/share/ca-certificates/
111
123
sudo update-ca-certificates
112
124
113
- - name : Setup MinIO for testing (MacOS)
125
+ # # Currently disable TLS setup for MacOS due to issues in trusting it on MacOS.
126
+ - name : Setup TLS certs for MinIO for testing (MacOS)
114
127
if : matrix.os == 'macos-latest'
115
128
run : |
116
129
mkdir -p /tmp/minio /tmp/minio-config/certs
117
130
cp test/cert/* /tmp/minio-config/certs/
118
131
(cd /tmp/minio; wget -q https://dl.min.io/server/minio/release/darwin-amd64/minio; chmod +x ./minio)
119
- sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /tmp/minio-config/certs/public.crt
132
+ # sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /tmp/minio-config/certs/public.crt
120
133
121
134
- name : Setup MinIO for testing (Windows)
122
135
if : matrix.os == 'windows-latest'
@@ -126,25 +139,42 @@ jobs:
126
139
Invoke-WebRequest -Uri https://dl.minio.io/server/minio/release/windows-amd64/minio.exe -OutFile $HOME/minio.exe
127
140
Import-Certificate -FilePath "$env:temp/minio-config/certs/public.crt" -CertStoreLocation Cert:\LocalMachine\Root
128
141
129
- - name : Test (Non-Windows)
130
- if : matrix.os != 'windows-latest'
142
+ - name : Test (Linux)
143
+ if : matrix.os == 'ubuntu-latest'
144
+ env :
145
+ MINIO_SECURE : 1
131
146
run : |
132
147
/tmp/minio/minio server --quiet --certs-dir /tmp/minio-config/certs data1 data2 data3 data4 2>&1 > minio.log &
133
148
ghc --version
134
149
cabal --version
135
- cabal test
150
+ cabal test all
151
+
152
+ - name : Test (MacOS)
153
+ if : matrix.os == 'macos-latest'
154
+ # # Leave MINIO_SECURE unset to disable TLS in tests.
155
+ # env:
156
+ # MINIO_SECURE: 1
157
+ run : |
158
+ /tmp/minio/minio server --quiet data1 data2 data3 data4 2>&1 > minio.log &
159
+ ghc --version
160
+ cabal --version
161
+ cabal test all
136
162
137
163
- name : Test (Windows)
138
164
if : matrix.os == 'windows-latest'
165
+ env :
166
+ MINIO_SECURE : 1
139
167
run : |
140
168
Start-Process -NoNewWindow -FilePath "$HOME/minio.exe" -ArgumentList "--certs-dir", "$env:temp/minio-config/certs", "server", "$env:temp/data1", "$env:temp/data2", "$env:temp/data3", "$env:temp/data4"
141
169
ghc --version
142
170
cabal --version
143
- cabal test
171
+ cabal test all
144
172
145
173
stack :
146
174
name : stack / ghc ${{ matrix.ghc }}
147
175
runs-on : ${{ matrix.os }}
176
+ env :
177
+ MINIO_SECURE : 1
148
178
strategy :
149
179
matrix :
150
180
ghc :
@@ -159,14 +189,13 @@ jobs:
159
189
- uses : actions/checkout@v4
160
190
if : github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
161
191
162
- - name : Install Haskell Stack
163
- run : |
164
- if ! which stack
165
- then
166
- curl -sSL https://get.haskellstack.org/ | sh
167
- fi
192
+ - uses : haskell-actions/setup@v2
193
+ with :
194
+ ghc-version : ${{ matrix.ghc }}
195
+ enable-stack : true
196
+ stack-version : " latest"
168
197
169
- - uses : actions/cache@v3
198
+ - uses : actions/cache@v4
170
199
name : Cache ~/.stack
171
200
with :
172
201
path : ~/.stack
0 commit comments