@@ -61,41 +61,44 @@ jobs:
61
61
run : |
62
62
ARCHITECTURE=$(uname -m)
63
63
echo "ARCH=$ARCHITECTURE" >> $GITHUB_ENV
64
+ KERNEL=$(uname -s)
65
+ echo "KERNEL=$KERNEL" >> $GITHUB_ENV
66
+ echo "REPORT_NAME=report-$KERNEL-ghc-${{ matrix.ghc }}.xml" >> $GITHUB_ENV
64
67
echo ${{ env.ARCH }}
65
- cabal configure --enable-tests
68
+ echo "$GITHUB_WORKSPACE/distribution" >> "$GITHUB_PATH"
69
+ echo "REPORT_NAME=report-${{ matrix.os }}-ghc-${{ matrix.ghc }}.xml" >> $GITHUB_ENV
66
70
67
71
- name : Freeze
68
72
run : cabal freeze --project-file=cabal.release.project
69
73
70
74
- name : Cache
71
- uses : actions/cache@v4.0.2
75
+ uses : actions/cache@v4
72
76
with :
77
+ key : ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ hashFiles('**/plan.json') }}
73
78
path : ${{ steps.setup-haskell.outputs.cabal-store }}
74
- key : ${{ matrix.os }}-ghc-${{ matrix.ghc }}-${{ hashFiles('**/plan.json') }}
75
- restore-keys : ${{ matrix.os }}-ghc-${{ matrix.ghc }}-
79
+ restore-keys : ${{ runner.os }}-ghc-${{ matrix.ghc }}-
76
80
77
81
- name : Build
78
82
run : cabal build --project-file=cabal.release.project
79
83
80
- - name : Install
81
- run : |
82
- mkdir distribution
83
- for executable in 'print-api' 'print-api-${{ matrix.ghc }}'; do
84
- path=$(cabal -v0 --project-file=cabal.release.project list-bin "print-api:exe:${executable}")
85
- cp "${path}" distribution
86
- done
87
- echo "$GITHUB_WORKSPACE/distribution" >> "$GITHUB_PATH"
88
- echo "REPORT_NAME=report-${{ matrix.os }}-ghc-${{ matrix.ghc }}" >> $GITHUB_ENV
89
-
90
84
- name : Test
91
- run : cabal test --project-file=cabal.release.project --test-options "--xml=../print-api/${{ env.REPORT_NAME }}.xml" all
85
+ run : |
86
+ cabal test --project-file=cabal.release.project --test-options "--xml=../print-api/${{ env.REPORT_NAME }}" all
92
87
93
88
- name : Upload the test report
94
89
uses : actions/upload-artifact@v4
95
90
if : success() || failure() # always run even if the previous step fails
96
91
with :
97
92
name : ${{ env.REPORT_NAME }}
98
- path : ${{ env.REPORT_NAME }}.xml
93
+ path : ${{ env.REPORT_NAME }}
94
+
95
+ - name : Install
96
+ run : |
97
+ mkdir distribution
98
+ for executable in 'print-api' 'print-api-${{ matrix.ghc }}'; do
99
+ path=$(cabal -v0 --project-file=cabal.release.project list-bin "print-api:exe:${executable}")
100
+ cp -v "${path}" distribution
101
+ done
99
102
100
103
- name : File type
101
104
run : file distribution/*
@@ -112,17 +115,16 @@ jobs:
112
115
shell : bash
113
116
run : |
114
117
executables=( $(ls distribution) )
115
- version=$(./distribution/print-api --version)
116
- archive="print-api-${version}-${{ matrix.os }}-${{ env.ARCH }}-ghc-${{ matrix.ghc }}.tar.gz"
117
- tar -czvf "${archive}" -C distribution "${executables[@]}"
118
- echo "PRINTAPI_EXEC_TAR=${archive}" >> $GITHUB_ENV
119
- echo "ARTIFACT_NAME=artifact-${{ matrix.os }}-ghc-${{ matrix.ghc }}" >> $GITHUB_ENV
118
+ ARTIFACT_NAME=print-api-${{ env.KERNEL }}-ghc-${{ matrix.ghc }}
119
+ echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
120
+ ARCHIVE=${ARTIFACT_NAME}.tar.gz
121
+ tar -czvf "${ARCHIVE}" -C distribution "${executables[@]}"
120
122
121
123
- name : Upload the executables archive
122
124
uses : actions/upload-artifact@v4
123
125
with :
124
126
name : ${{ env.ARTIFACT_NAME }}
125
- path : ${{ env.PRINTAPI_EXEC_TAR }}
127
+ path : ${{ env.ARTIFACT_NAME }}.tar.gz
126
128
127
129
build-alpine :
128
130
name : ${{ matrix.ghc }} on alpine-3.20
@@ -153,7 +155,11 @@ jobs:
153
155
run : |
154
156
ARCHITECTURE=$(uname -m)
155
157
echo "ARCH=$ARCHITECTURE" >> $GITHUB_ENV
158
+ KERNEL=$(uname -s)
159
+ echo "KERNEL=$KERNEL" >> $GITHUB_ENV
160
+ echo "REPORT_NAME=report-$KERNEL-ghc-${{ matrix.ghc }}.xml" >> $GITHUB_ENV
156
161
echo ${{ env.ARCH }}
162
+ echo "$GITHUB_WORKSPACE/distribution" >> "$GITHUB_PATH"
157
163
cabal configure --enable-tests
158
164
159
165
- name : Freeze
@@ -177,15 +183,15 @@ jobs:
177
183
cp "${path}" distribution
178
184
done
179
185
echo "$GITHUB_WORKSPACE/distribution" >> "$GITHUB_PATH"
180
- echo "REPORT_NAME=report-alpine-3.20 -ghc-${{ matrix.ghc }}" >> $GITHUB_ENV
186
+ echo "REPORT_NAME=report-${{ env.KERNEL }}-static -ghc-${{ matrix.ghc }}" >> $GITHUB_ENV
181
187
182
188
- name : Test
183
189
run : cabal test --project-file=cabal.static.project --test-options "--xml=../print-api/${REPORT_NAME}.xml" all
184
190
185
191
- name : Upload the test report
186
192
uses : actions/upload-artifact@v4
187
193
if : success() || failure() # always run even if the previous step fails
188
- with :
194
+ with :
189
195
name : ${{ env.REPORT_NAME }}
190
196
path : ${{ env.REPORT_NAME }}.xml
191
197
@@ -204,21 +210,21 @@ jobs:
204
210
shell : bash
205
211
run : |
206
212
executables=( $(ls distribution) )
207
- version=$(./distribution/print-api --version)
208
- archive="print-api-${version}-alpine-3.20-${{ env.ARCH }}-static-ghc-${{ matrix.ghc }}.tar.gz"
209
- tar -c -z -v -f "${archive}" -C distribution "${executables[@]}"
210
- echo "PRINTAPI_EXEC_TAR=${archive}" >> $GITHUB_ENV
211
- echo "ARTIFACT_NAME=artifact-alpine-3.20-ghc-${{ matrix.ghc }}" >> $GITHUB_ENV
213
+ ARTIFACT_NAME=print-api-${{ env.KERNEL }}-static-ghc-${{ matrix.ghc }}
214
+ echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
215
+ ARCHIVE=${ARTIFACT_NAME}.tar.gz
216
+ tar -czvf "${ARCHIVE}" -C distribution "${executables[@]}"
212
217
213
- - name : Upload the executables archive
218
+ - name : Upload the get-tested executable
214
219
uses : actions/upload-artifact@v4
215
220
with :
216
221
name : ${{ env.ARTIFACT_NAME }}
217
- path : ${{ env.PRINTAPI_EXEC_TAR }}
222
+ path : ${{ env.ARTIFACT_NAME }}.tar.gz
218
223
219
224
collect-test-results :
220
225
name : Collect test results
221
226
runs-on : ubuntu-latest
227
+ if : ${{ always() }}
222
228
needs : ['builds', 'build-alpine']
223
229
steps :
224
230
- name : Install junitparser
@@ -229,12 +235,11 @@ jobs:
229
235
with :
230
236
pattern : report-*
231
237
merge-multiple : true
232
- workflow : ${{ github.event.workflow.id }}
233
- run-id : ${{ github.event.workflow_run.id }}
234
- github-token : ${{ secrets.GH_PAT }} # token with actions:read permissions on target repo
238
+
235
239
- name : Merge XML files
236
240
run : |
237
241
junitparser merge --glob *.xml final-report.xml
242
+
238
243
- name : Publish Test Report
239
244
uses : mikepenz/action-junit-report@v4
240
245
with :
@@ -244,12 +249,15 @@ jobs:
244
249
prerelease-head :
245
250
name : Create a GitHub prerelease with the binary artifacts
246
251
runs-on : ubuntu-latest
252
+ if : github.ref == 'refs/heads/main'
247
253
needs : ['builds', 'build-alpine']
254
+ permissions :
255
+ contents : write
248
256
249
257
steps :
250
258
- uses : actions/download-artifact@v4
251
259
with :
252
- pattern : artifact -*
260
+ pattern : print-api -*
253
261
merge-multiple : true
254
262
path : ./out
255
263
0 commit comments