From da6b0bac0760ed680ad4879981df20c30bc1b7fb Mon Sep 17 00:00:00 2001 From: Hiroshi Yamauchi Date: Fri, 18 Oct 2024 17:13:27 -0700 Subject: [PATCH] Add the native ARM64 toolchain build to the main CI --- .github/workflows/build-toolchain.yml | 156 +++++-- .../pull-request-swift-toolchain-cirun.yml | 6 +- .../pull-request-swift-toolchain-github.yml | 6 +- .../workflows/schedule-swift-toolchain.yml | 6 +- .github/workflows/swift-toolchain.yml | 431 ++++++++++-------- 5 files changed, 389 insertions(+), 216 deletions(-) diff --git a/.github/workflows/build-toolchain.yml b/.github/workflows/build-toolchain.yml index 0655b59e..42ebb56a 100644 --- a/.github/workflows/build-toolchain.yml +++ b/.github/workflows/build-toolchain.yml @@ -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: @@ -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 }} @@ -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} @@ -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", @@ -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", @@ -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 }}", @@ -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": [ { @@ -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": [ @@ -486,9 +577,12 @@ 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} @@ -496,13 +590,22 @@ jobs: windows-build: 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 }} @@ -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 }} @@ -663,16 +766,17 @@ jobs: release: runs-on: ubuntu-latest needs: [context, windows-build] - if: inputs.create_release == true + # Create a release even if the windows-build for arm64 fails + if: inputs.create_release == true && (success() || failure()) 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 diff --git a/.github/workflows/pull-request-swift-toolchain-cirun.yml b/.github/workflows/pull-request-swift-toolchain-cirun.yml index 549b62ed..d3bde0c3 100644 --- a/.github/workflows/pull-request-swift-toolchain-cirun.yml +++ b/.github/workflows/pull-request-swift-toolchain-cirun.yml @@ -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: diff --git a/.github/workflows/pull-request-swift-toolchain-github.yml b/.github/workflows/pull-request-swift-toolchain-github.yml index 47834bf4..41d49962 100644 --- a/.github/workflows/pull-request-swift-toolchain-github.yml +++ b/.github/workflows/pull-request-swift-toolchain-github.yml @@ -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: diff --git a/.github/workflows/schedule-swift-toolchain.yml b/.github/workflows/schedule-swift-toolchain.yml index 1f1013f8..a035edf4 100644 --- a/.github/workflows/schedule-swift-toolchain.yml +++ b/.github/workflows/schedule-swift-toolchain.yml @@ -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: diff --git a/.github/workflows/swift-toolchain.yml b/.github/workflows/swift-toolchain.yml index 61f8832c..dec1614a 100644 --- a/.github/workflows/swift-toolchain.yml +++ b/.github/workflows/swift-toolchain.yml @@ -270,7 +270,7 @@ jobs: fail-fast: false matrix: ${{ fromJSON(inputs.host_matrix) }} - name: ${{ matrix.os }} ${{ matrix.arch }} SQLite3 + name: ${{ matrix.os }} ${{ matrix.arch }} SQLite3 (building on ${{ inputs.build_os }} ${{ inputs.build_arch }}) steps: - uses: actions/checkout@v4 @@ -335,15 +335,15 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: sqlite-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.swift_toolchain_sqlite_version }} + name: sqlite-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.swift_toolchain_sqlite_version }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr ds2_tools: # TODO: Build this on macOS or make an equivalent Mac-only job - if: inputs.build_os == 'Windows' + if: inputs.build_os == 'Windows' && inputs.build_arch == 'amd64' runs-on: ${{ inputs.default_build_runner }} - name: ds2 Build Tools + name: ds2 Build Tools (building on ${{ inputs.build_os }} ${{ inputs.build_arch }}) steps: - uses: actions/checkout@v4 @@ -355,7 +355,7 @@ jobs: - uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main with: - host_arch: amd64 + host_arch: ${{ inputs.build_arch }} components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' arch: amd64 @@ -389,7 +389,7 @@ jobs: ds2: # TODO: Build this on macOS or make an equivalent Mac-only job - if: inputs.build_os == 'Windows' + if: inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' needs: [ds2_tools] runs-on: ${{ inputs.default_build_runner }} @@ -429,7 +429,7 @@ jobs: os: Android extra_flags: -DCMAKE_ANDROID_API=${{ inputs.ANDROID_API_LEVEL }} -DCMAKE_ANDROID_ARCH_ABI=x86_64 - name: ${{ matrix.os }} ${{ matrix.arch }} ds2 + name: ${{ matrix.os }} ${{ matrix.arch }} ds2 (building on ${{ inputs.build_os }} ${{ inputs.build_arch }}) steps: - uses: actions/checkout@v4 @@ -441,7 +441,7 @@ jobs: - uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main with: - host_arch: amd64 + host_arch: ${{ inputs.build_arch }} components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' arch: ${{ matrix.arch }} @@ -498,7 +498,7 @@ jobs: fail-fast: false matrix: ${{ fromJSON(inputs.host_matrix) }} - name: ${{ matrix.os }} ${{ matrix.arch }} CMark GFM + name: ${{ matrix.os }} ${{ matrix.arch }} CMark GFM (building on ${{ inputs.build_os }} ${{ inputs.build_arch }}) steps: - uses: actions/checkout@v4 @@ -559,7 +559,7 @@ jobs: run: cmake --build ${{ github.workspace }}/BinaryCache/cmark-gfm-${{ inputs.swift_cmark_version }} --target install - uses: actions/upload-artifact@v4 with: - name: cmark-gfm-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.swift_cmark_version }} + name: cmark-gfm-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.swift_cmark_version }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr build_tools: @@ -570,12 +570,12 @@ jobs: fail-fast: false matrix: ${{ fromJSON(inputs.build_matrix) }} - name: ${{ matrix.os }} ${{ matrix.arch }} Compiler Build Tools + name: ${{ matrix.os }} ${{ matrix.arch }} Compiler Build Tools (building on ${{ inputs.build_os }} ${{ inputs.build_arch }}) steps: - uses: actions/download-artifact@v4 with: - name: cmark-gfm-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.swift_cmark_version }} + name: cmark-gfm-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.swift_cmark_version }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr - uses: actions/checkout@v4 @@ -592,6 +592,10 @@ jobs: show-progress: false - uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main + with: + host_arch: ${{ inputs.build_arch }} + components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' + arch: ${{ matrix.arch }} - uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # master if: inputs.build_os == 'Darwin' @@ -686,7 +690,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: build-tools-${{ matrix.os }} + name: build-tools-${{ matrix.os }}-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: | ${{ steps.export-binary-paths.outputs.llvm_tblgen }} ${{ steps.export-binary-paths.outputs.clang_tblgen }} @@ -827,26 +831,18 @@ 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 }} Toolchain + name: Windows ${{ matrix.arch }} Toolchain (building on ${{ inputs.build_os }} ${{ inputs.build_arch }}) steps: - uses: actions/download-artifact@v4 with: - name: build-tools-Windows + name: build-tools-Windows-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/0/bin - uses: actions/download-artifact@v4 with: - name: cmark-gfm-Windows-${{ matrix.arch }}-${{ inputs.swift_cmark_version }} + name: cmark-gfm-Windows-${{ matrix.arch }}-${{ inputs.swift_cmark_version }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr - uses: actions/checkout@v4 @@ -881,17 +877,19 @@ jobs: show-progress: false - name: Install Python ${{ env.PYTHON_VERSION }} (Host) + if: matrix.arch == 'amd64' || inputs.build_arch == 'amd64' uses: actions/setup-python@v5 id: python with: python-version: '${{ env.PYTHON_VERSION }}' + architecture: x64 - uses: nuget/setup-nuget@v2 - if: matrix.arch == 'arm64' + if: matrix.arch == 'arm64' || inputs.build_arch == 'arm64' # TODO(lxbndr) use actions/cache to improve this step timings - name: Install Python ${{ env.PYTHON_VERSION }} (arm64) - if: matrix.arch == 'arm64' + if: matrix.arch == 'arm64' || inputs.build_arch == 'arm64' run: | $NugetSources=[string](nuget Sources List -Format short) if (-Not ($NugetSources.contains("api.nuget.org"))) { @@ -906,19 +904,29 @@ jobs: - uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main with: - host_arch: amd64 + host_arch: ${{ inputs.build_arch }} components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' arch: ${{ matrix.arch }} - name: Install Swift Toolchain + if: inputs.build_arch == 'amd64' uses: compnerd/gha-setup-swift@b6c5fc1ed5b5439ada8e7661985acb09ad8c3ba2 # main with: github-repo: thebrowsercompany/swift-build github-token: ${{ secrets.GITHUB_TOKEN }} - release-asset-name: installer-amd64.exe + release-asset-name: installer-${{ inputs.build_arch }}.exe release-tag-name: '20231016.5' + - name: Install Swift Toolchain + if: inputs.build_arch == 'arm64' + uses: compnerd/gha-setup-swift@b6c5fc1ed5b5439ada8e7661985acb09ad8c3ba2 # main + with: + github-repo: thebrowsercompany/swift-build + github-token: ${{ secrets.GITHUB_TOKEN }} + release-asset-name: installer-${{ inputs.build_arch }}.exe + release-tag-name: '20231016.0' - uses: nttld/setup-ndk@v1 + if: inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' id: setup-ndk with: ndk-version: ${{ inputs.ANDROID_NDK_VERSION }} @@ -943,8 +951,6 @@ jobs: variant: sccache - name: Configure Compilers - env: - NDKPATH: ${{ steps.setup-ndk.outputs.ndk-path }} run: | if ( "${{ matrix.arch }}" -eq "arm64" ) { $CMAKE_SYSTEM_NAME="-D CMAKE_SYSTEM_NAME=Windows" @@ -1036,7 +1042,7 @@ jobs: - name: Upload Compilers uses: actions/upload-artifact@v4 with: - name: compilers-${{ matrix.arch }} + name: compilers-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library - name: extract swift-syntax @@ -1054,14 +1060,14 @@ jobs: - name: Upload swift-syntax uses: actions/upload-artifact@v4 with: - name: swift-syntax-${{ matrix.arch }} + name: swift-syntax-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/swift-syntax # TODO(compnerd) this takes ~1h due to the size, see if we can compress first - uses: actions/upload-artifact@v4 if: false # ${{ inputs.debug_info }} with: - name: compilers-${{ matrix.arch }}-debug-info + name: compilers-${{ matrix.arch }}-debug-info-built-on-${{ inputs.build_arch }} path: | ${{ github.workspace }}/BinaryCache/1/**/*.pdb @@ -1099,7 +1105,7 @@ jobs: fail-fast: false matrix: ${{ fromJSON(inputs.target_matrix) }} - name: ${{ matrix.os }} ${{ matrix.arch }} zlib + name: ${{ matrix.os }} ${{ matrix.arch }} zlib (building on ${{ inputs.build_os }} ${{ inputs.build_arch }}) steps: - uses: actions/checkout@v4 @@ -1111,7 +1117,7 @@ jobs: - uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main with: - host_arch: amd64 + host_arch: ${{ inputs.build_arch }} components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' arch: ${{ matrix.arch }} @@ -1137,15 +1143,19 @@ jobs: variant: sccache - uses: nttld/setup-ndk@v1 + if: inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' id: setup-ndk with: ndk-version: ${{ inputs.ANDROID_NDK_VERSION }} - name: Configure zlib run: | - $NDKPATH = "${{ steps.setup-ndk.outputs.ndk-path }}" - if ( "${{ inputs.build_os }}" -eq "Windows" ) { - $NDKPATH = cygpath -m $NDKPATH + if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) { + $NDKPATH = "${{ steps.setup-ndk.outputs.ndk-path }}" + if ( "${{ inputs.build_os }}" -eq "Windows" ) { + $NDKPATH = cygpath -m $NDKPATH + } + $CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH" } cmake -B ${{ github.workspace }}/BinaryCache/zlib-${{ inputs.zlib_version }} ` -D BUILD_SHARED_LIBS=NO ` @@ -1158,7 +1168,7 @@ jobs: -D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" ` -D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr ` -D CMAKE_SYSTEM_NAME=${{ matrix.os }} ` - -D CMAKE_ANDROID_NDK=$NDKPATH ` + $CMAKE_NDK_FLAG ` -D CMAKE_POSITION_INDEPENDENT_CODE=YES ` ${{ matrix.extra_flags }} ` -G Ninja ` @@ -1171,7 +1181,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: zlib-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.zlib_version }} + name: zlib-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.zlib_version }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr curl: @@ -1182,7 +1192,7 @@ jobs: fail-fast: false matrix: ${{ fromJSON(inputs.target_matrix) }} - name: ${{ matrix.os }} ${{ matrix.arch }} curl + name: ${{ matrix.os }} ${{ matrix.arch }} curl (building on ${{ inputs.build_os }} ${{ inputs.build_arch }}) steps: - uses: actions/checkout@v4 @@ -1194,12 +1204,12 @@ jobs: - uses: actions/download-artifact@v4 with: - name: zlib-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.zlib_version }} + name: zlib-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.zlib_version }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr - uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main with: - host_arch: amd64 + host_arch: ${{ inputs.build_arch }} components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' arch: ${{ matrix.arch }} @@ -1225,15 +1235,19 @@ jobs: variant: sccache - uses: nttld/setup-ndk@v1 + if: inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' id: setup-ndk with: ndk-version: ${{ inputs.ANDROID_NDK_VERSION }} - name: Configure curl run: | - $NDKPATH = "${{ steps.setup-ndk.outputs.ndk-path }}" - if ( "${{ inputs.build_os }}" -eq "Windows" ) { - $NDKPATH = cygpath -m $NDKPATH + if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) { + $NDKPATH = "${{ steps.setup-ndk.outputs.ndk-path }}" + if ( "${{ inputs.build_os }}" -eq "Windows" ) { + $NDKPATH = cygpath -m $NDKPATH + } + $CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH" } cmake -B ${{ github.workspace }}/BinaryCache/curl-${{ inputs.curl_version }} ` -D BUILD_SHARED_LIBS=NO ` @@ -1328,7 +1342,7 @@ jobs: -D ZLIB_ROOT=${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr ` -D ZLIB_LIBRARY=${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr/lib/zlibstatic.lib ` -D CMAKE_POSITION_INDEPENDENT_CODE=YES ` - -D CMAKE_ANDROID_NDK=$NDKPATH + $CMAKE_NDK_FLAG - name: Build curl run: cmake --build ${{ github.workspace }}/BinaryCache/curl-${{ inputs.curl_version }} - name: Install curl @@ -1336,7 +1350,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: curl-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.curl_version }} + name: curl-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.curl_version }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/curl-${{ inputs.curl_version }}/usr libxml2: @@ -1346,7 +1360,7 @@ jobs: fail-fast: false matrix: ${{ fromJSON(inputs.target_matrix) }} - name: ${{ matrix.os }} ${{ matrix.arch }} libxml2 + name: ${{ matrix.os }} ${{ matrix.arch }} libxml2 (building on ${{ inputs.build_os }} ${{ inputs.build_arch }}) steps: - uses: actions/checkout@v4 @@ -1358,7 +1372,7 @@ jobs: - uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main with: - host_arch: amd64 + host_arch: ${{ inputs.build_arch }} components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' arch: ${{ matrix.arch }} @@ -1385,15 +1399,19 @@ jobs: variant: sccache - uses: nttld/setup-ndk@v1 + if: inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' id: setup-ndk with: ndk-version: ${{ inputs.ANDROID_NDK_VERSION }} - name: Configure libxml2 run: | - $NDKPATH = "${{ steps.setup-ndk.outputs.ndk-path }}" - if ( "${{ inputs.build_os }}" -eq "Windows" ) { - $NDKPATH = cygpath -m $NDKPATH + if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) { + $NDKPATH = "${{ steps.setup-ndk.outputs.ndk-path }}" + if ( "${{ inputs.build_os }}" -eq "Windows" ) { + $NDKPATH = cygpath -m $NDKPATH + } + $CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH" } cmake -B ${{ github.workspace }}/BinaryCache/libxml2-${{ inputs.libxml2_version }} ` -D BUILD_SHARED_LIBS=NO ` @@ -1417,7 +1435,7 @@ jobs: -D LIBXML2_WITH_THREADS=YES ` -D LIBXML2_WITH_ZLIB=NO ` -D CMAKE_POSITION_INDEPENDENT_CODE=YES ` - -D CMAKE_ANDROID_NDK=$NDKPATH + $CMAKE_NDK_FLAG - name: Build libxml2 run: cmake --build ${{ github.workspace }}/BinaryCache/libxml2-${{ inputs.libxml2_version }} - name: Install libxml2 @@ -1425,7 +1443,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: libxml2-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.libxml2_version }} + name: libxml2-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.libxml2_version }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/libxml2-${{ inputs.libxml2_version }}/usr stdlib: @@ -1536,13 +1554,13 @@ jobs: linker_flags: '-D CMAKE_EXE_LINKER_FLAGS="${{ inputs.ANDROID_CMAKE_EXE_LINKER_FLAGS }}" -D CMAKE_SHARED_LINKER_FLAGS="${{ inputs.ANDROID_CMAKE_SHARED_LINKER_FLAGS }}"' extra_flags: -DSWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT=YES -DLLVM_ENABLE_LIBCXX=YES -DSWIFT_USE_LINKER=lld -DCMAKE_ANDROID_API=${{ inputs.ANDROID_API_LEVEL }} -DCMAKE_ANDROID_ARCH_ABI=x86_64 - name: ${{ matrix.os }} ${{ matrix.arch }} Standard Library + name: ${{ matrix.os }} ${{ matrix.arch }} Standard Library (building on ${{ inputs.build_os }} ${{ inputs.build_arch }}) steps: - name: Download Compilers uses: actions/download-artifact@v4 with: - name: compilers-amd64 + name: compilers-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library - uses: actions/checkout@v4 with: @@ -1574,32 +1592,46 @@ jobs: # we have not yet built the runtime, this requires that we use the runtime # from the previous build. - name: Install Swift Toolchain + if: inputs.build_arch == 'amd64' uses: compnerd/gha-setup-swift@b6c5fc1ed5b5439ada8e7661985acb09ad8c3ba2 # main with: github-repo: thebrowsercompany/swift-build github-token: ${{ secrets.GITHUB_TOKEN }} - release-asset-name: installer-amd64.exe + release-asset-name: installer-${{ inputs.build_arch }}.exe release-tag-name: '20231016.5' + - name: Install Swift Toolchain + if: inputs.build_arch == 'arm64' + uses: compnerd/gha-setup-swift@b6c5fc1ed5b5439ada8e7661985acb09ad8c3ba2 # main + with: + github-repo: thebrowsercompany/swift-build + github-token: ${{ secrets.GITHUB_TOKEN }} + release-asset-name: installer-${{ inputs.build_arch }}.exe + release-tag-name: '20231016.0' # NOTE(compnerd): we execute unconditionally as we use CMake from VSDevEnv - uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main with: - host_arch: amd64 + host_arch: ${{ inputs.build_arch }} 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: inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' id: setup-ndk with: ndk-version: ${{ inputs.ANDROID_NDK_VERSION }} - name: Configure LLVM + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' run: | # NOTE: used by `matrix.cc` $CLANG_CL = "cl" - $NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} - + if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) { + $NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} + $CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH" + $SWIFT_NDK_FLAG = "-DSWIFT_ANDROID_NDK_PATH=$NDKPATH" + } cmake -B ${{ github.workspace }}/BinaryCache/llvm ` -D CMAKE_BUILD_TYPE=Release ` -D CMAKE_C_COMPILER=${{ matrix.cc }} ` @@ -1611,19 +1643,24 @@ jobs: -D CMAKE_SYSTEM_NAME=${{ matrix.os }} ` ${{ matrix.llvm_flags }} ` ${{ matrix.extra_flags }} ` - -D CMAKE_ANDROID_NDK=${NDKPATH} ` - -D SWIFT_ANDROID_NDK_PATH=${NDKPATH} ` + $CMAKE_NDK_FLAG ` + $SWIFT_NDK_FLAG ` -G Ninja ` -S ${{ github.workspace }}/SourceCache/llvm-project/llvm ` -D LLVM_ENABLE_ASSERTIONS=YES - name: Configure Swift Standard Library + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' run: | # NOTE: used by `matrix.cc` $CLANG_CL = cygpath -m ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe $SWIFTC = cygpath -m ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe - $NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} + if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) { + $NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} + $CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH" + $SWIFT_NDK_FLAG = "-DSWIFT_ANDROID_NDK_PATH=$NDKPATH" + } $CMAKE_CPU = if ("${{ matrix.cpu }}" -eq "armv7") { "armv7-a" @@ -1653,8 +1690,8 @@ jobs: -D MSVC_CXX_ARCHITECTURE_ID=${{ matrix.arch }} ` ${{ matrix.linker_flags }} ` ${{ matrix.extra_flags }} ` - -D CMAKE_ANDROID_NDK=${NDKPATH} ` - -D SWIFT_ANDROID_NDK_PATH=${NDKPATH} ` + $CMAKE_NDK_FLAG ` + $SWIFT_NDK_FLAG ` -G Ninja ` -S ${{ github.workspace }}/SourceCache/swift ` -D LLVM_DIR=${{ github.workspace }}/BinaryCache/llvm/lib/cmake/llvm ` @@ -1671,23 +1708,26 @@ jobs: -D SWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE=${{ github.workspace }}/SourceCache/swift-syntax ` -D SWIFT_PATH_TO_STRING_PROCESSING_SOURCE=${{ github.workspace }}/SourceCache/swift-experimental-string-processing - name: Build Swift Standard Library + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' run: | Remove-Item env:\SDKROOT cmake --build ${{ github.workspace }}/BinaryCache/swift - name: Install Swift Standard Library + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' run: | Remove-Item env:\SDKROOT cmake --build ${{ github.workspace }}/BinaryCache/swift --target install - uses: actions/upload-artifact@v4 + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' with: - name: ${{ matrix.os }}-stdlib-${{ matrix.arch }} + name: ${{ matrix.os }}-stdlib-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/${{ matrix.os }}.platform - uses: actions/upload-artifact@v4 if: matrix.os == 'Windows' with: - name: windows-vfs-overlay-${{ matrix.arch }} + name: windows-vfs-overlay-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml - name: Upload PDBs to Azure @@ -1726,31 +1766,31 @@ jobs: cpu: 'aarch64' triple: 'aarch64-unknown-windows-msvc' - name: Windows ${{ matrix.arch }} Macros + name: Windows ${{ matrix.arch }} Macros (building on ${{ inputs.build_os }} ${{ inputs.build_arch }}) steps: - name: Download Compilers uses: actions/download-artifact@v4 with: - name: compilers-amd64 + name: compilers-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/Library - name: Download swift-syntax uses: actions/download-artifact@v4 with: - name: swift-syntax-${{ matrix.arch }} + name: swift-syntax-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/swift-syntax - uses: actions/download-artifact@v4 with: - name: Windows-stdlib-${{ matrix.arch }} + name: Windows-stdlib-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform - uses: actions/download-artifact@v4 if: matrix.arch == 'arm64' with: - name: Windows-stdlib-amd64 + name: Windows-stdlib-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform - uses: actions/download-artifact@v4 with: - name: windows-vfs-overlay-${{ matrix.arch }} + name: windows-vfs-overlay-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/swift/stdlib - uses: actions/checkout@v4 with: @@ -1774,7 +1814,7 @@ jobs: # NOTE(compnerd): we execute unconditionally as we use CMake from VSDevEnv - uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main with: - host_arch: amd64 + host_arch: ${{ inputs.build_arch }} components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' arch: ${{ matrix.arch }} @@ -1835,7 +1875,7 @@ jobs: - name: Upload macros uses: actions/upload-artifact@v4 with: - name: macros-${{ matrix.arch }} + name: macros-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library - name: Upload PDBs to Azure @@ -1957,43 +1997,47 @@ jobs: linker_flags: '-D CMAKE_EXE_LINKER_FLAGS="${{ inputs.ANDROID_CMAKE_EXE_LINKER_FLAGS }}" -D CMAKE_SHARED_LINKER_FLAGS="${{ inputs.ANDROID_CMAKE_SHARED_LINKER_FLAGS }}"' extra_flags: -DSWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT=YES -DLLVM_ENABLE_LIBCXX=YES -DSWIFT_USE_LINKER=lld -DCMAKE_ANDROID_API=${{ inputs.ANDROID_API_LEVEL }} -DCMAKE_ANDROID_ARCH_ABI=x86_64 - name: ${{ matrix.os }} ${{ matrix.arch }} SDK + name: ${{ matrix.os }} ${{ matrix.arch }} SDK (building on ${{ inputs.build_os }} ${{ inputs.build_arch }}) steps: - uses: actions/download-artifact@v4 + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' with: - name: libxml2-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.libxml2_version }} + name: libxml2-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.libxml2_version }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/libxml2-${{ inputs.libxml2_version }}/usr - uses: actions/download-artifact@v4 + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' with: - name: curl-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.curl_version }} + name: curl-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.curl_version }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/curl-${{ inputs.curl_version }}/usr - uses: actions/download-artifact@v4 + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' with: - name: zlib-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.zlib_version }} + name: zlib-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.zlib_version }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr - name: Download Compilers uses: actions/download-artifact@v4 with: - name: compilers-amd64 + name: compilers-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/Library - uses: actions/download-artifact@v4 + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' with: - name: ${{ matrix.os }}-stdlib-${{ matrix.arch }} + name: ${{ matrix.os }}-stdlib-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform - uses: actions/download-artifact@v4 with: - name: Windows-stdlib-amd64 + name: Windows-stdlib-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform - uses: actions/download-artifact@v4 if: matrix.os == 'Windows' with: - name: windows-vfs-overlay-${{ matrix.arch }} + name: windows-vfs-overlay-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/swift/stdlib - uses: actions/download-artifact@v4 with: - name: macros-amd64 + name: macros-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/Library - uses: actions/checkout@v4 with: @@ -2056,7 +2100,7 @@ jobs: # NOTE(compnerd): we execute unconditionally as we use CMake from VSDevEnv - uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main with: - host_arch: amd64 + host_arch: ${{ inputs.build_arch }} components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' arch: ${{ matrix.arch }} @@ -2067,17 +2111,23 @@ jobs: # NOTE(compnerd): we execute unconditionally as we reference outputs - uses: nttld/setup-ndk@v1 + if: inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' id: setup-ndk with: ndk-version: ${{ inputs.ANDROID_NDK_VERSION }} - name: Configure libdispatch + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' run: | # Workaround CMake 3.20 issue $CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe $SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe - $NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} + if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) { + $NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} + $CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH" + $SWIFT_NDK_FLAG = "-DSWIFT_ANDROID_NDK_PATH=$NDKPATH" + } $WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml $OVERLAY_FLAGS = if ("${{ matrix.os }}" -eq "Windows") { @@ -2109,23 +2159,29 @@ jobs: -D MSVC_CXX_ARCHITECTURE_ID=${{ matrix.arch }} ` ${{ matrix.linker_flags }} ` ${{ matrix.extra_flags }} ` - -D CMAKE_ANDROID_NDK=$NDKPATH ` - -D SWIFT_ANDROID_NDK_PATH=$NDKPATH ` + $CMAKE_NDK_FLAG ` + $SWIFT_NDK_FLAG ` -G Ninja ` -S ${{ github.workspace }}/SourceCache/swift-corelibs-libdispatch ` -D BUILD_TESTING=NO ` -D ENABLE_SWIFT=YES - name: Build libdispatch + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' run: | cmake --build ${{ github.workspace }}/BinaryCache/libdispatch - name: Configure Foundation + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' run: | # Workaround CMake 3.20 issue $CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe $SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe - $NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} + if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) { + $NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} + $CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH" + $SWIFT_NDK_FLAG = "-DSWIFT_ANDROID_NDK_PATH=$NDKPATH" + } $WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml $OVERLAY_FLAGS = if ("${{ matrix.os }}" -eq "Windows") { @@ -2170,8 +2226,8 @@ jobs: -D MSVC_CXX_ARCHITECTURE_ID=${{ matrix.arch }} ` ${{ matrix.linker_flags }} ` ${{ matrix.extra_flags }} ` - -D CMAKE_ANDROID_NDK=$NDKPATH ` - -D SWIFT_ANDROID_NDK_PATH=$NDKPATH ` + $CMAKE_NDK_FLAG ` + $SWIFT_NDK_FLAG ` -G Ninja ` -S ${{ github.workspace }}/SourceCache/swift-corelibs-foundation ` -D dispatch_DIR=${{ github.workspace }}/BinaryCache/libdispatch/cmake/modules ` @@ -2189,17 +2245,23 @@ jobs: -D ZLIB_LIBRARY=${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr/lib/$LIBZ ` -D SwiftFoundation_MACRO=${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin - name: Build foundation + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' run: | cmake --build ${{ github.workspace }}/BinaryCache/foundation # TODO(compnerd) correctly version XCTest - name: Configure xctest + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' run: | # Workaround CMake 3.20 issue $CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe $SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe - $NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} + if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) { + $NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} + $CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH" + $SWIFT_NDK_FLAG = "-DSWIFT_ANDROID_NDK_PATH=$NDKPATH" + } $WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml $OVERLAY_FLAGS = if ("${{ matrix.os }}" -eq "Windows") { @@ -2230,24 +2292,30 @@ jobs: -D CMAKE_SYSTEM_PROCESSOR=${CMAKE_CPU} ` ${{ matrix.linker_flags }} ` ${{ matrix.extra_flags }} ` - -D CMAKE_ANDROID_NDK=$NDKPATH ` - -D SWIFT_ANDROID_NDK_PATH=$NDKPATH ` + $CMAKE_NDK_FLAG ` + $SWIFT_NDK_FLAG ` -G Ninja ` -S ${{ github.workspace }}/SourceCache/swift-corelibs-xctest ` -D dispatch_DIR=${{ github.workspace }}/BinaryCache/libdispatch/cmake/modules ` -D Foundation_DIR=${{ github.workspace }}/BinaryCache/foundation/cmake/modules ` -D ENABLE_TESTING=NO - name: Build xctest + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' run: | cmake --build ${{ github.workspace }}/BinaryCache/xctest - name: Configure Testing + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' run: | # Workaround CMake 3.20 issue $CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe $SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe - $NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} + if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) { + $NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} + $CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH" + $SWIFT_NDK_FLAG = "-DSWIFT_ANDROID_NDK_PATH=$NDKPATH" + } $WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml $OVERLAY_FLAGS = if ("${{ matrix.os }}" -eq "Windows") { @@ -2277,32 +2345,38 @@ jobs: -D CMAKE_SYSTEM_PROCESSOR=${CMAKE_CPU} ` ${{ matrix.linker_flags }} ` ${{ matrix.extra_flags }} ` - -D CMAKE_ANDROID_NDK=${NDKPATH} ` - -D SWIFT_ANDROID_NDK_PATH=${NDKPATH} ` + $CMAKE_NDK_FLAG ` + $SWIFT_NDK_FLAG ` -G Ninja ` -S ${{ github.workspace }}/SourceCache/swift-testing ` -D dispatch_DIR=${{ github.workspace }}/BinaryCache/libdispatch/cmake/modules ` -D Foundation_DIR=${{ github.workspace }}/BinaryCache/foundation/cmake/modules ` -D SwiftTesting_MACRO=${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/TestingMacros.dll - name: Build Testing + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' run: | cmake --build ${{ github.workspace }}/BinaryCache/testing - name: Install Testing + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' run: | cmake --build ${{ github.workspace }}/BinaryCache/testing --target install - name: Install xctest + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' run: | cmake --build ${{ github.workspace }}/BinaryCache/xctest --target install - name: Install foundation + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' run: | cmake --build ${{ github.workspace }}/BinaryCache/foundation --target install - name: Install libdispatch + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' run: | cmake --build ${{ github.workspace }}/BinaryCache/libdispatch --target install - uses: actions/setup-python@v5 - uses: jannekem/run-python-script-action@v1 + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' with: script: | import os @@ -2320,8 +2394,9 @@ jobs: plistlib.dump({ 'DefaultProperties': { 'DEFAULT_USE_RUNTIME': 'MD' } }, plist) - uses: actions/upload-artifact@v4 + if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64' with: - name: ${{ matrix.os }}-sdk-${{ matrix.arch }} + name: ${{ matrix.os }}-sdk-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/${{ matrix.os }}.platform - name: Upload PDBs to Azure @@ -2350,48 +2425,40 @@ 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 }} Developer Tools + name: Windows ${{ matrix.arch }} Developer Tools (building on ${{ inputs.build_os }} ${{ inputs.build_arch }}) steps: - uses: actions/download-artifact@v4 with: - name: sqlite-Windows-${{ matrix.arch }}-${{ inputs.swift_toolchain_sqlite_version }} + name: sqlite-Windows-${{ matrix.arch }}-${{ inputs.swift_toolchain_sqlite_version }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr - name: Download Compilers uses: actions/download-artifact@v4 with: - name: compilers-amd64 + name: compilers-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/Library - uses: actions/download-artifact@v4 with: - name: Windows-stdlib-${{ matrix.arch }} + name: Windows-stdlib-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform - uses: actions/download-artifact@v4 with: - name: Windows-sdk-${{ matrix.arch }} + name: Windows-sdk-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform - uses: actions/download-artifact@v4 with: - name: macros-amd64 + name: macros-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/Library - uses: actions/download-artifact@v4 with: - name: swift-syntax-${{ matrix.arch }} + name: swift-syntax-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/swift-syntax - uses: actions/download-artifact@v4 with: - name: cmark-gfm-Windows-${{ matrix.arch }}-${{ inputs.swift_cmark_version }} + name: cmark-gfm-Windows-${{ matrix.arch }}-${{ inputs.swift_cmark_version }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr - uses: actions/checkout@v4 @@ -2500,7 +2567,7 @@ jobs: - uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main with: - host_arch: amd64 + host_arch: ${{ inputs.build_arch }} components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' arch: ${{ matrix.arch }} @@ -2524,11 +2591,11 @@ jobs: # Download host libraries for the windows amd64 host, after moving the target libraries to the target-specific directory. - uses: actions/download-artifact@v4 with: - name: Windows-stdlib-amd64 + name: Windows-stdlib-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform - uses: actions/download-artifact@v4 with: - name: Windows-sdk-amd64 + name: Windows-sdk-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform - name: Configure swift-argument-parser @@ -3023,7 +3090,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: devtools-${{ matrix.arch }} + name: devtools-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library - name: Upload PDBs to Azure @@ -3061,37 +3128,30 @@ 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 }} Debugging Tools + name: Windows ${{ matrix.arch }} Debugging Tools (building on ${{ inputs.build_os }} ${{ inputs.build_arch }}) steps: - name: Download Compilers uses: actions/download-artifact@v4 with: - name: compilers-amd64 + name: compilers-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library - name: Download Devtools uses: actions/download-artifact@v4 with: - name: devtools-amd64 + name: devtools-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library - name: Download stdlib uses: actions/download-artifact@v4 with: - name: Windows-stdlib-${{ matrix.arch }} + name: Windows-stdlib-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform - name: Download SDK uses: actions/download-artifact@v4 with: - name: Windows-sdk-${{ matrix.arch }} + name: Windows-sdk-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform - name: Update environment variables @@ -3126,11 +3186,11 @@ jobs: # Download host SDK on top of the target SDK, so that the runtime DLLs are the host ones. - uses: actions/download-artifact@v4 with: - name: Windows-stdlib-amd64 + name: Windows-stdlib-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform - uses: actions/download-artifact@v4 with: - name: Windows-sdk-amd64 + name: Windows-sdk-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform - name: Move host libs to the host architecture directory @@ -3190,7 +3250,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: debugging_tools-${{ matrix.arch }} + name: debugging_tools-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot-DebuggingTools package_tools: @@ -3202,32 +3262,32 @@ jobs: strategy: fail-fast: false - matrix: - arch: ['amd64' , 'arm64'] + + matrix: ${{ fromJSON(inputs.host_matrix) }} steps: - name: Download Debugging Tools uses: actions/download-artifact@v4 with: - name: debugging_tools-${{ matrix.arch }} + name: debugging_tools-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/DebuggingTools - name: Download Compilers uses: actions/download-artifact@v4 with: - name: compilers-${{ matrix.arch }} + name: compilers-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library - name: Download Developer Tools uses: actions/download-artifact@v4 with: - name: devtools-${{ matrix.arch }} + name: devtools-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library - name: Download Macros uses: actions/download-artifact@v4 with: - name: macros-${{ matrix.arch }} + name: macros-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library - uses: actions/checkout@v4 @@ -3239,7 +3299,7 @@ jobs: - uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main with: - host_arch: amd64 + host_arch: ${{ inputs.build_arch }} components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' arch: ${{ matrix.arch }} @@ -3349,25 +3409,25 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: bld-${{ matrix.arch }}-msi + name: bld-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }} path: | ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/bld.msi ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/bld.cab - uses: actions/upload-artifact@v4 with: - name: cli-${{ matrix.arch }}-msi + name: cli-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }} path: | ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/cli.msi ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/cli.cab - uses: actions/upload-artifact@v4 with: - name: dbg-${{ matrix.arch }}-msi + name: dbg-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }} path: | ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/dbg.msi ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/dbg.cab - uses: actions/upload-artifact@v4 with: - name: ide-${{ matrix.arch }}-msi + name: ide-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }} path: | ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/ide.msi ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/ide.cab @@ -3393,11 +3453,11 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - name: Windows-stdlib-${{ matrix.arch }} + name: Windows-stdlib-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform - uses: actions/download-artifact@v4 with: - name: Windows-sdk-${{ matrix.arch }} + name: Windows-sdk-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform - uses: actions/checkout@v4 @@ -3409,7 +3469,7 @@ jobs: - uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main with: - host_arch: amd64 + host_arch: ${{ inputs.build_arch }} components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' arch: ${{ matrix.arch }} @@ -3458,26 +3518,26 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: sdk-windows-${{ matrix.arch }}-msi + name: sdk-windows-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }} path: | ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/sdk.${{ matrix.arch }}.msi ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/sdk.${{ matrix.arch }}.cab - uses: actions/upload-artifact@v4 with: - name: rtl-windows-${{ matrix.arch }}-msi + name: rtl-windows-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }} path: | ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/rtl.msi ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/rtl.cab - uses: actions/upload-artifact@v4 with: - name: rtl-windows-${{ matrix.arch }}-msm + name: rtl-windows-${{ matrix.arch }}-msm-built-on-${{ inputs.build_arch }} path: | ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/rtl.${{ matrix.arch }}.msm ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/rtl.${{ matrix.arch }}.cab package_android_sdk_runtime: # TODO: Build this on macOS or make an equivalent Mac-only job - if: inputs.build_os == 'Windows' + if: inputs.build_os == 'Windows' && inputs.build_arch == 'amd64' name: Package Android SDK & Runtime needs: [stdlib, ds2, sdk] runs-on: ${{ inputs.default_build_runner }} @@ -3502,11 +3562,11 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - name: Android-stdlib-${{ matrix.arch }} + name: Android-stdlib-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform - uses: actions/download-artifact@v4 with: - name: Android-sdk-${{ matrix.arch }} + name: Android-sdk-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform - uses: actions/download-artifact@v4 @@ -3523,7 +3583,7 @@ jobs: - uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main with: - host_arch: amd64 + host_arch: ${{ inputs.build_arch }} components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' arch: ${{ matrix.arch }} @@ -3547,7 +3607,7 @@ jobs: -p:BaseOutputPath=${{ github.workspace }}\BinaryCache\installer\ ` -p:Configuration=Release ` -p:SignOutput=${{ inputs.signed }} ` - -p:ANDROID_INCLUDE_DS2=true ` + -p:ANDROID_INCLUDE_DS2=${{ inputs.build_arch == 'amd64' && true || false }} ` -p:CERTIFICATE=${env:CERTIFICATE} ` -p:PASSPHRASE=${{ secrets.PASSPHRASE }} ` -p:PLATFORM_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform ` @@ -3558,7 +3618,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: sdk-android-${{ matrix.arch }}-msi + name: sdk-android-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }} path: | ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.cpu }}/android_sdk.${{ matrix.cpu }}.msi ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.cpu }}/android_sdk.${{ matrix.cpu }}.cab @@ -3571,69 +3631,72 @@ jobs: strategy: fail-fast: false - matrix: - arch: ['amd64' , 'arm64'] + matrix: ${{ fromJSON(inputs.host_matrix) }} steps: - uses: actions/download-artifact@v4 with: - name: bld-${{ matrix.arch }}-msi + name: bld-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }} - uses: actions/download-artifact@v4 with: - name: cli-${{ matrix.arch }}-msi + name: cli-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }} - uses: actions/download-artifact@v4 with: - name: dbg-${{ matrix.arch }}-msi + name: dbg-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }} - uses: actions/download-artifact@v4 with: - name: ide-${{ matrix.arch }}-msi + name: ide-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }} - uses: actions/download-artifact@v4 with: - name: rtl-windows-${{ matrix.arch }}-msi + name: rtl-windows-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }} - uses: actions/download-artifact@v4 with: - name: rtl-windows-amd64-msm + name: rtl-windows-amd64-msm-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/installer/Release/amd64 - uses: actions/download-artifact@v4 with: - name: rtl-windows-x86-msm + name: rtl-windows-x86-msm-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/installer/Release/x86 - uses: actions/download-artifact@v4 with: - name: rtl-windows-arm64-msm + name: rtl-windows-arm64-msm-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/installer/Release/arm64 - uses: actions/download-artifact@v4 with: - name: sdk-windows-amd64-msi + name: sdk-windows-amd64-msi-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/installer/Release/amd64 - uses: actions/download-artifact@v4 with: - name: sdk-windows-x86-msi + name: sdk-windows-x86-msi-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/installer/Release/x86 - uses: actions/download-artifact@v4 with: - name: sdk-windows-arm64-msi + name: sdk-windows-arm64-msi-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/installer/Release/arm64 - uses: actions/download-artifact@v4 + if: inputs.build_arch == 'amd64' with: - name: sdk-android-arm64-msi + name: sdk-android-arm64-msi-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/installer/Release/aarch64 - uses: actions/download-artifact@v4 + if: inputs.build_arch == 'amd64' with: - name: sdk-android-x86_64-msi + name: sdk-android-x86_64-msi-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/installer/Release/x86_64 - uses: actions/download-artifact@v4 + if: inputs.build_arch == 'amd64' with: - name: sdk-android-armv7-msi + name: sdk-android-armv7-msi-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/installer/Release/armv7 - uses: actions/download-artifact@v4 + if: inputs.build_arch == 'amd64' with: - name: sdk-android-i686-msi + name: sdk-android-i686-msi-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/installer/Release/i686 - uses: actions/checkout@v4 @@ -3645,7 +3708,7 @@ jobs: - uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main with: - host_arch: amd64 + host_arch: ${{ inputs.build_arch }} components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' arch: ${{ matrix.arch }} @@ -3689,17 +3752,17 @@ jobs: -p:INCLUDE_AMD64_SDK=true ` -p:INCLUDE_X86_SDK=true ` -p:INCLUDE_ARM64_SDK=true ` - -p:ANDROID_INCLUDE_ARM64_SDK=true ` - -p:ANDROID_INCLUDE_x86_64_SDK=true ` - -p:ANDROID_INCLUDE_ARM_SDK=true ` - -p:ANDROID_INCLUDE_X86_SDK=true ` + -p:ANDROID_INCLUDE_ARM64_SDK=${{ inputs.build_arch == 'amd64' && true || false }} ` + -p:ANDROID_INCLUDE_x86_64_SDK=${{ inputs.build_arch == 'amd64' && true || false }} ` + -p:ANDROID_INCLUDE_ARM_SDK=${{ inputs.build_arch == 'amd64' && true || false }} ` + -p:ANDROID_INCLUDE_X86_SDK=${{ inputs.build_arch == 'amd64' && true || false }} ` -p:ProductArchitecture=${{ matrix.arch }} ` -p:ProductVersion=${{ inputs.swift_version }}-${{ inputs.swift_tag }} ` ${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/bundle/installer.wixproj - uses: actions/upload-artifact@v4 with: - name: installer-${{ matrix.arch }} + name: installer-${{ matrix.arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/installer.exe smoke_test: @@ -3711,7 +3774,7 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - name: installer-amd64 + name: installer-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }} path: ${{ github.workspace }}/tmp # TODO(compnerd): migrate this to compnerd/gha-setup-swift after the work that @mangini is doing is completed