Skip to content

Commit

Permalink
Get the native arm64 CI to work (bcny)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjyamauchi committed Jan 10, 2025
1 parent 1cc85eb commit 66a3ae9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 44 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ jobs:
"include": [
{
"arch": "amd64",
"cpu": "x86_64",
"compiler_target": "x86_64-unknown-windows-msvc",
"os": "Windows",
"cc": "cl",
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
Expand All @@ -438,6 +440,8 @@ jobs:
"include": [
{
"arch": "arm64",
"cpu": "aarch64",
"compiler_target": "aarch64-unknown-windows-msvc",
"os": "Windows",
"cc": "cl",
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/schedule-swift-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,3 @@ jobs:
contents: write
packages: write
id-token: write

call_development_snapshot_win_arm64:
if: false
name: Development Snapshot on Windows/ARM64
uses: ./.github/workflows/build-toolchain.yml
with:
create_release: false
create_snapshot: false
windows_build_arch: arm64
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' }}
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' }}
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' }}
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' }}
android_api_level: 28
build_android: false
secrets: inherit
permissions:
contents: write
packages: write
id-token: write

59 changes: 36 additions & 23 deletions .github/workflows/swift-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -358,33 +358,37 @@ jobs:

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

name: ds2 Build Tools

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

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

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

- name: Install Flex and Bison Tools
run: choco install winflexbison3
if: inputs.build_android

- name: Configure RegsGen2
if: inputs.build_android
run: |
cmake -B ${{ github.workspace }}/BinaryCache/RegsGen2 `
-S ${{ github.workspace }}/SourceCache/ds2/Tools/RegsGen2 `
Expand All @@ -397,18 +401,18 @@ jobs:
-G Ninja
- name: Build RegsGen2
if: inputs.build_android
run: cmake --build ${{ github.workspace }}/BinaryCache/RegsGen2 --config Release

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

Expand Down Expand Up @@ -452,36 +456,43 @@ jobs:

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

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

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

- name: Install Flex and Bison Tools
if: inputs.build_android
run: choco install winflexbison3

- uses: actions/download-artifact@v4
if: inputs.build_android
with:
name: windows-regsgen2
path: ${{ github.workspace }}/BinaryCache/RegsGen2

- uses: nttld/setup-ndk@v1
if: matrix.os == 'Android'
if: matrix.os == 'Android' && inputs.build_android
id: setup-ndk
with:
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }}

- name: Configure DS2
if: inputs.build_android
run: |
$NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }}
cmake -B ${{ github.workspace }}/BinaryCache/ds2 `
Expand All @@ -500,12 +511,15 @@ jobs:
-G Ninja
- name: Build DS2
if: inputs.build_android
run: cmake --build ${{ github.workspace }}/BinaryCache/ds2

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

- uses: actions/upload-artifact@v4
if: inputs.build_android
with:
name: ds2-${{ matrix.os }}-${{ matrix.arch }}
path: ${{ github.workspace }}/BinaryCache/Library/Developer
Expand Down Expand Up @@ -786,7 +800,7 @@ jobs:
run: |
$env:SWIFTCI_USE_LOCAL_DEPS=1
$LinkerFlags = if ("${{ matrix.os }}" -eq "Windows") {
@("-Xlinker", "${env:SDKROOT}/usr/lib/swift/windows/x86_64/swiftCore.lib")
@("-Xlinker", "${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/swiftCore.lib")
} else {
@()
}
Expand All @@ -795,6 +809,7 @@ jobs:
--configuration release `
--package-path ${{ github.workspace }}/SourceCache/swift-driver `
--build-path ${{ github.workspace }}/BinaryCache/swift-driver `
--triple ${{ matrix.compiler_target }} `
@LinkerFlags
- name: Copy binaries
Expand Down Expand Up @@ -1684,9 +1699,8 @@ jobs:
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
arch: ${{ matrix.arch }}

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

strategy:
fail-fast: false
matrix:
include:
- arch: 'amd64'
cpu: 'x86_64'
triple: 'x86_64-unknown-windows-msvc'

- arch: 'arm64'
cpu: 'aarch64'
triple: 'aarch64-unknown-windows-msvc'
matrix: ${{ fromJSON(inputs.host_matrix) }}

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

Expand Down Expand Up @@ -2168,13 +2174,12 @@ jobs:
arch: ${{ matrix.arch }}

# FIXME(compnerd): workaround CMake 3.29-3.30 issue
- uses: jwlawson/actions-setup-cmake@v2
- uses: lukka/get-cmake@aa1df13cce8c30d2cb58efa871271c5a764623f8 # main
with:
cmake-version: '3.28'
cmakeVersion: 3.28.6

# NOTE(compnerd): we execute unconditionally as we reference outputs
- uses: nttld/setup-ndk@v1
if: matrix.os == 'Android'
if: matrix.os == 'Android' && inputs.build_android
id: setup-ndk
with:
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }}
Expand Down Expand Up @@ -3599,7 +3604,6 @@ jobs:
package_android_sdk_runtime:
# TODO: Build this on macOS or make an equivalent Mac-only job
if: inputs.build_android
name: Package Android SDK & Runtime
needs: [stdlib, ds2, sdk]
runs-on: ${{ inputs.default_build_runner }}
Expand All @@ -3623,27 +3627,33 @@ jobs:

steps:
- uses: actions/download-artifact@v4
# There is currently no Android NDK for Windows ARM64 so build Android only on Windows X64 host only
if: inputs.build_android
with:
name: Android-stdlib-${{ matrix.arch }}
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform
- uses: actions/download-artifact@v4
if: inputs.build_android
with:
name: Android-sdk-${{ matrix.arch }}
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform

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

- uses: actions/checkout@v4
if: inputs.build_android
with:
repository: swiftlang/swift-installer-scripts
ref: ${{ inputs.swift_installer_scripts_revision }}
path: ${{ github.workspace }}/SourceCache/swift-installer-scripts
show-progress: false

- uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main
if: inputs.build_android
with:
host_arch: ${{ inputs.build_arch }}
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
Expand All @@ -3655,15 +3665,17 @@ jobs:
Set-Content -Path $CertificatePath -Value '${{ secrets.CERTIFICATE }}'
certutil.exe -decode $CertificatePath $PFXPath
Write-Output CERTIFICATE=$PFXPath | Out-File -FilePath ${env:GITHUB_ENV} -Encoding utf8 -Append
if: ${{ inputs.signed }}
if: ${{ inputs.signed && inputs.build_android }}
- name: Install WixToolset.Sdk
if: inputs.build_android
run: |
if ((Get-Package -Name WixToolset.Sdk -ErrorAction SilentlyContinue) -eq $null) {
Install-Package -Name WixToolset.Sdk -RequiredVersion 4.0.1 -Force
}
- name: Package SDK
if: inputs.build_android
run: |
msbuild -nologo -restore -maxCpuCount `
-p:BaseOutputPath=${{ github.workspace }}\BinaryCache\installer\ `
Expand All @@ -3679,6 +3691,7 @@ jobs:
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/sdk/drd/sdk.wixproj
- uses: actions/upload-artifact@v4
if: inputs.build_android
with:
name: sdk-android-${{ matrix.arch }}-msi
path: |
Expand Down

0 comments on commit 66a3ae9

Please sign in to comment.