Skip to content

Commit 82e1cfc

Browse files
authored
Get the native arm64 CI to work (#878)
1 parent 67b4b37 commit 82e1cfc

File tree

2 files changed

+40
-23
lines changed

2 files changed

+40
-23
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 4 additions & 0 deletions
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/swift-toolchain.yml

Lines changed: 36 additions & 23 deletions
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@aa1df13cce8c30d2cb58efa871271c5a764623f8 # 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 }}
@@ -3602,7 +3607,6 @@ jobs:
36023607
36033608
package_android_sdk_runtime:
36043609
# TODO: Build this on macOS or make an equivalent Mac-only job
3605-
if: inputs.build_android
36063610
name: Package Android SDK & Runtime
36073611
needs: [stdlib, ds2, sdk]
36083612
runs-on: ${{ inputs.default_build_runner }}
@@ -3626,27 +3630,33 @@ jobs:
36263630

36273631
steps:
36283632
- uses: actions/download-artifact@v4
3633+
# There is currently no Android NDK for Windows ARM64 so build Android only on Windows X64 host only
3634+
if: inputs.build_android
36293635
with:
36303636
name: Android-stdlib-${{ matrix.arch }}
36313637
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform
36323638
- uses: actions/download-artifact@v4
3639+
if: inputs.build_android
36333640
with:
36343641
name: Android-sdk-${{ matrix.arch }}
36353642
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform
36363643

36373644
- uses: actions/download-artifact@v4
3645+
if: inputs.build_android
36383646
with:
36393647
name: ds2-Android-${{ matrix.arch }}
36403648
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform/Developer/Library/${{ matrix.triple_no_api_level }}
36413649

36423650
- uses: actions/checkout@v4
3651+
if: inputs.build_android
36433652
with:
36443653
repository: swiftlang/swift-installer-scripts
36453654
ref: ${{ inputs.swift_installer_scripts_revision }}
36463655
path: ${{ github.workspace }}/SourceCache/swift-installer-scripts
36473656
show-progress: false
36483657

36493658
- uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main
3659+
if: inputs.build_android
36503660
with:
36513661
host_arch: ${{ inputs.build_arch }}
36523662
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
@@ -3658,15 +3668,17 @@ jobs:
36583668
Set-Content -Path $CertificatePath -Value '${{ secrets.CERTIFICATE }}'
36593669
certutil.exe -decode $CertificatePath $PFXPath
36603670
Write-Output CERTIFICATE=$PFXPath | Out-File -FilePath ${env:GITHUB_ENV} -Encoding utf8 -Append
3661-
if: ${{ inputs.signed }}
3671+
if: ${{ inputs.signed && inputs.build_android }}
36623672
36633673
- name: Install WixToolset.Sdk
3674+
if: inputs.build_android
36643675
run: |
36653676
if ((Get-Package -Name WixToolset.Sdk -ErrorAction SilentlyContinue) -eq $null) {
36663677
Install-Package -Name WixToolset.Sdk -RequiredVersion 4.0.1 -Force
36673678
}
36683679
36693680
- name: Package SDK
3681+
if: inputs.build_android
36703682
run: |
36713683
msbuild -nologo -restore -maxCpuCount `
36723684
-p:BaseOutputPath=${{ github.workspace }}\BinaryCache\installer\ `
@@ -3682,6 +3694,7 @@ jobs:
36823694
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/sdk/drd/sdk.wixproj
36833695
36843696
- uses: actions/upload-artifact@v4
3697+
if: inputs.build_android
36853698
with:
36863699
name: sdk-android-${{ matrix.arch }}-msi
36873700
path: |

0 commit comments

Comments
 (0)