Skip to content

Commit 51614ab

Browse files
committed
Updated CI workflows and supporting scripts/tools.
1 parent b774e5c commit 51614ab

File tree

5 files changed

+163
-133
lines changed

5 files changed

+163
-133
lines changed

.github/workflows/ClangSharp.Pathogen.yml

Lines changed: 42 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,25 @@ jobs:
2828
fail-fast: false
2929
matrix:
3030
include:
31-
- os: windows-2019
31+
- os: windows-2022
3232
name: Windows x64
3333
rid: win-x64
3434
libclang-subpath: bin/libclang.dll
3535
build-command: ./build-native.cmd
36-
# We use Ubuntu 18.04 so that the binary is usable on systems using glibc 2.27 and later
36+
# We use the oldest Ubuntu available so that the binary is usable on systems using older glibc
3737
# If we want to support even older versions we should explore building libclang with https://github.com/wheybags/glibc_version_header
38-
- os: ubuntu-18.04
38+
- os: ubuntu-22.04
3939
name: Linux x64
4040
rid: linux-x64
4141
libclang-subpath: lib/libclang.so
4242
build-command: ./build-native.sh
43-
- os: ubuntu-arm64-latest
43+
- os: ubuntu-22.04-arm
4444
name: Linux ARM64
4545
rid: linux-arm64
4646
libclang-subpath: lib/libclang.so
4747
build-command: ./build-native.sh
4848
skip-python-install: true
49-
- os: macos-12
49+
- os: macos-13
5050
name: macOS x64
5151
rid: osx-x64
5252
libclang-subpath: lib/libclang.dylib
@@ -58,14 +58,14 @@ jobs:
5858
- name: Checkout
5959
# We intentionally don't checkout submodules here
6060
# They will be restored as needed only if we need to build LLVM.
61-
uses: actions/checkout@v2
61+
uses: actions/checkout@v4
6262

6363
# ----------------------------------------------------------------------- Setup Python
64-
- name: Setup Python 3.8
64+
- name: Setup Python
6565
if: matrix.skip-python-install != true
66-
uses: actions/setup-python@v2
66+
uses: actions/setup-python@v5
6767
with:
68-
python-version: '3.8'
68+
python-version: '3.11'
6969

7070
# ----------------------------------------------------------------------- Get LLVM Revision
7171
- name: Get LLVM Revision
@@ -75,7 +75,7 @@ jobs:
7575
# ----------------------------------------------------------------------- Build LLVM
7676
- name: Load cached LLVM build outputs
7777
id: cached-llvm
78-
uses: actions/cache@v2
78+
uses: actions/cache@v4
7979
# If you change this configuration make sure to update keep-cache-warm.yml as well.
8080
with:
8181
key: llvm-output-${{matrix.rid}}-${{steps.llvm.outputs.revision}}
@@ -100,7 +100,7 @@ jobs:
100100
id: cached-sccache
101101
# Always save the (potentially partial) sccache database so it can be used to accelerate subsequent builds when an intermittent failure occurs
102102
if: steps.cached-llvm.outputs.cache-hit != 'true' && always()
103-
uses: actions/cache@v2
103+
uses: actions/cache@v4
104104
# If you change this configuration make sure to update keep-cache-warm.yml as well.
105105
with:
106106
# Note that this implicitly includes the sccache log
@@ -136,7 +136,7 @@ jobs:
136136
sccache --stop-server
137137
138138
- name: Save sccache logs
139-
uses: actions/upload-artifact@v2
139+
uses: actions/upload-artifact@v4
140140
if: steps.cached-llvm.outputs.cache-hit != 'true' && always()
141141
with:
142142
name: llvm-${{matrix.rid}}-sccache-logs
@@ -146,9 +146,9 @@ jobs:
146146
147147
# ----------------------------------------------------------------------- Pack Runtime Packages
148148
- name: Setup .NET
149-
uses: actions/setup-dotnet@v1
149+
uses: actions/setup-dotnet@v4
150150
with:
151-
dotnet-version: 6.0.x
151+
dotnet-version: 8.x
152152

153153
- name: Configure versioning
154154
run: python .github/workflows/configure-build.py
@@ -188,7 +188,7 @@ jobs:
188188
mv bin/llvm/${{matrix.rid}}/${{matrix.libclang-subpath}}-nosymlink bin/llvm/${{matrix.rid}}/${{matrix.libclang-subpath}}
189189
190190
- name: Collect Build Outputs
191-
uses: actions/upload-artifact@v2
191+
uses: actions/upload-artifact@v4
192192
# We always want to collect any build outputs that were created even if building failed
193193
if: always()
194194
with:
@@ -202,7 +202,7 @@ jobs:
202202
external/llvm-project/clang/tools/libclang/libClangSharp/LICENSE.md
203203
204204
- name: Collect NuGet Packages
205-
uses: actions/upload-artifact@v2
205+
uses: actions/upload-artifact@v4
206206
# We always want to collect any packages that were created even if building failed
207207
if: always()
208208
with:
@@ -219,7 +219,7 @@ jobs:
219219
steps:
220220
# ----------------------------------------------------------------------- Checkout
221221
- name: Checkout
222-
uses: actions/checkout@v2
222+
uses: actions/checkout@v4
223223

224224
# SourceLink will complain about the LLVM submodule missing even though it doesn't need it
225225
# If we didn't clone the LLVM submodule we need to delete .gitmodules so it can chill
@@ -228,16 +228,16 @@ jobs:
228228
run: rm .gitmodules
229229

230230
# ----------------------------------------------------------------------- Setup Python
231-
- name: Setup Python 3.8
232-
uses: actions/setup-python@v2
231+
- name: Setup Python
232+
uses: actions/setup-python@v5
233233
with:
234-
python-version: '3.8'
234+
python-version: '3.11'
235235

236236
# ----------------------------------------------------------------------- Setup .NET
237237
- name: Setup .NET
238-
uses: actions/setup-dotnet@v1
238+
uses: actions/setup-dotnet@v4
239239
with:
240-
dotnet-version: 6.0.x
240+
dotnet-version: 8.x
241241

242242
# ----------------------------------------------------------------------- Configure Versioning
243243
- name: Configure build
@@ -261,7 +261,7 @@ jobs:
261261

262262
# ----------------------------------------------------------------------- Collect Artifacts
263263
- name: Collect Build Outputs
264-
uses: actions/upload-artifact@v2
264+
uses: actions/upload-artifact@v4
265265
# We always want to collect any build outputs that were created even if building failed
266266
if: always()
267267
with:
@@ -271,7 +271,7 @@ jobs:
271271
obj/**
272272
273273
- name: Collect NuGet Packages
274-
uses: actions/upload-artifact@v2
274+
uses: actions/upload-artifact@v4
275275
# We always want to collect packages when they were produced
276276
if: steps.pack.outcome == 'success' && always()
277277
with:
@@ -289,29 +289,29 @@ jobs:
289289
steps:
290290
# ----------------------------------------------------------------------- Download Packages
291291
- name: Download LLVM Windows x64 packages
292-
uses: actions/download-artifact@v2
292+
uses: actions/download-artifact@v4
293293
with:
294294
name: llvm-win-x64-packages
295295
- name: Download LLVM Linux x64 packages
296-
uses: actions/download-artifact@v2
296+
uses: actions/download-artifact@v4
297297
with:
298298
name: llvm-linux-x64-packages
299299
- name: Download LLVM Linux ARM64 packages
300-
uses: actions/download-artifact@v2
300+
uses: actions/download-artifact@v4
301301
with:
302302
name: llvm-linux-arm64-packages
303303
- name: Download LLVM macOS x64 packages
304-
uses: actions/download-artifact@v2
304+
uses: actions/download-artifact@v4
305305
with:
306306
name: llvm-osx-x64-packages
307307
- name: Download ClangSharp.Pathogen packages
308-
uses: actions/download-artifact@v2
308+
uses: actions/download-artifact@v4
309309
with:
310310
name: ClangSharp.Pathogen-packages
311311

312312
# ----------------------------------------------------------------------- Upload Combined Packages Artifact
313313
- name: Collect NuGet Packages
314-
uses: actions/upload-artifact@v2
314+
uses: actions/upload-artifact@v4
315315
with:
316316
name: Packages
317317
if-no-files-found: error
@@ -329,22 +329,22 @@ jobs:
329329
# ----------------------------------------------------------------------- Download LLVM Build Outputs
330330
- name: Download LLVM Windows x64 build output
331331
if: always()
332-
uses: actions/download-artifact@v2
332+
uses: actions/download-artifact@v4
333333
with:
334334
name: llvm-win-x64
335335
- name: Download LLVM Linux x64 build output
336336
if: always()
337-
uses: actions/download-artifact@v2
337+
uses: actions/download-artifact@v4
338338
with:
339339
name: llvm-linux-x64
340340
- name: Download LLVM Linux ARM64 build output
341341
if: always()
342-
uses: actions/download-artifact@v2
342+
uses: actions/download-artifact@v4
343343
with:
344344
name: llvm-linux-arm64
345345
- name: Download LLVM macOS x64 build output
346346
if: always()
347-
uses: actions/download-artifact@v2
347+
uses: actions/download-artifact@v4
348348
with:
349349
name: llvm-osx-x64
350350

@@ -373,50 +373,20 @@ jobs:
373373
steps:
374374
# ----------------------------------------------------------------------- Setup .NET
375375
- name: Setup .NET
376-
uses: actions/setup-dotnet@v1
376+
uses: actions/setup-dotnet@v4
377377
with:
378-
dotnet-version: 6.0.x
378+
dotnet-version: 8.x
379379

380380
# ----------------------------------------------------------------------- Download built packages
381381
- name: Download built packages
382-
uses: actions/download-artifact@v2
382+
uses: actions/download-artifact@v4
383383
with:
384384
name: Packages
385385

386386
# ----------------------------------------------------------------------- Upload release assets
387387
- name: Upload release assets
388388
if: github.event_name == 'release'
389-
uses: actions/github-script@v4
390-
with:
391-
user-agent: actions/github-script for ${{github.repository}}
392-
script: |
393-
const fs = require('fs').promises;
394-
const path = require('path');
395-
const upload_url = context.payload.release.upload_url;
396-
397-
if (!upload_url) {
398-
throw "Missing release asset upload URL!";
399-
}
400-
401-
for (let filePath of await fs.readdir('.')) {
402-
const fileExtension = path.extname(filePath);
403-
if (fileExtension != '.nupkg' && fileExtension != '.snupkg') {
404-
continue;
405-
}
406-
407-
console.log(`Uploading '${filePath}'`);
408-
const contentLength = (await fs.stat(filePath)).size;
409-
const fileContents = await fs.readFile(filePath);
410-
await github.repos.uploadReleaseAsset({
411-
url: upload_url,
412-
headers: {
413-
'content-type': 'application/octet-stream',
414-
'content-length': contentLength
415-
},
416-
name: path.basename(filePath),
417-
data: fileContents
418-
});
419-
}
389+
run: gh release upload ${{github.event.release.tag_name}} *.nupkg *.snupkg --clobber
420390

421391
# ----------------------------------------------------------------------- Push to GitHub Packages
422392
- name: Push to GitHub Packages
@@ -439,49 +409,19 @@ jobs:
439409
steps:
440410
# ----------------------------------------------------------------------- Setup .NET
441411
- name: Setup .NET
442-
uses: actions/setup-dotnet@v1
412+
uses: actions/setup-dotnet@v4
443413
with:
444-
dotnet-version: 6.0.x
414+
dotnet-version: 8.x
445415

446416
# ----------------------------------------------------------------------- Download built packages
447417
- name: Download built packages
448-
uses: actions/download-artifact@v2
418+
uses: actions/download-artifact@v4
449419
with:
450420
name: Packages
451421

452422
# ----------------------------------------------------------------------- Push to NuGet.org
453423
- name: Push to NuGet.org
454-
run: dotnet nuget push "*.nupkg" --api-key ${{secrets.NUGET_API_KEY}} --source ${{secrets.NUGET_API_URL}}
424+
run: dotnet nuget push "*.nupkg" --api-key ${{secrets.NUGET_API_KEY}} --source ${{vars.NUGET_API_URL}}
455425
env:
456426
# This is a workaround for https://github.com/NuGet/Home/issues/9775
457427
DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER: 0
458-
459-
# =====================================================================================================================================================================
460-
# Send CI Failure Notification
461-
# =====================================================================================================================================================================
462-
send-ci-failure-notification:
463-
name: Send CI Failure Notification
464-
needs: [build-llvm, build-dotnet, coalesce-packages, verify-clang-resources, publish-packages-github, publish-packages-nuget-org]
465-
if: failure() && github.event_name != 'pull_request'
466-
continue-on-error: true
467-
runs-on: ubuntu-latest
468-
steps:
469-
# ----------------------------------------------------------------------- Checkout
470-
- name: Checkout
471-
uses: actions/checkout@v2
472-
473-
# ----------------------------------------------------------------------- Setup Python
474-
- name: Setup Python 3.8
475-
uses: actions/setup-python@v2
476-
with:
477-
python-version: '3.8'
478-
479-
# ----------------------------------------------------------------------- Send CI Failure Notification
480-
- name: Send Notification
481-
run: python .github/workflows/send-ci-failure-notification.py
482-
env:
483-
webhook_url: ${{secrets.TEAMS_WEBHOOK_URL}}
484-
github_organization: ${{github.repository_owner}}
485-
github_repo: ${{github.repository}}
486-
github_workflow_name: ${{github.workflow}}
487-
github_run_number: ${{github.run_id}}

0 commit comments

Comments
 (0)