1
+ # SPDX-License-Identifier: MPL-2.0
1
2
name : CI for meson build
2
3
3
4
on :
40
41
release_extension : " .zip" ,
41
42
archive_command : " 7z a -tzip -mmt"
42
43
}
44
+ - {
45
+ name : " Windows MSVC ARM64" ,
46
+ os : windows-latest,
47
+ cc : " cl.exe" ,
48
+ cxx : " cl.exe" ,
49
+ arch : " x64_arm64" ,
50
+ publish_release : true,
51
+ meson_opts : " -Db_vscrt=static_from_buildtype --cross-file=./meson_crosscompile/msvc_arm64.txt" ,
52
+ release_name : " win-ARM64" ,
53
+ release_extension : " .zip" ,
54
+ archive_command : " 7z a -tzip -mmt"
55
+ }
43
56
- {
44
57
name : " Windows GCC" ,
45
58
os : windows-latest,
54
67
os : windows-latest,
55
68
cc : " clang.exe" ,
56
69
cxx : " clang++.exe" ,
70
+ meson_opts : " --native-file=./meson_crosscompile/Windows-Clang.txt" ,
57
71
release_name : " win-x86_64-clang" ,
58
72
release_extension : " .zip" ,
59
73
archive_command : " 7z a -tzip -mmt"
@@ -76,24 +90,13 @@ jobs:
76
90
release_extension : " .tar.xz" ,
77
91
archive_command : " tar cvfJ"
78
92
}
79
- - {
80
- name : " Manylinux GCC" ,
81
- os : ubuntu-latest,
82
- image : " quay.io/pypa/manylinux2014_x86_64" ,
83
- cc : " gcc" ,
84
- cxx : " g++" ,
85
- publish_release : true,
86
- create_package : true,
87
- release_name : " linux-x86_64-manylinux" ,
88
- release_extension : " .tar.xz" ,
89
- archive_command : " tar cvfJ"
90
- }
91
93
- {
92
94
name : " MUSL Cross Compile x86_64" ,
93
95
os : ubuntu-latest,
94
96
cc : " " ,
95
97
cxx : " " ,
96
98
publish_release : true,
99
+ create_package : true,
97
100
meson_opts : " --cross-file=./meson_crosscompile/x86_64-linux-musl-cross.txt" ,
98
101
cross_compiler_arch : " x86_64" ,
99
102
release_name : " linux-x86_64-portable" ,
@@ -184,9 +187,24 @@ jobs:
184
187
release_extension : " .tar.xz" ,
185
188
archive_command : " tar cvfJ"
186
189
}
190
+ outputs : # where hashes need to be stored for slsa provenance
191
+ # NOTE: Only doing this for builds with "publish_release: true"
192
+ # format is hash-${{release_name}} for the zipped packages
193
+ #
194
+ hash-win-x64 : ${{ steps.hash.outputs.hash-win-x64 }}
195
+ hash-win-x86 : ${{ steps.hash.outputs.hash-win-x86 }}
196
+ hash-win-ARM64 : ${{ steps.hash.outputs.hash-win-ARM64 }}
197
+ hash-linux-x86_64-portable : ${{ steps.hash.outputs.hash-linux-x86_64-portable }}
198
+ hash-linux-i686-portable : ${{ steps.hash.outputs.hash-linux-i686-portable }}
199
+ hash-linux-aarch64-portable : ${{ steps.hash.outputs.hash-linux-aarch64-portable }}
200
+ hash-linux-armv7l-portable : ${{ steps.hash.outputs.hash-linux-armv7l-portable }}
201
+ hash-linux-armv6-portable : ${{ steps.hash.outputs.hash-linux-armv6-portable }}
202
+ hash-linux-armv5l-portable : ${{ steps.hash.outputs.hash-linux-armv5l-portable }}
203
+ hash-linux-powerpc64-portable : ${{ steps.hash.outputs.hash-linux-powerpc64-portable }}
204
+ hash-linux-powerpc64le-portable : ${{ steps.hash.outputs.hash-linux-powerpc64le-portable }}
187
205
188
206
steps :
189
- - uses : actions/checkout@v3
207
+ - uses : actions/checkout@v4
190
208
with :
191
209
submodules : recursive
192
210
@@ -210,7 +228,7 @@ jobs:
210
228
- name : Restore LLVM from cache
211
229
if : startsWith(matrix.config.name, 'Windows Clang')
212
230
id : llvm-cache
213
- uses : actions/cache@v3
231
+ uses : actions/cache@v4
214
232
with :
215
233
path : C:/Program Files/LLVM
216
234
key : ' llvm-llvm-project-relid-${{ env.LLVM_RELID }}'
@@ -222,13 +240,6 @@ jobs:
222
240
Invoke-WebRequest -Headers $headers -OutFile "LLVM.exe" ((Invoke-WebRequest -Headers $headers "https://api.github.com/repos/llvm/llvm-project/releases/$($env:LLVM_RELID)").Content | ConvertFrom-Json | Select-Object -ExpandProperty assets | Where -Property name -Like "*win64.exe" | Select-Object -First 1).browser_download_url
223
241
7z x LLVM.exe -y -o"C:/Program Files/LLVM"
224
242
225
- - name : Setup toolchain for Manylinux
226
- if : ${{ matrix.config.image == 'quay.io/pypa/manylinux2014_x86_64' }}
227
- shell : bash
228
- run : |
229
- if [[ ${{ matrix.config.cc }} == "clang" ]] ; then yum install -y clang compat-gcc-44 ; fi
230
- echo "/opt/python/cp310-cp310/bin" >> $GITHUB_PATH
231
-
232
243
- name : Escape backslash in branch name
233
244
shell : bash
234
245
run : echo "BRANCH_NAME=$(echo ${{ github.ref_name }} | tr / -)" >> $GITHUB_ENV
@@ -245,7 +256,7 @@ jobs:
245
256
CC : ${{ matrix.config.cc }}
246
257
CXX : ${{ matrix.config.cxx }}
247
258
run : |
248
- pip install meson==0.60.3 ninja
259
+ pip install meson ninja
249
260
meson setup build -Dprefix=/ -Dmandir=/man -Dbindir=/ ${{ matrix.config.meson_opts }} --buildtype=release
250
261
meson install -C build
251
262
@@ -258,16 +269,17 @@ jobs:
258
269
shell : bash
259
270
260
271
# add `GOBIN` to the `PATH` otherwise nfpm in next step can't be found
261
- - uses : actions/setup-go@v3
272
+ - uses : actions/setup-go@v5
262
273
if : ${{ matrix.config.create_package }}
263
274
with :
264
275
go-version : ' stable'
276
+ cache : false
265
277
266
278
- name : Create packages
267
279
if : ${{ matrix.config.create_package }}
268
280
working-directory : ${{ format('build/{0}', env.DESTDIR) }}
269
281
run : | # https://nfpm.goreleaser.com/install/
270
- go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.22.2
282
+ go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.36.1
271
283
if [[ ${{ github.ref }} =~ ^refs/tags/v[0-9\.]+$ ]]; then
272
284
version=$(echo ${{ github.ref_name }} | tr -d 'v')
273
285
else
@@ -278,19 +290,61 @@ jobs:
278
290
nfpm package -f ../../nfpm.yaml -p rpm -t ..
279
291
shell : bash
280
292
293
+ - name : Generate Hashes
294
+ if : ${{ matrix.config.publish_release }}
295
+ shell : bash
296
+ id : hash
297
+ run : |
298
+ # sha256sum generates sha256 hash for all artifacts.
299
+ # base64 -w0 encodes to base64 and outputs on a single line.
300
+ # sha256sum artifact | base64 -w0
301
+ # NOTE: Using suggested method to generate sha across OS's from slsa documentation
302
+ # https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/generic/README.md#provenance-for-artifacts-built-across-multiple-operating-systems
303
+ set -euo pipefail
304
+ (sha256sum -t ${{ format('./build/{0}{1}', env.DESTDIR, matrix.config.release_extension) }} || shasum -a 256 ${{ format('./build/{0}{1}', env.DESTDIR, matrix.config.release_extension) }}) > checksum
305
+ echo "hash-${{ matrix.config.release_name }}=$(base64 -w0 checksum || base64 checksum)" >> "${GITHUB_OUTPUT}"
306
+
281
307
- name : Uploading artifacts
282
- uses : actions/upload-artifact@v3
308
+ uses : actions/upload-artifact@v4
283
309
with :
310
+ name : ${{ format('{0}', matrix.config.release_name) }}
284
311
path : |
285
312
${{ format('./build/{0}{1}', env.DESTDIR, matrix.config.release_extension) }}
286
313
build/*.deb
287
314
build/*.rpm
288
315
289
316
- name : Publish release
290
317
if : ${{ startsWith(github.ref, 'refs/tags/v') && matrix.config.publish_release }}
291
- uses : softprops/action-gh-release@v1
318
+ uses : softprops/action-gh-release@v2
292
319
with :
293
320
files : |
294
321
${{ format('./build/{0}{1}', env.DESTDIR, matrix.config.release_extension) }}
295
322
build/*.deb
296
323
build/*.rpm
324
+
325
+ # This step takes all the generated hashes from all build targets and combines them so slsa provenance step can run
326
+ combine_hashes :
327
+ runs-on : ubuntu-latest
328
+ needs : [build]
329
+ outputs :
330
+ hashes : ${{ steps.hashes.outputs.hashes }}
331
+ env :
332
+ HASHES : ${{ toJSON(needs.build.outputs) }}
333
+ steps :
334
+ - id : hashes
335
+ run : |
336
+ echo "$HASHES"
337
+ echo "$HASHES" | jq -r '.[] | @base64d' | sed "/^$/d" > hashes.txt
338
+ echo "hashes=$(cat hashes.txt | base64 -w0)" >> "$GITHUB_OUTPUT"
339
+
340
+ # Generate the slsa provenance
341
+ provenance :
342
+ needs : [combine_hashes]
343
+ permissions :
344
+ actions : read # To read the workflow path.
345
+ id-token : write # To sign the provenance.
346
+ contents : write # To add assets to a release.
347
+ uses : slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
348
+ with :
349
+ base64-subjects : " ${{ needs.combine_hashes.outputs.hashes }}"
350
+ upload-assets : true # Optional: Upload to a new release
0 commit comments