@@ -4,7 +4,7 @@ name: CI for meson build
4
4
on :
5
5
push :
6
6
branches : [ develop, master, release/*, feature/*, hotfix/* ]
7
- tags : [ v* ]
7
+ tags : [ v*, test-ci* ]
8
8
pull_request :
9
9
branches : [ develop ]
10
10
67
67
os : windows-latest,
68
68
cc : " clang.exe" ,
69
69
cxx : " clang++.exe" ,
70
- meson_opts : " --native-file=./meson_crosscompile/Windows-Clang.txt" ,
70
+ meson_opts : " --native-file=./meson_crosscompile/Windows-Clang.txt -Db_pie=false " ,
71
71
release_name : " win-x86_64-clang" ,
72
72
release_extension : " .zip" ,
73
73
archive_command : " 7z a -tzip -mmt"
@@ -101,7 +101,8 @@ jobs:
101
101
cross_compiler_arch : " x86_64" ,
102
102
release_name : " linux-x86_64-portable" ,
103
103
release_extension : " .tar.xz" ,
104
- archive_command : " tar cvfJ"
104
+ archive_command : " tar cvfJ" ,
105
+ image : " vonericsen/muslcc@sha256:04b60fc27f45b69896855da46f5be09fa9816b00e9948bf86cc82e56b8ce4468"
105
106
}
106
107
- {
107
108
name : " MUSL Cross Compile i686" ,
@@ -113,7 +114,8 @@ jobs:
113
114
cross_compiler_arch : " i686" ,
114
115
release_name : " linux-i686-portable" ,
115
116
release_extension : " .tar.xz" ,
116
- archive_command : " tar cvfJ"
117
+ archive_command : " tar cvfJ" ,
118
+ image : " vonericsen/muslcc@sha256:04b60fc27f45b69896855da46f5be09fa9816b00e9948bf86cc82e56b8ce4468"
117
119
}
118
120
- {
119
121
name : " MUSL Cross Compile aarch64" ,
@@ -125,7 +127,8 @@ jobs:
125
127
cross_compiler_arch : " aarch64" ,
126
128
release_name : " linux-aarch64-portable" ,
127
129
release_extension : " .tar.xz" ,
128
- archive_command : " tar cvfJ"
130
+ archive_command : " tar cvfJ" ,
131
+ image : " vonericsen/muslcc@sha256:04b60fc27f45b69896855da46f5be09fa9816b00e9948bf86cc82e56b8ce4468"
129
132
}
130
133
- {
131
134
name : " MUSL Cross Compile armv7l" ,
@@ -137,7 +140,8 @@ jobs:
137
140
cross_compiler_arch : " armv7l" ,
138
141
release_name : " linux-armv7l-portable" ,
139
142
release_extension : " .tar.xz" ,
140
- archive_command : " tar cvfJ"
143
+ archive_command : " tar cvfJ" ,
144
+ image : " vonericsen/muslcc@sha256:04b60fc27f45b69896855da46f5be09fa9816b00e9948bf86cc82e56b8ce4468"
141
145
}
142
146
- {
143
147
name : " MUSL Cross Compile armv6" ,
@@ -149,7 +153,8 @@ jobs:
149
153
cross_compiler_arch : " armv6" ,
150
154
release_name : " linux-armv6-portable" ,
151
155
release_extension : " .tar.xz" ,
152
- archive_command : " tar cvfJ"
156
+ archive_command : " tar cvfJ" ,
157
+ image : " vonericsen/muslcc@sha256:04b60fc27f45b69896855da46f5be09fa9816b00e9948bf86cc82e56b8ce4468"
153
158
}
154
159
- {
155
160
name : " MUSL Cross Compile armv5l" ,
@@ -161,7 +166,8 @@ jobs:
161
166
cross_compiler_arch : " armv5l" ,
162
167
release_name : " linux-armv5l-portable" ,
163
168
release_extension : " .tar.xz" ,
164
- archive_command : " tar cvfJ"
169
+ archive_command : " tar cvfJ" ,
170
+ image : " vonericsen/muslcc@sha256:04b60fc27f45b69896855da46f5be09fa9816b00e9948bf86cc82e56b8ce4468"
165
171
}
166
172
- {
167
173
name : " MUSL Cross Compile powerpc64" ,
@@ -173,7 +179,8 @@ jobs:
173
179
cross_compiler_arch : " powerpc64" ,
174
180
release_name : " linux-powerpc64-portable" ,
175
181
release_extension : " .tar.xz" ,
176
- archive_command : " tar cvfJ"
182
+ archive_command : " tar cvfJ" ,
183
+ image : " vonericsen/muslcc@sha256:04b60fc27f45b69896855da46f5be09fa9816b00e9948bf86cc82e56b8ce4468"
177
184
}
178
185
- {
179
186
name : " MUSL Cross Compile powerpc64le" ,
@@ -185,7 +192,8 @@ jobs:
185
192
cross_compiler_arch : " powerpc64le" ,
186
193
release_name : " linux-powerpc64le-portable" ,
187
194
release_extension : " .tar.xz" ,
188
- archive_command : " tar cvfJ"
195
+ archive_command : " tar cvfJ" ,
196
+ image : " vonericsen/muslcc@sha256:04b60fc27f45b69896855da46f5be09fa9816b00e9948bf86cc82e56b8ce4468"
189
197
}
190
198
outputs : # where hashes need to be stored for slsa provenance
191
199
# NOTE: Only doing this for builds with "publish_release: true"
@@ -214,16 +222,39 @@ jobs:
214
222
with :
215
223
arch : ${{ matrix.config.arch }}
216
224
217
- - name : Setup for MUSL Cross Compilation
218
- if : startsWith(matrix.config.name, 'MUSL Cross Compile')
219
- run : |
220
- sudo ./meson_crosscompile/install-muslcc.sh -a ${{ matrix.config.cross_compiler_arch }}
221
-
222
225
- name : Get latest LLVM version
223
226
if : startsWith(matrix.config.name, 'Windows Clang')
224
227
run : |
225
228
$headers = @{ Authorization = 'Bearer ${{ secrets.GITHUB_TOKEN }}' }
226
- echo "LLVM_RELID=$((Invoke-WebRequest -Headers $headers 'https://api.github.com/repos/llvm/llvm-project/releases/latest').Content | ConvertFrom-Json | Select-Object -ExpandProperty id)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
229
+ $latestRelease = Invoke-WebRequest -Headers $headers 'https://api.github.com/repos/llvm/llvm-project/releases/latest'
230
+ $releaseData = $latestRelease.Content | ConvertFrom-Json
231
+ $assets = $releaseData.assets | Where-Object { $_.name -like "*win64.exe" }
232
+
233
+ if ($assets) {
234
+ $downloadUrl = $assets.browser_download_url
235
+ echo "LLVM_RELID=$($releaseData.id)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
236
+ echo "LLVM_DOWNLOAD_URL=$downloadUrl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
237
+ } else {
238
+ Write-Host "No current Windows build available for the latest release. Searching for previous releases..."
239
+ $releases = Invoke-WebRequest -Headers $headers 'https://api.github.com/repos/llvm/llvm-project/releases'
240
+ $found = $false
241
+
242
+ foreach ($release in $releases.Content | ConvertFrom-Json) {
243
+ $assets = $release.assets | Where-Object { $_.name -like "*win64.exe" }
244
+ if ($assets) {
245
+ $downloadUrl = $assets.browser_download_url
246
+ echo "LLVM_RELID=$($release.id)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
247
+ echo "LLVM_DOWNLOAD_URL=$downloadUrl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
248
+ $found = $true
249
+ break
250
+ }
251
+ }
252
+
253
+ if (-not $found) {
254
+ Write-Host "No Windows build available for any recent releases."
255
+ exit 0
256
+ }
257
+ }
227
258
228
259
- name : Restore LLVM from cache
229
260
if : startsWith(matrix.config.name, 'Windows Clang')
@@ -251,7 +282,15 @@ jobs:
251
282
echo "DESTDIR=${DESTDIR}" >> $GITHUB_ENV
252
283
shell : bash
253
284
254
- - name : Configuring and compiling with meson
285
+ - name : Install Meson and Ninja and Build (MUSL container)
286
+ if : matrix.config.image != ''
287
+ run : |
288
+ meson setup build -Dprefix=/ -Dmandir=/man -Dbindir=/ ${{ matrix.config.meson_opts }} --buildtype=release
289
+ meson install -C build
290
+
291
+
292
+ - name : Install Meson and Ninja and Build (Github runners)
293
+ if : matrix.config.image == ''
255
294
env :
256
295
CC : ${{ matrix.config.cc }}
257
296
CXX : ${{ matrix.config.cxx }}
@@ -260,14 +299,6 @@ jobs:
260
299
meson setup build -Dprefix=/ -Dmandir=/man -Dbindir=/ ${{ matrix.config.meson_opts }} --buildtype=release
261
300
meson install -C build
262
301
263
- - name : Packing release
264
- env :
265
- ARCHIVE_EXT : ${{ matrix.config.release_extension }}
266
- run : |
267
- cd build
268
- ${{ matrix.config.archive_command }} "${DESTDIR}${ARCHIVE_EXT}" $DESTDIR
269
- shell : bash
270
-
271
302
# add `GOBIN` to the `PATH` otherwise nfpm in next step can't be found
272
303
- uses : actions/setup-go@v5
273
304
if : ${{ matrix.config.create_package }}
@@ -290,6 +321,41 @@ jobs:
290
321
nfpm package -f ../../nfpm.yaml -p rpm -t ..
291
322
shell : bash
292
323
324
+ - name : Set ownership of executables to root:root
325
+ if : ${{ matrix.config.os != 'windows-latest' }}
326
+ run : |
327
+ if [[ -z "${{ matrix.config.image }}" ]]; then
328
+ sudo chown -R root:root build
329
+ else
330
+ chown -R root:root build
331
+ fi
332
+
333
+ - name : Packing release
334
+ env :
335
+ ARCHIVE_EXT : ${{ matrix.config.release_extension }}
336
+ run : |
337
+ cd build
338
+ if [[ "${{ matrix.config.os }}" != "windows-latest" ]]; then
339
+ if [[ -z "${{ matrix.config.image }}" ]]; then
340
+ sudo ${{ matrix.config.archive_command }} "${DESTDIR}${ARCHIVE_EXT}" $DESTDIR
341
+ else
342
+ ${{ matrix.config.archive_command }} "${DESTDIR}${ARCHIVE_EXT}" $DESTDIR
343
+ fi
344
+ else
345
+ ${{ matrix.config.archive_command }} "${DESTDIR}${ARCHIVE_EXT}" $DESTDIR
346
+ fi
347
+ shell : bash
348
+
349
+ - name : Set ownership of tar archive to root:root
350
+ if : ${{ matrix.config.os != 'windows-latest' }}
351
+ run : |
352
+ if [[ -z "${{ matrix.config.image }}" ]]; then
353
+ sudo chown root:root build/"${DESTDIR}${ARCHIVE_EXT}"
354
+ else
355
+ chown root:root build/"${DESTDIR}${ARCHIVE_EXT}"
356
+ fi
357
+
358
+
293
359
- name : Generate Hashes
294
360
if : ${{ matrix.config.publish_release }}
295
361
shell : bash
@@ -314,7 +380,7 @@ jobs:
314
380
build/*.rpm
315
381
316
382
- name : Publish release
317
- if : ${{ startsWith(github.ref, 'refs/tags/v') && matrix.config.publish_release }}
383
+ if : ${{ ( startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/tags/test-ci') ) && matrix.config.publish_release }}
318
384
uses : softprops/action-gh-release@v2
319
385
with :
320
386
files : |
@@ -344,7 +410,7 @@ jobs:
344
410
actions : read # To read the workflow path.
345
411
id-token : write # To sign the provenance.
346
412
contents : write # To add assets to a release.
347
- uses : slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0 .0
413
+ uses : slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.1 .0
348
414
with :
349
415
base64-subjects : " ${{ needs.combine_hashes.outputs.hashes }}"
350
416
upload-assets : true # Optional: Upload to a new release
0 commit comments