Skip to content

Commit f88979b

Browse files
committed
Get the native arm64 CI to work (bcny)
1 parent 1cc85eb commit f88979b

File tree

3 files changed

+40
-44
lines changed

3 files changed

+40
-44
lines changed

.github/workflows/build-toolchain.yml

+4
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,8 @@ jobs:
423423
"include": [
424424
{
425425
"arch": "amd64",
426+
"cpu": "x86_64",
427+
"compiler_target": "x86_64-unknown-windows-msvc",
426428
"os": "Windows",
427429
"cc": "cl",
428430
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
@@ -438,6 +440,8 @@ jobs:
438440
"include": [
439441
{
440442
"arch": "arm64",
443+
"cpu": "aarch64",
444+
"compiler_target": "aarch64-unknown-windows-msvc",
441445
"os": "Windows",
442446
"cc": "cl",
443447
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",

.github/workflows/schedule-swift-toolchain.yml

-21
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,3 @@ jobs:
2525
contents: write
2626
packages: write
2727
id-token: write
28-
29-
call_development_snapshot_win_arm64:
30-
if: false
31-
name: Development Snapshot on Windows/ARM64
32-
uses: ./.github/workflows/build-toolchain.yml
33-
with:
34-
create_release: false
35-
create_snapshot: false
36-
windows_build_arch: arm64
37-
windows_x64_default_runner: ${{ vars.USE_CIRUN == 'true' && format('cirun-win11-23h2-pro-x64-16-2024-12-19--{0}', github.run_id) || 'swift-build-windows-latest-8-cores' }}
38-
windows_x64_compilers_runner: ${{ vars.USE_CIRUN == 'true' && format('cirun-win11-23h2-pro-x64-64-2024-12-19--{0}', github.run_id) || 'swift-build-windows-latest-64-cores' }}
39-
windows_arm64_default_runner: ${{ vars.USE_CIRUN == 'true' && format('cirun-win11-23h2-pro-arm64-16-2024-12-19--{0}', github.run_id) || 'swift-build-windows-arm64-latest-8-cores' }}
40-
windows_arm64_compilers_runner: ${{ vars.USE_CIRUN == 'true' && format('cirun-win11-23h2-pro-arm64-64-2024-12-19--{0}', github.run_id) || 'swift-build-windows-arm64-latest-32-cores' }}
41-
android_api_level: 28
42-
build_android: false
43-
secrets: inherit
44-
permissions:
45-
contents: write
46-
packages: write
47-
id-token: write
48-

.github/workflows/swift-toolchain.yml

+36-23
Original file line numberDiff line numberDiff line change
@@ -358,33 +358,37 @@ jobs:
358358

359359
ds2_tools:
360360
# TODO: Build this on macOS or make an equivalent Mac-only job
361-
# There is currently no Android NDK for Windows ARM64 so build ds2 only on Windows X64 host only
362-
if: inputs.build_android
363361
runs-on: ${{ inputs.default_build_runner }}
364362

365363
name: ds2 Build Tools
366364

367365
steps:
368366
- uses: actions/checkout@v4
367+
# There is currently no Android NDK for Windows ARM64 so build ds2_tools only on Windows X64 host only
368+
if: inputs.build_android
369369
with:
370370
repository: compnerd/ds2
371371
ref: ${{ inputs.ds2_revision }}
372372
path: ${{ github.workspace }}/SourceCache/ds2
373373
show-progress: false
374374

375375
- uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main
376+
if: inputs.build_android
376377
with:
377378
host_arch: ${{ inputs.build_arch }}
378379
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
379380
arch: amd64
380381

381382
# TODO(issues/205): Preload Chocolatey package manager on Azure images so we can remove this step.
382383
- uses: andrurogerz/ensure-chocolatey@v1
384+
if: inputs.build_android
383385

384386
- name: Install Flex and Bison Tools
385387
run: choco install winflexbison3
388+
if: inputs.build_android
386389

387390
- name: Configure RegsGen2
391+
if: inputs.build_android
388392
run: |
389393
cmake -B ${{ github.workspace }}/BinaryCache/RegsGen2 `
390394
-S ${{ github.workspace }}/SourceCache/ds2/Tools/RegsGen2 `
@@ -397,18 +401,18 @@ jobs:
397401
-G Ninja
398402
399403
- name: Build RegsGen2
404+
if: inputs.build_android
400405
run: cmake --build ${{ github.workspace }}/BinaryCache/RegsGen2 --config Release
401406

402407
- uses: actions/upload-artifact@v4
408+
if: inputs.build_android
403409
with:
404410
name: windows-regsgen2
405411
path: |
406412
${{ github.workspace }}/BinaryCache/RegsGen2/regsgen2.exe
407413
408414
ds2:
409415
# TODO: Build this on macOS or make an equivalent Mac-only job
410-
# There is currently no Android NDK for Windows ARM64 so build ds2 only on Windows X64 host only
411-
if: inputs.build_android
412416
needs: [ds2_tools]
413417
runs-on: ${{ inputs.default_build_runner }}
414418

@@ -452,36 +456,43 @@ jobs:
452456

453457
steps:
454458
- uses: actions/checkout@v4
459+
# There is currently no Android NDK for Windows ARM64 so build ds2 only on Windows X64 host only
460+
if: inputs.build_android
455461
with:
456462
repository: compnerd/ds2
457463
ref: ${{ inputs.ds2_revision }}
458464
path: ${{ github.workspace }}/SourceCache/ds2
459465
show-progress: false
460466

461467
- uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main
468+
if: inputs.build_android
462469
with:
463470
host_arch: ${{ inputs.build_arch }}
464471
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
465472
arch: ${{ matrix.arch }}
466473

467474
# TODO(issues/205): Preload Chocolatey package manager on Azure images so we can remove this step.
468475
- uses: andrurogerz/ensure-chocolatey@v1
476+
if: inputs.build_android
469477

470478
- name: Install Flex and Bison Tools
479+
if: inputs.build_android
471480
run: choco install winflexbison3
472481

473482
- uses: actions/download-artifact@v4
483+
if: inputs.build_android
474484
with:
475485
name: windows-regsgen2
476486
path: ${{ github.workspace }}/BinaryCache/RegsGen2
477487

478488
- uses: nttld/setup-ndk@v1
479-
if: matrix.os == 'Android'
489+
if: matrix.os == 'Android' && inputs.build_android
480490
id: setup-ndk
481491
with:
482492
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }}
483493

484494
- name: Configure DS2
495+
if: inputs.build_android
485496
run: |
486497
$NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }}
487498
cmake -B ${{ github.workspace }}/BinaryCache/ds2 `
@@ -500,12 +511,15 @@ jobs:
500511
-G Ninja
501512
502513
- name: Build DS2
514+
if: inputs.build_android
503515
run: cmake --build ${{ github.workspace }}/BinaryCache/ds2
504516

505517
- name: Install DS2
518+
if: inputs.build_android
506519
run: cmake --build ${{ github.workspace }}/BinaryCache/ds2 --target install
507520

508521
- uses: actions/upload-artifact@v4
522+
if: inputs.build_android
509523
with:
510524
name: ds2-${{ matrix.os }}-${{ matrix.arch }}
511525
path: ${{ github.workspace }}/BinaryCache/Library/Developer
@@ -786,7 +800,7 @@ jobs:
786800
run: |
787801
$env:SWIFTCI_USE_LOCAL_DEPS=1
788802
$LinkerFlags = if ("${{ matrix.os }}" -eq "Windows") {
789-
@("-Xlinker", "${env:SDKROOT}/usr/lib/swift/windows/x86_64/swiftCore.lib")
803+
@("-Xlinker", "${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/swiftCore.lib")
790804
} else {
791805
@()
792806
}
@@ -795,6 +809,7 @@ jobs:
795809
--configuration release `
796810
--package-path ${{ github.workspace }}/SourceCache/swift-driver `
797811
--build-path ${{ github.workspace }}/BinaryCache/swift-driver `
812+
--triple ${{ matrix.compiler_target }} `
798813
@LinkerFlags
799814
800815
- name: Copy binaries
@@ -1684,9 +1699,8 @@ jobs:
16841699
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
16851700
arch: ${{ matrix.arch }}
16861701

1687-
# NOTE(compnerd): we execute unconditionally as we reference outputs
16881702
- uses: nttld/setup-ndk@v1
1689-
if: matrix.os == 'Android'
1703+
if: matrix.os == 'Android' && inputs.build_android
16901704
id: setup-ndk
16911705
with:
16921706
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }}
@@ -1827,15 +1841,7 @@ jobs:
18271841

18281842
strategy:
18291843
fail-fast: false
1830-
matrix:
1831-
include:
1832-
- arch: 'amd64'
1833-
cpu: 'x86_64'
1834-
triple: 'x86_64-unknown-windows-msvc'
1835-
1836-
- arch: 'arm64'
1837-
cpu: 'aarch64'
1838-
triple: 'aarch64-unknown-windows-msvc'
1844+
matrix: ${{ fromJSON(inputs.host_matrix) }}
18391845

18401846
name: Windows ${{ matrix.arch }} Macros
18411847

@@ -2168,13 +2174,12 @@ jobs:
21682174
arch: ${{ matrix.arch }}
21692175

21702176
# FIXME(compnerd): workaround CMake 3.29-3.30 issue
2171-
- uses: jwlawson/actions-setup-cmake@v2
2177+
- uses: lukka/get-cmake@main
21722178
with:
2173-
cmake-version: '3.28'
2179+
cmakeVersion: 3.28.6
21742180

2175-
# NOTE(compnerd): we execute unconditionally as we reference outputs
21762181
- uses: nttld/setup-ndk@v1
2177-
if: matrix.os == 'Android'
2182+
if: matrix.os == 'Android' && inputs.build_android
21782183
id: setup-ndk
21792184
with:
21802185
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }}
@@ -3599,7 +3604,6 @@ jobs:
35993604
36003605
package_android_sdk_runtime:
36013606
# TODO: Build this on macOS or make an equivalent Mac-only job
3602-
if: inputs.build_android
36033607
name: Package Android SDK & Runtime
36043608
needs: [stdlib, ds2, sdk]
36053609
runs-on: ${{ inputs.default_build_runner }}
@@ -3623,27 +3627,33 @@ jobs:
36233627

36243628
steps:
36253629
- uses: actions/download-artifact@v4
3630+
# There is currently no Android NDK for Windows ARM64 so build Android only on Windows X64 host only
3631+
if: inputs.build_android
36263632
with:
36273633
name: Android-stdlib-${{ matrix.arch }}
36283634
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform
36293635
- uses: actions/download-artifact@v4
3636+
if: inputs.build_android
36303637
with:
36313638
name: Android-sdk-${{ matrix.arch }}
36323639
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform
36333640

36343641
- uses: actions/download-artifact@v4
3642+
if: inputs.build_android
36353643
with:
36363644
name: ds2-Android-${{ matrix.arch }}
36373645
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform/Developer/Library/${{ matrix.triple_no_api_level }}
36383646

36393647
- uses: actions/checkout@v4
3648+
if: inputs.build_android
36403649
with:
36413650
repository: swiftlang/swift-installer-scripts
36423651
ref: ${{ inputs.swift_installer_scripts_revision }}
36433652
path: ${{ github.workspace }}/SourceCache/swift-installer-scripts
36443653
show-progress: false
36453654

36463655
- uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main
3656+
if: inputs.build_android
36473657
with:
36483658
host_arch: ${{ inputs.build_arch }}
36493659
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
@@ -3655,15 +3665,17 @@ jobs:
36553665
Set-Content -Path $CertificatePath -Value '${{ secrets.CERTIFICATE }}'
36563666
certutil.exe -decode $CertificatePath $PFXPath
36573667
Write-Output CERTIFICATE=$PFXPath | Out-File -FilePath ${env:GITHUB_ENV} -Encoding utf8 -Append
3658-
if: ${{ inputs.signed }}
3668+
if: ${{ inputs.signed && inputs.build_android }}
36593669
36603670
- name: Install WixToolset.Sdk
3671+
if: inputs.build_android
36613672
run: |
36623673
if ((Get-Package -Name WixToolset.Sdk -ErrorAction SilentlyContinue) -eq $null) {
36633674
Install-Package -Name WixToolset.Sdk -RequiredVersion 4.0.1 -Force
36643675
}
36653676
36663677
- name: Package SDK
3678+
if: inputs.build_android
36673679
run: |
36683680
msbuild -nologo -restore -maxCpuCount `
36693681
-p:BaseOutputPath=${{ github.workspace }}\BinaryCache\installer\ `
@@ -3679,6 +3691,7 @@ jobs:
36793691
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/sdk/drd/sdk.wixproj
36803692
36813693
- uses: actions/upload-artifact@v4
3694+
if: inputs.build_android
36823695
with:
36833696
name: sdk-android-${{ matrix.arch }}-msi
36843697
path: |

0 commit comments

Comments
 (0)