Skip to content

Commit

Permalink
Add the native ARM64 toolchain build to the main CI
Browse files Browse the repository at this point in the history
  • Loading branch information
hjyamauchi committed Nov 23, 2024
1 parent acf608e commit f666c53
Show file tree
Hide file tree
Showing 5 changed files with 387 additions and 215 deletions.
153 changes: 128 additions & 25 deletions .github/workflows/build-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,25 @@ on:
default: true
required: false

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

windows_compilers_runner:
description: 'Build runner for `compilers` job'
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_arm64_compilers_runner:
description: 'ARM64 Build runner for `compilers` job'
required: false
type: string

secrets:
SYMBOL_SERVER_PAT:
Expand Down Expand Up @@ -153,12 +163,17 @@ 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_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,8 +299,10 @@ 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}
# TODO: Make the mac runner configurable.
echo mac_build_runner=macos-latest >> ${GITHUB_OUTPUT}
Expand All @@ -301,11 +318,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 +336,26 @@ jobs:
},
{
"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_ARM64_HOST_MATRIX: >-
{
"include": [
{
"arch": "arm64",
"cpu": "aarch64",
"triple": "aarch64-unknown-windows-msvc",
"compiler_target": "aarch64-unknown-windows-msvc",
"os": "Windows",
"cc": "cl",
Expand All @@ -328,11 +367,12 @@ jobs:
}
]
}
WINDOWS_BUILD_MATRIX: >-
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 +383,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 +474,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 +577,35 @@ 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:
continue-on-error: true
needs: [context]
name: Windows Swift Toolchains Build
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
cpu: x64
- arch: arm64
cpu: arm64
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: ${{ matrix.arch }}
build_matrix: ${{ needs.context.outputs[format('windows_{0}_build_matrix', matrix.cpu)] }}
host_matrix: ${{ needs.context.outputs[format('windows_{0}_host_matrix', matrix.cpu)] }}
target_matrix: ${{ needs.context.outputs[format('windows_{0}_target_matrix', matrix.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 +660,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', matrix.cpu)] }}
compilers_build_runner: ${{ needs.context.outputs[format('windows_{0}_compilers_runner', matrix.cpu)] }}
secrets:
SYMBOL_SERVER_PAT: ${{ secrets.SYMBOL_SERVER_PAT }}
CERTIFICATE: ${{ secrets.CERTIFICATE }}
Expand Down Expand Up @@ -667,12 +770,12 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
name: installer-amd64
name: installer-amd64-built-on-amd64
path: ${{ github.workspace }}/tmp/amd64

- uses: actions/download-artifact@v4
with:
name: installer-arm64
name: installer-arm64-built-on-amd64
path: ${{ github.workspace }}/tmp/arm64

- name: Create Release
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
6 changes: 4 additions & 2 deletions .github/workflows/schedule-swift-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ jobs:
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_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

0 comments on commit f666c53

Please sign in to comment.