17
17
build :
18
18
runs-on : ${{ matrix.os }}
19
19
20
- defaults :
21
- run :
22
- shell : bash
23
-
24
20
strategy :
25
21
fail-fast : false
26
22
matrix :
@@ -40,40 +36,38 @@ jobs:
40
36
41
37
steps :
42
38
- name : " View pkg-config"
43
- run : |
44
- echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
45
-
46
- - name : " LINUX,MAC: Setup haskell"
47
- if : runner.os != 'Windows'
48
- uses : haskell/actions/setup@v1
49
- id : setup-haskell
50
- with :
51
- ghc-version : ${{ matrix.ghc }}
52
- cabal-version : 3.8.1.0
39
+ run : echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
53
40
54
- - name : " WIN: Install ghcup"
55
- shell : pwsh
41
+ - name : " WIN: Install System Dependencies via pacman (msys2)"
56
42
if : runner.os == 'Windows'
57
43
run : |
58
- # ghcup should be installed on current GHA Windows runners. Let's use ghcup to run
59
- # pacman, to install the necessary dependencies, ...
60
- ghcup run -- pacman --noconfirm -S `
61
- mingw-w64-x86_64-pkg-config `
62
- mingw-w64-x86_64-libsodium `
63
- base-devel `
64
- autoconf-wrapper `
65
- autoconf `
66
- automake `
67
- libtool `
68
- make `
69
- openssl-devel
70
-
71
- # ... and also the ghc and cabal combination we want.
44
+ # ghcup should be installed on current GHA Windows runners. Let's use ghcup to run
45
+ # pacman, to install the necessary dependencies, ...
46
+ ghcup run -- pacman --noconfirm -S `
47
+ mingw-w64-x86_64-pkg-config `
48
+ mingw-w64-x86_64-libsodium `
49
+ base-devel `
50
+ autoconf-wrapper `
51
+ autoconf `
52
+ automake `
53
+ libtool `
54
+ make
55
+
56
+ # this seems to break something. It _must_ come after the pacman setup
57
+ # above. It appears as if PATHEXT is set _after_ ghcup install ghc/cabal, and
58
+ # as such we'd need pacman.exe instead.
59
+ - name : Setup Haskell
60
+ run : |
61
+ # Use GHCUP to manage ghc/cabal
72
62
ghcup install ghc --set ${{ matrix.ghc }}
73
63
ghcup install cabal --set 3.6.2.0
74
64
75
65
ghc --version
76
66
cabal --version
67
+
68
+ - name : " WIN: fixup cabal config"
69
+ if : runner.os == 'Windows'
70
+ run : |
77
71
# make sure cabal knows about msys64, and mingw64 tools. Not clear why C:/cabal/config is empty
78
72
# and C:/cabal doesn't even exist. The ghcup bootstrap file should have create it in the image:
79
73
# See https://github.com/haskell/ghcup-hs/blob/787edc17af4907dbc51c85e25c490edd8d68b80b/scripts/bootstrap/bootstrap-haskell#L591
@@ -97,29 +91,30 @@ jobs:
97
91
run : |
98
92
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
99
93
100
- - name : " OUTPUT Record cabal-store"
94
+ - name : " OUTPUT Record cabal-store (Linux)"
95
+ id : lin-setup-haskell
96
+ if : runner.os != 'Windows'
97
+ run : echo "cabal-store=/home/runner/.cabal/store" >> $GITHUB_OUTPUT
98
+
99
+ - name : " OUTPUT Record cabal-store (Windows)"
101
100
id : win-setup-haskell
102
- shell : bash
103
101
if : runner.os == 'Windows'
104
- run : echo "cabal-store=$(dirname $(cabal --help | tail -1 | tr -d ' '))\\store" >> $GITHUB_OUTPUT
102
+ shell : bash
103
+ run : echo "cabal-store=C:\\cabal\\store" >> $GITHUB_OUTPUT
105
104
106
105
- name : Set cache version
107
106
run : echo "CACHE_VERSION=grFfw8r" >> $GITHUB_ENV
108
107
109
108
- uses : actions/checkout@v2
110
109
111
- - name : Add build script path
112
- shell : bash
113
- run : |
114
- touch ~/.bashrc
115
- if [ "${{ runner.os }}" == "Windows" ]; then
116
- # MSYS2 doesn't inherit $GITHUB_PATH, so this workaround is needed
117
- cat <(echo "export PATH=$PATH:$(pwd)/.github/bin") ~/.bashrc > ~/.bashrc.new
118
- mv ~/.bashrc.new ~/.bashrc
119
- else
120
- # MacOS and Linux use $GITUB_PATH
121
- echo "$(pwd)/.github/bin" >> $GITHUB_PATH
122
- fi
110
+ - name : " [PowerShell] Add build script path"
111
+ if : runner.os == 'Windows'
112
+ shell : pwsh
113
+ run : Add-Content $env:GITHUB_PATH "$(pwd)/.github/bin"
114
+
115
+ - name : " [Bash] Add build script path"
116
+ if : runner.os != 'Windows'
117
+ run : echo "$(pwd)/.github/bin" >> $GITHUB_PATH
123
118
124
119
- name : " LINUX: Install build environment (apt-get)"
125
120
if : runner.os == 'Linux'
@@ -169,6 +164,7 @@ jobs:
169
164
run : cabal update
170
165
171
166
- name : Configure build
167
+ shell : bash
172
168
run : |
173
169
if [ "${{github.event.inputs.tests}}" == "all" ]; then
174
170
echo "Reconfigure cabal projects to run tests for all dependencies"
@@ -180,14 +176,18 @@ jobs:
180
176
echo "# cabal.project.local"
181
177
cat cabal.project.local
182
178
183
- - name : Record dependencies
184
- id : record-deps
179
+ - name : Update pkg-config paths
180
+ if : runner.os != 'Windows'
185
181
run : |
186
182
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
187
183
export PKG_CONFIG_PATH="/usr/lib/pkgconfig:$PKG_CONFIG_PATH"
188
184
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
185
+
186
+ - name : Record dependencies
187
+ id : record-deps
188
+ run : |
189
189
cabal build all --dry-run
190
- cat ${{ env.PLAN_JSON }} | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt
190
+ cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt
191
191
192
192
- name : " OUTPUT Record weeknum"
193
193
shell : bash
@@ -196,7 +196,7 @@ jobs:
196
196
- name : Cache Cabal store
197
197
uses : actions/cache@v2
198
198
with :
199
- path : ${{ runner.os == 'Windows' && steps.win-setup-haskell.outputs.cabal-store || steps.setup-haskell.outputs.cabal-store }}
199
+ path : ${{ runner.os == 'Windows' && steps.win-setup-haskell.outputs.cabal-store || steps.lin- setup-haskell.outputs.cabal-store }}
200
200
key : cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}-${{ hashFiles('date.txt') }}
201
201
restore-keys : |
202
202
cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
@@ -213,27 +213,33 @@ jobs:
213
213
214
214
- name : Build
215
215
run : |
216
- echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
217
- export PKG_CONFIG_PATH="/usr/lib/pkgconfig:$PKG_CONFIG_PATH"
218
- echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
216
+ env | grep PKG_CONFIG_PATH
219
217
cabal build cardano-node cardano-cli cardano-node-chairman cardano-submit-api
220
218
219
+ - name : Run tests (all)
220
+ if : github.event.inputs.tests == "all"
221
+ env :
222
+ TMPDIR : ${{ runner.temp }}
223
+ TMP : ${{ runner.temp }}
224
+ KEEP_WORKSPACE : 1
225
+ run : cabal test all
226
+
221
227
- name : Run tests
222
- run : |
223
- if [ "${{github.event.inputs.tests}}" == "all" ]; then
224
- TMPDIR="${{ runner.temp }}" TMP="${{ runner.temp }}" KEEP_WORKSPACE=1 cabal test all;
225
- else
226
- TMPDIR="${{ runner.temp }}" TMP="${{ runner.temp }}" KEEP_WORKSPACE=1 cabal test \
228
+ if : github.event.inputs.tests != "all"
229
+ env :
230
+ TMPDIR : ${{ runner.temp }}
231
+ TMP : ${{ runner.temp }}
232
+ KEEP_WORKSPACE : 1
233
+ run : cabal test \
227
234
cardano-testnet \
228
235
cardano-api \
229
236
cardano-node \
230
237
cardano-node-chairman \
231
238
cardano-cli \
232
239
cardano-submit-api
233
- fi
234
-
235
240
236
241
- name : " Tar artifacts"
242
+ shell : bash
237
243
run : |
238
244
mkdir -p artifacts
239
245
@@ -258,6 +264,7 @@ jobs:
258
264
259
265
- name : Delete socket files in chairman tests in preparation for uploading artifacts
260
266
if : ${{ always() }}
267
+ shell : bash
261
268
run : |
262
269
if [ -d "${{ runner.temp }}/chairman" ]; then
263
270
find "${{ runner.temp }}/chairman" -type s -exec rm -f {} \;
@@ -275,9 +282,9 @@ jobs:
275
282
# `/msys2/mingw64` paths are not in PATH by default for the workflow, but tmate
276
283
# will put them in.
277
284
#
278
- # - name: Setup tmate session
279
- # if: ${{ matrix.os == 'windows-latest' }}
280
- # uses: mxschmitt/action-tmate@v3
285
+ - name : Setup tmate session
286
+ if : ${{ failure() }}
287
+ uses : mxschmitt/action-tmate@v3
281
288
282
289
release :
283
290
needs : [build]
0 commit comments