Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the native ARM64 toolchain build to the main CI #216

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 147 additions & 24 deletions .github/workflows/build-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ on:
default: true
required: false

create_snapshot:
description: 'Create Snapshot'
type: boolean
default: true
required: false

workflow_call:
inputs:
swift_version:
Expand Down Expand Up @@ -71,15 +77,36 @@ on:
default: true
required: false

windows_default_runner:
description: 'Build runner'
create_snapshot:
description: 'Create Snapshot'
type: boolean
default: true
required: false

windows_x64_default_runner:
description: 'X64 Build runner'
required: false
type: string

windows_arm64_default_runner:
description: 'ARM64 Build runner'
required: false
type: string

windows_x64_compilers_runner:
description: 'X64 Build runner for `compilers` job'
required: false
type: string

windows_compilers_runner:
description: 'Build runner for `compilers` job'
windows_arm64_compilers_runner:
description: 'ARM64 Build runner for `compilers` job'
required: false
type: string

windows_build_arch:
description: 'Windows build architecture'
required: false
type: string

secrets:
SYMBOL_SERVER_PAT:
Expand Down Expand Up @@ -153,12 +180,19 @@ jobs:
signed: ${{ steps.context.outputs.signed }}
swift_version: ${{ steps.context.outputs.swift_version }}
swift_tag: ${{ steps.context.outputs.swift_tag }}
windows_build_runner: ${{ steps.context.outputs.windows_build_runner }}
windows_compilers_runner: ${{ steps.context.outputs.windows_compilers_runner }}
windows_arm64_build_runner: ${{ steps.context.outputs.windows_arm64_build_runner }}
windows_arm64_compilers_runner: ${{ steps.context.outputs.windows_arm64_compilers_runner }}
windows_build_arch: ${{ steps.context.outputs.windows_build_arch }}
windows_build_cpu: ${{ steps.context.outputs.windows_build_cpu }}
windows_x64_build_runner: ${{ steps.context.outputs.windows_x64_build_runner }}
windows_x64_compilers_runner: ${{ steps.context.outputs.windows_x64_compilers_runner }}
mac_build_runner: ${{ steps.context.outputs.mac_build_runner }}
windows_host_matrix: ${{ steps.setup-matrix.outputs.windows_host_matrix }}
windows_build_matrix: ${{ steps.setup-matrix.outputs.windows_build_matrix }}
windows_target_matrix: ${{ steps.setup-matrix.outputs.windows_target_matrix }}
windows_arm64_build_matrix: ${{ steps.setup-matrix.outputs.windows_arm64_build_matrix }}
windows_arm64_host_matrix: ${{ steps.setup-matrix.outputs.windows_arm64_host_matrix }}
windows_arm64_target_matrix: ${{ steps.setup-matrix.outputs.windows_arm64_target_matrix }}
windows_x64_build_matrix: ${{ steps.setup-matrix.outputs.windows_x64_build_matrix }}
windows_x64_host_matrix: ${{ steps.setup-matrix.outputs.windows_x64_host_matrix }}
windows_x64_target_matrix: ${{ steps.setup-matrix.outputs.windows_x64_target_matrix }}
darwin_host_matrix: ${{ steps.setup-matrix.outputs.darwin_host_matrix }}
darwin_build_matrix: ${{ steps.setup-matrix.outputs.darwin_build_matrix }}
darwin_target_matrix: ${{ steps.setup-matrix.outputs.darwin_target_matrix }}
Expand Down Expand Up @@ -284,15 +318,26 @@ jobs:
fi
fi

echo windows_build_runner=${{ inputs.windows_default_runner || vars.WINDOWS_BUILD_RUNNER || 'windows-latest' }} >> ${GITHUB_OUTPUT}
echo windows_compilers_runner=${{ inputs.windows_compilers_runner || inputs.windows_default_runner || vars.COMPILERS_BUILD_RUNNER || vars.WINDOWS_BUILD_RUNNER || 'windows-latest' }} >> ${GITHUB_OUTPUT}
echo windows_x64_build_runner=${{ inputs.windows_x64_default_runner || vars.WINDOWS_BUILD_RUNNER || 'windows-latest' }} >> ${GITHUB_OUTPUT}
echo windows_x64_compilers_runner=${{ inputs.windows_x64_compilers_runner || inputs.windows_x64_default_runner || vars.WINDOWS_X64_COMPILERS_BUILD_RUNNER || vars.WINDOWS_X64_DEFAULT_BUILD_RUNNER || 'windows-latest' }} >> ${GITHUB_OUTPUT}
echo windows_arm64_build_runner=${{ inputs.windows_arm64_default_runner || vars.WINDOWS_ARM64_DEFAULT_BUILD_RUNNER || 'windows-latest' }} >> ${GITHUB_OUTPUT}
echo windows_arm64_compilers_runner=${{ inputs.windows_arm64_compilers_runner || inputs.windows_arm64_default_runner || vars.WINDOWS_ARM64_COMPILERS_BUILD_RUNNER || vars.WINDOWS_ARM64_DEFAULT_BUILD_RUNNER || 'windows-latest' }} >> ${GITHUB_OUTPUT}
if [[ "${{ inputs.windows_build_arch }}" == "arm64" ]] ; then
echo windows_build_arch=arm64 >> ${GITHUB_OUTPUT}
echo windows_build_cpu=arm64 >> ${GITHUB_OUTPUT}
else
echo windows_build_arch=amd64 >> ${GITHUB_OUTPUT}
echo windows_build_cpu=x64 >> ${GITHUB_OUTPUT}
fi

# TODO: Make the mac runner configurable.
echo mac_build_runner=macos-latest >> ${GITHUB_OUTPUT}

echo ANDROID_API_LEVEL=${{ inputs.android_api_level }} >> ${GITHUB_OUTPUT}
echo ANDROID_NDK_VERSION=r26b >> ${GITHUB_OUTPUT}

- uses: actions/upload-artifact@v4
if: inputs.create_snapshot == true
with:
name: stable.xml
path: stable.xml
Expand All @@ -301,11 +346,13 @@ jobs:
- name: Setup matrix
id: setup-matrix
env:
WINDOWS_HOST_MATRIX: >-
WINDOWS_X64_HOST_MATRIX: >-
{
"include": [
{
"arch": "amd64",
"cpu": "x86_64",
"triple": "x86_64-unknown-windows-msvc",
"compiler_target": "x86_64-unknown-windows-msvc",
"os": "Windows",
"cc": "cl",
Expand All @@ -317,6 +364,8 @@ jobs:
},
{
"arch": "arm64",
"cpu": "aarch64",
"triple": "aarch64-unknown-windows-msvc",
"compiler_target": "aarch64-unknown-windows-msvc",
"os": "Windows",
"cc": "cl",
Expand All @@ -328,11 +377,30 @@ jobs:
}
]
}
WINDOWS_BUILD_MATRIX: >-
WINDOWS_ARM64_HOST_MATRIX: >-
{
"include": [
{
"arch": "arm64",
"cpu": "aarch64",
"triple": "aarch64-unknown-windows-msvc",
"compiler_target": "aarch64-unknown-windows-msvc",
"os": "Windows",
"cc": "cl",
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
"cxx": "cl",
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=ARM64 -D CMAKE_MT=mt"
}
]
}
WINDOWS_X64_BUILD_MATRIX: >-
{
"include": [
{
"arch": "amd64",
"compiler_target": "x86_64-unknown-windows-msvc",
"os": "Windows",
"cc": "cl",
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
Expand All @@ -343,7 +411,23 @@ jobs:
}
]
}
WINDOWS_TARGET_MATRIX: >-
WINDOWS_ARM64_BUILD_MATRIX: >-
{
"include": [
{
"arch": "arm64",
"compiler_target": "aarch64-unknown-windows-msvc",
"os": "Windows",
"cc": "cl",
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
"cxx": "cl",
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=ARM64 -D CMAKE_MT=mt"
}
]
}
WINDOWS_X64_TARGET_MATRIX: >-
{
"include": [
{
Expand Down Expand Up @@ -418,6 +502,41 @@ jobs:
}
]
}
WINDOWS_ARM64_TARGET_MATRIX: >-
{
"include": [
{
"arch": "amd64",
"os": "Windows",
"cc": "cl",
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
"cxx": "cl",
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=AMD64 -D CMAKE_MT=mt"
},
{
"arch": "arm64",
"os": "Windows",
"cc": "cl",
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
"cxx": "cl",
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=ARM64 -D CMAKE_MT=mt"
},
{
"arch": "x86",
"os": "Windows",
"cc": "cl",
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
"cxx": "cl",
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
"swiftflags": "",
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=X86 -D CMAKE_MT=mt"
}
]
}
DARWIN_HOST_MATRIX: >-
{
"include": [
Expand Down Expand Up @@ -486,23 +605,27 @@ jobs:
]
}
run: |
echo "windows_host_matrix=$(jq -r -c '.' <<< ${WINDOWS_HOST_MATRIX})" >> ${GITHUB_OUTPUT}
echo "windows_build_matrix=$(jq -r -c '.' <<< ${WINDOWS_BUILD_MATRIX})" >> ${GITHUB_OUTPUT}
echo "windows_target_matrix=$(jq -r -c '.' <<< ${WINDOWS_TARGET_MATRIX})" >> ${GITHUB_OUTPUT}
echo "windows_x64_host_matrix=$(jq -r -c '.' <<< ${WINDOWS_X64_HOST_MATRIX})" >> ${GITHUB_OUTPUT}
echo "windows_arm64_host_matrix=$(jq -r -c '.' <<< ${WINDOWS_ARM64_HOST_MATRIX})" >> ${GITHUB_OUTPUT}
echo "windows_x64_build_matrix=$(jq -r -c '.' <<< ${WINDOWS_X64_BUILD_MATRIX})" >> ${GITHUB_OUTPUT}
echo "windows_arm64_build_matrix=$(jq -r -c '.' <<< ${WINDOWS_ARM64_BUILD_MATRIX})" >> ${GITHUB_OUTPUT}
echo "windows_x64_target_matrix=$(jq -r -c '.' <<< ${WINDOWS_X64_TARGET_MATRIX})" >> ${GITHUB_OUTPUT}
echo "windows_arm64_target_matrix=$(jq -r -c '.' <<< ${WINDOWS_ARM64_TARGET_MATRIX})" >> ${GITHUB_OUTPUT}
echo "darwin_host_matrix=$(jq -r -c '.' <<< ${DARWIN_HOST_MATRIX})" >> ${GITHUB_OUTPUT}
echo "darwin_build_matrix=$(jq -r -c '.' <<< ${DARWIN_BUILD_MATRIX})" >> ${GITHUB_OUTPUT}
echo "darwin_target_matrix=$(jq -r -c '.' <<< ${DARWIN_TARGET_MATRIX})" >> ${GITHUB_OUTPUT}

windows-build:
needs: [context]
name: Windows Swift Toolchains Build

uses: ./.github/workflows/swift-toolchain.yml
with:
build_os: Windows
build_arch: amd64
build_matrix: ${{ needs.context.outputs.windows_build_matrix }}
host_matrix: ${{ needs.context.outputs.windows_host_matrix }}
target_matrix: ${{ needs.context.outputs.windows_target_matrix }}
build_arch: ${{ inputs.windows_build_arch }}
build_matrix: ${{ needs.context.outputs[format('windows_{0}_build_matrix', needs.context.outputs.windows_build_cpu)] }}
host_matrix: ${{ needs.context.outputs[format('windows_{0}_host_matrix', needs.context.outputs.windows_build_cpu)] }}
target_matrix: ${{ needs.context.outputs[format('windows_{0}_target_matrix', needs.context.outputs.windows_build_cpu)] }}
curl_revision: ${{ needs.context.outputs.curl_revision }}
curl_version: ${{ needs.context.outputs.curl_version }}
ds2_revision: ${{ needs.context.outputs.ds2_revision }}
Expand Down Expand Up @@ -557,8 +680,8 @@ jobs:
signed: ${{ fromJSON(needs.context.outputs.signed) }}
swift_version: ${{ needs.context.outputs.swift_version }}
swift_tag: ${{ needs.context.outputs.swift_tag }}
default_build_runner: ${{ needs.context.outputs.windows_build_runner }}
compilers_build_runner: ${{ needs.context.outputs.windows_compilers_runner }}
default_build_runner: ${{ needs.context.outputs[format('windows_{0}_build_runner', needs.context.outputs.windows_build_cpu)] }}
compilers_build_runner: ${{ needs.context.outputs[format('windows_{0}_compilers_runner', needs.context.outputs.windows_build_cpu)] }}
secrets:
SYMBOL_SERVER_PAT: ${{ secrets.SYMBOL_SERVER_PAT }}
CERTIFICATE: ${{ secrets.CERTIFICATE }}
Expand Down Expand Up @@ -640,7 +763,7 @@ jobs:
snapshot:
runs-on: ubuntu-latest
needs: [context, windows-build]
if: github.event_name == 'schedule'
if: inputs.create_snapshot == true && github.event_name == 'schedule'
steps:
- uses: actions/checkout@v4
with:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/pull-request-swift-toolchain-cirun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ jobs:
uses: ./.github/workflows/build-toolchain.yml
with:
create_release: false
windows_default_runner: "cirun-win11-23h2-pro-x64-16-2024-10-10--${{ github.run_id }}"
windows_compilers_runner: "cirun-win11-23h2-pro-x64-64-2024-10-10--${{ github.run_id }}"
windows_x64_default_runner: ${{ vars.USE_CIRUN == 'true' && format('cirun-win11-23h2-pro-x64-16-2024-10-10--{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-10-10--{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-10-10--{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-10-10--{0}', github.run_id) || 'swift-build-windows-arm64-latest-32-cores' }}
android_api_level: 28
secrets: inherit
permissions:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/pull-request-swift-toolchain-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ jobs:
uses: ./.github/workflows/build-toolchain.yml
with:
create_release: false
windows_default_runner: "swift-build-windows-latest-8-cores"
windows_compilers_runner: "swift-build-windows-latest-64-cores"
windows_x64_default_runner: "swift-build-windows-latest-8-cores"
windows_x64_compilers_runner: "swift-build-windows-latest-64-cores"
windows_arm64_default_runner: "swift-build-windows-arm64-latest-8-cores"
windows_arm64_compilers_runner: "swift-build-windows-arm64-latest-32-cores"
android_api_level: 28
secrets: inherit
permissions:
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/schedule-swift-toolchain-windows-arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Schedule - Development Snapshot Windows/ARM64

on:
schedule:
- cron: "0 */6 * * *"

# Allows us to trigger toolchain builds on-demand using the same inputs as scheduled builds.
# For more control over the swift-toolchain.yml's inputs, trigger that workflow directly.
workflow_dispatch:

jobs:
call_development_snapshot:
name: Development Snapshot
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-10-10--{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-10-10--{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-10-10--{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-10-10--{0}', github.run_id) || 'swift-build-windows-arm64-latest-32-cores' }}
android_api_level: 28
secrets: inherit
permissions:
contents: write
packages: write
id-token: write
27 changes: 24 additions & 3 deletions .github/workflows/schedule-swift-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,30 @@ jobs:
name: Development Snapshot
uses: ./.github/workflows/build-toolchain.yml
with:
create_release: true
windows_default_runner: ${{ vars.USE_CIRUN == 'true' && format('cirun-win11-23h2-pro-x64-16-2024-10-10--{0}', github.run_id) || 'swift-build-windows-latest-8-cores' }}
windows_compilers_runner: ${{ vars.USE_CIRUN == 'true' && format('cirun-win11-23h2-pro-x64-64-2024-10-10--{0}', github.run_id) || 'swift-build-windows-latest-64-cores' }}
windows_build_arch: amd64
windows_x64_default_runner: ${{ vars.USE_CIRUN == 'true' && format('cirun-win11-23h2-pro-x64-16-2024-10-10--{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-10-10--{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-10-10--{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-10-10--{0}', github.run_id) || 'swift-build-windows-arm64-latest-32-cores' }}
android_api_level: 28
secrets: inherit
permissions:
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-10-10--{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-10-10--{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-10-10--{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-10-10--{0}', github.run_id) || 'swift-build-windows-arm64-latest-32-cores' }}
android_api_level: 28
secrets: inherit
permissions:
Expand Down
Loading
Loading