rewords toolchain -development to 0.0.0 #233
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Swift Toolchain Build | ||
on: | ||
workflow_call: | ||
inputs: | ||
build_os: | ||
required: true | ||
type: string | ||
build_arch: | ||
required: true | ||
type: string | ||
build_matrix: | ||
required: true | ||
type: string | ||
host_matrix: | ||
required: true | ||
type: string | ||
target_matrix: | ||
required: true | ||
type: string | ||
curl_revision: | ||
required: true | ||
type: string | ||
curl_version: | ||
required: true | ||
type: string | ||
ds2_revision: | ||
required: true | ||
type: string | ||
indexstore_db_revision: | ||
required: true | ||
type: string | ||
libxml2_revision: | ||
required: true | ||
type: string | ||
libxml2_version: | ||
required: true | ||
type: string | ||
llvm_project_revision: | ||
required: true | ||
type: string | ||
mimalloc_revision: | ||
required: true | ||
type: string | ||
sourcekit_lsp_revision: | ||
required: true | ||
type: string | ||
swift_argument_parser_revision: | ||
required: true | ||
type: string | ||
swift_asn1_revision: | ||
required: true | ||
type: string | ||
swift_atomics_revision: | ||
required: true | ||
type: string | ||
swift_build_revision: | ||
required: true | ||
type: string | ||
swift_certificates_revision: | ||
required: true | ||
type: string | ||
swift_cmark_revision: | ||
required: true | ||
type: string | ||
swift_cmark_version: | ||
required: true | ||
type: string | ||
swift_collections_revision: | ||
required: true | ||
type: string | ||
swift_corelibs_foundation_revision: | ||
required: true | ||
type: string | ||
swift_corelibs_libdispatch_revision: | ||
required: true | ||
type: string | ||
swift_corelibs_xctest_revision: | ||
required: true | ||
type: string | ||
swift_crypto_revision: | ||
required: true | ||
type: string | ||
swift_driver_revision: | ||
required: true | ||
type: string | ||
swift_experimental_string_processing_revision: | ||
required: true | ||
type: string | ||
swift_format_revision: | ||
required: true | ||
type: string | ||
swift_foundation_revision: | ||
required: true | ||
type: string | ||
swift_foundation_icu_revision: | ||
required: true | ||
type: string | ||
swift_installer_scripts_revision: | ||
required: true | ||
type: string | ||
swift_llbuild_revision: | ||
required: true | ||
type: string | ||
swift_lmdb_revision: | ||
required: true | ||
type: string | ||
swift_markdown_revision: | ||
required: true | ||
type: string | ||
swift_package_manager_revision: | ||
required: true | ||
type: string | ||
swift_revision: | ||
required: true | ||
type: string | ||
swift_syntax_revision: | ||
required: true | ||
type: string | ||
swift_system_revision: | ||
required: true | ||
type: string | ||
swift_testing_revision: | ||
required: true | ||
type: string | ||
swift_toolchain_sqlite_revision: | ||
required: true | ||
type: string | ||
swift_toolchain_sqlite_version: | ||
required: true | ||
type: string | ||
swift_tools_support_core_revision: | ||
required: true | ||
type: string | ||
zlib_revision: | ||
required: true | ||
type: string | ||
zlib_version: | ||
required: true | ||
type: string | ||
ANDROID_API_LEVEL: | ||
required: true | ||
type: string | ||
ANDROID_NDK_VERSION: | ||
required: true | ||
type: string | ||
WINDOWS_CMAKE_C_FLAGS: | ||
required: true | ||
type: string | ||
WINDOWS_CMAKE_CXX_FLAGS: | ||
required: true | ||
type: string | ||
WINDOWS_CMAKE_EXE_LINKER_FLAGS: | ||
required: true | ||
type: string | ||
WINDOWS_CMAKE_SHARED_LINKER_FLAGS: | ||
required: true | ||
type: string | ||
ANDROID_CMAKE_C_FLAGS: | ||
required: true | ||
type: string | ||
ANDROID_CMAKE_CXX_FLAGS: | ||
required: true | ||
type: string | ||
ANDROID_CMAKE_EXE_LINKER_FLAGS: | ||
required: true | ||
type: string | ||
ANDROID_CMAKE_SHARED_LINKER_FLAGS: | ||
required: true | ||
type: string | ||
CMAKE_Swift_FLAGS: | ||
required: true | ||
type: string | ||
debug_info: | ||
required: true | ||
type: boolean | ||
signed: | ||
required: true | ||
type: boolean | ||
swift_version: | ||
required: true | ||
type: string | ||
swift_tag: | ||
required: true | ||
type: string | ||
default_build_runner: | ||
required: true | ||
type: string | ||
compilers_build_runner: | ||
required: true | ||
type: string | ||
build_android: | ||
required: false | ||
default: false | ||
type: boolean | ||
secrets: | ||
SYMBOL_SERVER_PAT: | ||
required: true | ||
CERTIFICATE: | ||
required: true | ||
PASSPHRASE: | ||
required: true | ||
env: | ||
SCCACHE_DIRECT: on | ||
# Workaround for needing llvm-17 on macOS preventing us from using the 5.10 toolchain release. | ||
WORKAROUND_MACOS_PINNED_BOOTSTRAP_TOOLCHAIN_BRANCH: swift-6.0.1-release | ||
WORKAROUND_MACOS_PINNED_BOOTSTRAP_TOOLCHAIN_TAG: 6.0.1-RELEASE | ||
# Workaround for the upstream builds are still built with VS versions (17.9.x and 17.10.x) | ||
# with the ARM64 miscompile bug. | ||
WORKAROUND_WINDOWS_PINNED_BOOTSTRAP_TOOLCHAIN_REPO: thebrowsercompany/swift-build | ||
WORKAROUND_WINDOWS_PINNED_BOOTSTRAP_TOOLCHAIN_RELEASE: swift-6.0.0-20241216.0 | ||
defaults: | ||
run: | ||
shell: pwsh | ||
jobs: | ||
sqlite: | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(inputs.host_matrix) }} | ||
name: ${{ matrix.os }} ${{ matrix.arch }} SQLite3 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: ${{ github.workspace }}/SourceCache/swift-build | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-toolchain-sqlite | ||
ref: ${{ inputs.swift_toolchain_sqlite_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-toolchain-sqlite | ||
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' | ||
- name: Compute workspace hash | ||
id: workspace_hash | ||
run: | | ||
$stringAsStream = [System.IO.MemoryStream]::new() | ||
$writer = [System.IO.StreamWriter]::new($stringAsStream) | ||
$writer.write("${{ github.workspace }}") | ||
$writer.Flush() | ||
$stringAsStream.Position = 0 | ||
$hash = (Get-FileHash -Algorithm SHA256 -InputStream $stringAsStream).Hash | ||
echo "hash=$hash" >> $env:GITHUB_OUTPUT | ||
- name: Setup sccache | ||
uses: hendrikmuhs/ccache-action@2e0e89e8d74340a03f75d58d02aae4c5ee1b15c6 | ||
with: | ||
max-size: 100M | ||
key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-sqlite | ||
variant: sccache | ||
- name: Configure SQLite | ||
run: | | ||
cmake -B ${{ github.workspace }}/BinaryCache/sqlite-${{ inputs.swift_toolchain_sqlite_version }} ` | ||
-D BUILD_SHARED_LIBS=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${{ matrix.cc }} ` | ||
-D CMAKE_C_COMPILER_LAUNCHER=sccache ` | ||
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" ` | ||
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} ` | ||
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache ` | ||
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr ` | ||
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} ` | ||
${{ matrix.extra_flags }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-toolchain-sqlite | ||
- name: Build SQLite | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/sqlite-${{ inputs.swift_toolchain_sqlite_version }} | ||
- name: Install SQLite | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/sqlite-${{ inputs.swift_toolchain_sqlite_version }} --target install | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: sqlite-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.swift_toolchain_sqlite_version }} | ||
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 | ||
runs-on: ${{ inputs.default_build_runner }} | ||
name: ds2 Build Tools | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# There is currently no Android NDK for Windows ARM64 so build ds2_tools only on Windows X64 host only | ||
if: inputs.build_android | ||
with: | ||
repository: compnerd/ds2 | ||
ref: ${{ inputs.ds2_revision }} | ||
path: ${{ github.workspace }}/SourceCache/ds2 | ||
show-progress: false | ||
- uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main | ||
if: inputs.build_android | ||
with: | ||
host_arch: ${{ inputs.build_arch }} | ||
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' | ||
arch: amd64 | ||
# TODO(issues/205): Preload Chocolatey package manager on Azure images so we can remove this step. | ||
- uses: andrurogerz/ensure-chocolatey@v1 | ||
if: inputs.build_android | ||
- name: Install Flex and Bison Tools | ||
run: choco install winflexbison3 | ||
if: inputs.build_android | ||
- name: Configure RegsGen2 | ||
if: inputs.build_android | ||
run: | | ||
cmake -B ${{ github.workspace }}/BinaryCache/RegsGen2 ` | ||
-S ${{ github.workspace }}/SourceCache/ds2/Tools/RegsGen2 ` | ||
-C ${{ github.workspace }}/SourceCache/ds2/cmake/caches/MSVCWarnings.cmake ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=cl ` | ||
-D CMAKE_CXX_COMPILER=cl ` | ||
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" ` | ||
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }}" ` | ||
-G Ninja | ||
- name: Build RegsGen2 | ||
if: inputs.build_android | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/RegsGen2 --config Release | ||
- uses: actions/upload-artifact@v4 | ||
if: inputs.build_android | ||
with: | ||
name: windows-regsgen2 | ||
path: | | ||
${{ github.workspace }}/BinaryCache/RegsGen2/regsgen2.exe | ||
ds2: | ||
# TODO: Build this on macOS or make an equivalent Mac-only job | ||
needs: [ds2_tools] | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- arch: arm64 | ||
cc: clang | ||
cflags: ${{ inputs.ANDROID_CMAKE_C_FLAGS }} | ||
cxx: clang++ | ||
cxxflags: ${{ inputs.ANDROID_CMAKE_CXX_FLAGS }} | ||
os: Android | ||
extra_flags: -DCMAKE_ANDROID_API=${{ inputs.ANDROID_API_LEVEL }} -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a | ||
- arch: armv7 | ||
cc: clang | ||
cflags: ${{ inputs.ANDROID_CMAKE_C_FLAGS }} | ||
cxx: clang++ | ||
cxxflags: ${{ inputs.ANDROID_CMAKE_CXX_FLAGS }} | ||
os: Android | ||
extra_flags: -DCMAKE_ANDROID_API=${{ inputs.ANDROID_API_LEVEL }} -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a | ||
- arch: i686 | ||
cc: clang | ||
cflags: ${{ inputs.ANDROID_CMAKE_C_FLAGS }} | ||
cxx: clang++ | ||
cxxflags: ${{ inputs.ANDROID_CMAKE_CXX_FLAGS }} | ||
os: Android | ||
extra_flags: -DCMAKE_ANDROID_API=${{ inputs.ANDROID_API_LEVEL }} -DCMAKE_ANDROID_ARCH_ABI=x86 | ||
- arch: x86_64 | ||
cc: clang | ||
cflags: ${{ inputs.ANDROID_CMAKE_C_FLAGS }} | ||
cxx: clang++ | ||
cxxflags: ${{ inputs.ANDROID_CMAKE_CXX_FLAGS }} | ||
os: Android | ||
extra_flags: -DCMAKE_ANDROID_API=${{ inputs.ANDROID_API_LEVEL }} -DCMAKE_ANDROID_ARCH_ABI=x86_64 | ||
name: ${{ matrix.os }} ${{ matrix.arch }} ds2 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# There is currently no Android NDK for Windows ARM64 so build ds2 only on Windows X64 host only | ||
if: inputs.build_android | ||
with: | ||
repository: compnerd/ds2 | ||
ref: ${{ inputs.ds2_revision }} | ||
path: ${{ github.workspace }}/SourceCache/ds2 | ||
show-progress: false | ||
- uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main | ||
if: inputs.build_android | ||
with: | ||
host_arch: ${{ inputs.build_arch }} | ||
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' | ||
arch: ${{ matrix.arch }} | ||
# TODO(issues/205): Preload Chocolatey package manager on Azure images so we can remove this step. | ||
- uses: andrurogerz/ensure-chocolatey@v1 | ||
if: inputs.build_android | ||
- name: Install Flex and Bison Tools | ||
if: inputs.build_android | ||
run: choco install winflexbison3 | ||
- uses: actions/download-artifact@v4 | ||
if: inputs.build_android | ||
with: | ||
name: windows-regsgen2 | ||
path: ${{ github.workspace }}/BinaryCache/RegsGen2 | ||
- uses: nttld/setup-ndk@v1 | ||
if: matrix.os == 'Android' && inputs.build_android | ||
id: setup-ndk | ||
with: | ||
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }} | ||
- name: Configure DS2 | ||
if: inputs.build_android | ||
run: | | ||
$NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} | ||
cmake -B ${{ github.workspace }}/BinaryCache/ds2 ` | ||
-S ${{ github.workspace }}/SourceCache/ds2 ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${{ matrix.cc }} ` | ||
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" ` | ||
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} ` | ||
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" ` | ||
-D MSVC_C_ARCHITECTURE_ID=${{ matrix.arch }} ` | ||
-D DS2_REGSGEN2=${{ github.workspace }}/BinaryCache/RegsGen2/regsgen2.exe ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BinaryCache/Library/Developer ` | ||
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} ` | ||
-D CMAKE_ANDROID_NDK=$NDKPATH ` | ||
${{ matrix.extra_flags }} ` | ||
-G Ninja | ||
- name: Build DS2 | ||
if: inputs.build_android | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/ds2 | ||
- name: Install DS2 | ||
if: inputs.build_android | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/ds2 --target install | ||
- uses: actions/upload-artifact@v4 | ||
if: inputs.build_android | ||
with: | ||
name: ds2-${{ matrix.os }}-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library/Developer | ||
cmark_gfm: | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(inputs.host_matrix) }} | ||
name: ${{ matrix.os }} ${{ matrix.arch }} CMark GFM | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-cmark | ||
ref: ${{ inputs.swift_cmark_revision }} | ||
path: ${{ github.workspace }}/SourceCache/cmark-gfm | ||
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' | ||
- name: Compute workspace hash | ||
id: workspace_hash | ||
run: | | ||
$stringAsStream = [System.IO.MemoryStream]::new() | ||
$writer = [System.IO.StreamWriter]::new($stringAsStream) | ||
$writer.write("${{ github.workspace }}") | ||
$writer.Flush() | ||
$stringAsStream.Position = 0 | ||
$hash = (Get-FileHash -Algorithm SHA256 -InputStream $stringAsStream).Hash | ||
echo "hash=$hash" >> $env:GITHUB_OUTPUT | ||
- name: Setup sccache | ||
uses: hendrikmuhs/ccache-action@2e0e89e8d74340a03f75d58d02aae4c5ee1b15c6 | ||
with: | ||
max-size: 1M | ||
key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-cmark-gfm | ||
variant: sccache | ||
- name: Configure cmark-gfm | ||
run: > | ||
cmake -B ${{ github.workspace }}/BinaryCache/cmark-gfm-${{ inputs.swift_cmark_version }} ` | ||
-D BUILD_SHARED_LIBS=YES ` | ||
-D BUILD_TESTING=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${{ matrix.cc }} ` | ||
-D CMAKE_C_COMPILER_LAUNCHER=sccache ` | ||
-D CMAKE_C_COMPILER_FLAGS="${{ matrix.cflags }}" ` | ||
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} ` | ||
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache ` | ||
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr ` | ||
-D CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=YES ` | ||
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} ` | ||
${{ matrix.extra_flags }} ` | ||
-S ${{ github.workspace }}/SourceCache/cmark-gfm ` | ||
-G Ninja | ||
- name: Build cmark-gfm | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/cmark-gfm-${{ inputs.swift_cmark_version }} | ||
- name: Install cmark-gfm | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/cmark-gfm-${{ inputs.swift_cmark_version }} --target install | ||
- uses: thebrowsercompany/gha-upload-tar-artifact@e18c33b1cd416d0d96a91dc6dce06219f98e4e27 # main | ||
with: | ||
name: cmark-gfm-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.swift_cmark_version }} | ||
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr | ||
build_tools: | ||
needs: [cmark_gfm] | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(inputs.build_matrix) }} | ||
name: ${{ matrix.os }} ${{ matrix.arch }} Compiler Build Tools | ||
steps: | ||
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main | ||
with: | ||
name: cmark-gfm-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.swift_cmark_version }} | ||
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/llvm-project | ||
ref: ${{ inputs.llvm_project_revision }} | ||
path: ${{ github.workspace }}/SourceCache/llvm-project | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift | ||
ref: ${{ inputs.swift_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift | ||
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' | ||
- name: Compute workspace hash | ||
id: workspace_hash | ||
run: | | ||
$stringAsStream = [System.IO.MemoryStream]::new() | ||
$writer = [System.IO.StreamWriter]::new($stringAsStream) | ||
$writer.write("${{ github.workspace }}") | ||
$writer.Flush() | ||
$stringAsStream.Position = 0 | ||
$hash = (Get-FileHash -Algorithm SHA256 -InputStream $stringAsStream).Hash | ||
echo "hash=$hash" >> $env:GITHUB_OUTPUT | ||
- name: Setup sccache | ||
uses: hendrikmuhs/ccache-action@2e0e89e8d74340a03f75d58d02aae4c5ee1b15c6 | ||
with: | ||
max-size: 100M | ||
key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-build_tools | ||
variant: sccache | ||
- name: Configure Tools | ||
run: | | ||
cmake -B ${{ github.workspace }}/BinaryCache/0 ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${{ matrix.cc }} ` | ||
-D CMAKE_C_COMPILER_LAUNCHER=sccache ` | ||
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" ` | ||
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} ` | ||
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache ` | ||
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" ` | ||
${{ matrix.extra_flags }} ` | ||
-D cmark-gfm_DIR=${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/llvm-project/llvm ` | ||
-D LLVM_ENABLE_ASSERTIONS=NO ` | ||
-D LLVM_ENABLE_LIBEDIT=NO ` | ||
-D LLVM_ENABLE_LIBXML2=NO ` | ||
-D LLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lldb" ` | ||
-D LLVM_EXTERNAL_PROJECTS="swift" ` | ||
-D LLVM_EXTERNAL_SWIFT_SOURCE_DIR=${{ github.workspace }}/SourceCache/swift ` | ||
-D LLDB_ENABLE_PYTHON=NO ` | ||
-D LLDB_INCLUDE_TESTS=NO ` | ||
-D LLDB_ENABLE_SWIFT_SUPPORT=NO ` | ||
-D SWIFT_BUILD_DYNAMIC_SDK_OVERLAY=NO ` | ||
-D SWIFT_BUILD_DYNAMIC_STDLIB=NO ` | ||
-D SWIFT_BUILD_HOST_DISPATCH=NO ` | ||
-D SWIFT_BUILD_LIBEXEC=NO ` | ||
-D SWIFT_BUILD_REGEX_PARSER_IN_COMPILER=NO ` | ||
-D SWIFT_BUILD_REMOTE_MIRROR=NO ` | ||
-D SWIFT_BUILD_SOURCEKIT=NO ` | ||
-D SWIFT_BUILD_STATIC_SDK_OVERLAY=NO ` | ||
-D SWIFT_BUILD_STATIC_STDLIB=NO ` | ||
-D SWIFT_BUILD_SWIFT_SYNTAX=NO ` | ||
-D SWIFT_ENABLE_DISPATCH=NO ` | ||
-D SWIFT_INCLUDE_APINOTES=NO ` | ||
-D SWIFT_INCLUDE_DOCS=NO ` | ||
-D SWIFT_INCLUDE_TESTS=NO | ||
- name: Build llvm-tblgen | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/0 --target llvm-tblgen | ||
- name: Build clang-tblgen | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/0 --target clang-tblgen | ||
- name: Build lldb-tblgen | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/0 --target lldb-tblgen | ||
- name: Build llvm-config | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/0 --target llvm-config | ||
- name: Build clang-pseudo-gen | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/0 --target clang-pseudo-gen | ||
- name: Build clang-tidy-confusable-chars-gen | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/0 --target clang-tidy-confusable-chars-gen | ||
- name: Build swift-def-to-strings-converter | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/0 --target swift-def-to-strings-converter | ||
- name: Build swift-serialize-diagnostics | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/0 --target swift-serialize-diagnostics | ||
- name: Build swift-compatibility-symbols | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/0 --target swift-compatibility-symbols | ||
- name: Copy binaries | ||
run: | | ||
$Suffix = if ( "${{ matrix.os }}" -eq "Windows" ) { ".exe" } else { "" } | ||
$Binaries = @( | ||
"llvm-tblgen", | ||
"clang-tblgen", | ||
"lldb-tblgen", | ||
"llvm-config", | ||
"clang-pseudo-gen", | ||
"clang-tidy-confusable-chars-gen", | ||
"swift-def-to-strings-converter", | ||
"swift-serialize-diagnostics", | ||
"swift-compatibility-symbols" | ||
) | ||
# Create the target folder. | ||
New-Item -ItemType Directory -Path "${{ github.workspace }}/BuildRoot/bin" -Force | Out-Null | ||
foreach ($Binary in $Binaries) { | ||
Copy-Item -Path "${{ github.workspace }}/BinaryCache/0/bin/${Binary}${Suffix}" -Destination "${{ github.workspace }}/BuildRoot/bin/${Binary}${Suffix}" -Force | ||
} | ||
- uses: thebrowsercompany/gha-upload-tar-artifact@e18c33b1cd416d0d96a91dc6dce06219f98e4e27 # main | ||
with: | ||
name: build-tools-${{ matrix.os }} | ||
path: ${{ github.workspace }}/BuildRoot/bin | ||
early_swift_driver: | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(inputs.build_matrix) }} | ||
name: ${{ matrix.os }} ${{ matrix.arch }} early swift-driver | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-llbuild | ||
ref: ${{ inputs.swift_llbuild_revision }} | ||
path: ${{ github.workspace }}/SourceCache/llbuild | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-toolchain-sqlite | ||
ref: ${{ inputs.swift_toolchain_sqlite_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-toolchain-sqlite | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-tools-support-core | ||
ref: ${{ inputs.swift_tools_support_core_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-tools-support-core | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: apple/swift-argument-parser | ||
ref: ${{ inputs.swift_argument_parser_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-argument-parser | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-driver | ||
ref: ${{ inputs.swift_driver_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-driver | ||
show-progress: false | ||
- name: Install Swift Toolchain (macOS) | ||
if: matrix.os == 'Darwin' | ||
uses: compnerd/gha-setup-swift@6c9f2db7c3155c57fe35f160bcd5cf5859b9c1ba # main | ||
with: | ||
branch: ${{ env.WORKAROUND_MACOS_PINNED_BOOTSTRAP_TOOLCHAIN_BRANCH }} | ||
tag: ${{ env.WORKAROUND_MACOS_PINNED_BOOTSTRAP_TOOLCHAIN_TAG }} | ||
- name: Install Swift Toolchain (Windows) | ||
if: matrix.os == 'Windows' | ||
uses: compnerd/gha-setup-swift@6c9f2db7c3155c57fe35f160bcd5cf5859b9c1ba # main | ||
with: | ||
github-repo: ${{ env.WORKAROUND_WINDOWS_PINNED_BOOTSTRAP_TOOLCHAIN_REPO }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
release-asset-name: installer-${{ inputs.build_arch }}.exe | ||
release-tag-name: ${{ env.WORKAROUND_WINDOWS_PINNED_BOOTSTRAP_TOOLCHAIN_RELEASE }} | ||
- name: Build early swift-driver | ||
run: | | ||
$env:SWIFTCI_USE_LOCAL_DEPS=1 | ||
$LinkerFlags = if ("${{ matrix.os }}" -eq "Windows") { | ||
@("-Xlinker", "${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/swiftCore.lib") | ||
} else { | ||
@() | ||
} | ||
swift build ` | ||
--configuration release ` | ||
--package-path ${{ github.workspace }}/SourceCache/swift-driver ` | ||
--build-path ${{ github.workspace }}/BinaryCache/swift-driver ` | ||
--triple ${{ matrix.compiler_target }} ` | ||
@LinkerFlags | ||
- name: Copy binaries | ||
run: | | ||
if ("${{ matrix.os }}" -eq "Windows") { | ||
$ExeSuffix = ".exe" | ||
$Cpu = if ("${{ matrix.arch }}" -eq "arm64") { "aarch64" } else { "x86_64" } | ||
$SourceBinDir = Join-Path "${{ github.workspace }}" "BinaryCache" "swift-driver" "${Cpu}-unknown-windows-msvc" "release" | ||
} else { | ||
$ExeSuffix = "" | ||
$Cpu = "${{ matrix.arch }}" | ||
$SourceBinDir = Join-Path "${{ github.workspace }}" "BinaryCache" "swift-driver" "${Cpu}-apple-macosx" "release" | ||
} | ||
$InstallBinDir = Join-Path "${{ github.workspace }}" "BuildRoot" "bin" | ||
# Create the target folder. | ||
New-Item -ItemType Directory -Path $InstallBinDir -Force | ||
# Copy binaries. | ||
foreach ($bin in @("swift-driver", "swift-help")) { | ||
$binName = "${bin}${ExeSuffix}" | ||
$binPath = Join-Path $InstallBinDir $binName | ||
Copy-Item -Path "${SourceBinDir}/${binName}" -Destination $binPath -Force | ||
} | ||
- uses: thebrowsercompany/gha-upload-tar-artifact@e18c33b1cd416d0d96a91dc6dce06219f98e4e27 # main | ||
with: | ||
name: early-swift-driver-${{ matrix.os }}-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BuildRoot | ||
compilers: | ||
needs: [libxml2, build_tools, cmark_gfm, early_swift_driver] | ||
runs-on: ${{ inputs.compilers_build_runner }} | ||
env: | ||
# This will grab the latest Python 3.9 version available for setup-python. It is necessary to | ||
# specify in this manner for Mac where actions/setup-python does not have version 3.9.10. | ||
# Once the Python version is upgraded to 3.12, these should be kept in sync. | ||
PYTHON_VERSION_MACOS: 3.9 | ||
# Must be a full version string from https://www.nuget.org/packages/pythonarm64 | ||
PYTHON_VERSION_WINDOWS: 3.9.10 | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(inputs.host_matrix) }} | ||
name: ${{ matrix.os }} ${{ matrix.arch }} Toolchain | ||
steps: | ||
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main | ||
with: | ||
name: build-tools-${{ matrix.os }} | ||
path: ${{ github.workspace }}/BinaryCache/0/bin | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: libxml2-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.libxml2_version }} | ||
path: ${{ github.workspace }}/BinaryCache/Library/libxml2-${{ inputs.libxml2_version }}/usr | ||
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main | ||
with: | ||
name: cmark-gfm-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.swift_cmark_version }} | ||
path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr | ||
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main | ||
with: | ||
name: early-swift-driver-${{ inputs.build_os }}-${{ inputs.build_arch }} | ||
path: ${{ github.workspace }}/BinaryCache/swift-driver | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/llvm-project | ||
ref: ${{ inputs.llvm_project_revision }} | ||
path: ${{ github.workspace }}/SourceCache/llvm-project | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift | ||
ref: ${{ inputs.swift_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-experimental-string-processing | ||
ref: ${{ inputs.swift_experimental_string_processing_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-experimental-string-processing | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-syntax | ||
ref: ${{ inputs.swift_syntax_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-syntax | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: apple/swift-corelibs-libdispatch | ||
ref: ${{ inputs.swift_corelibs_libdispatch_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-corelibs-libdispatch | ||
show-progress: false | ||
- name: Install Python ${{ env.PYTHON_VERSION_MACOS }} (Host) | ||
if: matrix.os == 'Darwin' | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '${{ env.PYTHON_VERSION_MACOS }}' | ||
- name: Install Python ${{ env.PYTHON_VERSION_WINDOWS }} (Host) | ||
if: matrix.os == 'Windows' && (matrix.arch == 'amd64' || inputs.build_arch == 'amd64') | ||
uses: actions/setup-python@v5 | ||
id: python | ||
with: | ||
python-version: '${{ env.PYTHON_VERSION_WINDOWS }}' | ||
architecture: x64 | ||
- uses: nuget/setup-nuget@v2 | ||
if: inputs.build_os == 'Windows' && (matrix.arch == 'arm64' || inputs.build_arch == 'arm64') | ||
# TODO(lxbndr) use actions/cache to improve this step timings | ||
- name: Install Python ${{ env.PYTHON_VERSION_WINDOWS }} (Windows arm64) | ||
if: inputs.build_os == 'Windows' && (matrix.arch == 'arm64' || inputs.build_arch == 'arm64') | ||
run: | | ||
$NugetSources=[string](nuget Sources List -Format short) | ||
if (-Not ($NugetSources.contains("api.nuget.org"))) { | ||
nuget sources Add -Name api.nuget.org -Source https://api.nuget.org/v3/index.json -NonInteractive | ||
} | ||
nuget install pythonarm64 -Version ${{ env.PYTHON_VERSION_WINDOWS }} | ||
- name: Export Python Location (Windows) | ||
if: inputs.build_os == 'Windows' | ||
run: | | ||
echo "PYTHON_LOCATION_amd64=$env:pythonLocation" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | ||
echo "PYTHON_LOCATION_arm64=${{ github.workspace }}\pythonarm64.${{ env.PYTHON_VERSION_WINDOWS }}\tools" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | ||
- 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' | ||
- name: Install Swift Toolchain | ||
if: inputs.build_os == 'Windows' | ||
uses: compnerd/gha-setup-swift@6c9f2db7c3155c57fe35f160bcd5cf5859b9c1ba # main | ||
with: | ||
github-repo: ${{ env.WORKAROUND_WINDOWS_PINNED_BOOTSTRAP_TOOLCHAIN_REPO }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
release-asset-name: installer-${{ inputs.build_arch }}.exe | ||
release-tag-name: ${{ env.WORKAROUND_WINDOWS_PINNED_BOOTSTRAP_TOOLCHAIN_RELEASE }} | ||
- name: Install Swift Toolchain | ||
if: inputs.build_os == 'Darwin' | ||
uses: compnerd/gha-setup-swift@6c9f2db7c3155c57fe35f160bcd5cf5859b9c1ba # main | ||
with: | ||
branch: ${{ env.WORKAROUND_MACOS_PINNED_BOOTSTRAP_TOOLCHAIN_BRANCH }} | ||
tag: ${{ env.WORKAROUND_MACOS_PINNED_BOOTSTRAP_TOOLCHAIN_TAG }} | ||
- uses: nttld/setup-ndk@v1 | ||
if: matrix.os == 'Android' | ||
id: setup-ndk | ||
with: | ||
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }} | ||
- name: Compute workspace hash | ||
id: workspace_hash | ||
shell: pwsh | ||
run: | | ||
$stringAsStream = [System.IO.MemoryStream]::new() | ||
$writer = [System.IO.StreamWriter]::new($stringAsStream) | ||
$writer.write("${{ github.workspace }}") | ||
$writer.Flush() | ||
$stringAsStream.Position = 0 | ||
$hash = (Get-FileHash -Algorithm SHA256 -InputStream $stringAsStream).Hash | ||
echo "hash=$hash" >> $env:GITHUB_OUTPUT | ||
- name: Setup sccache | ||
uses: hendrikmuhs/ccache-action@2e0e89e8d74340a03f75d58d02aae4c5ee1b15c6 | ||
with: | ||
max-size: 500M | ||
key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-compilers | ||
variant: sccache | ||
- name: Setup context | ||
id: setup-context | ||
run: | | ||
$CxxFlags = "${{ matrix.cxxflags }}" | ||
$SwiftFlags = "" | ||
$ExtraFlags = "${{ matrix.extra_flags }}" | ||
if ( "${{ matrix.os }}" -eq "Windows" ) { | ||
# Use toolchain clang to avoid broken __prefetch intrinsic on arm64 in Clang 18. | ||
# TODO: Use llvm-19 when available. See https://github.com/compnerd/swift-build/issues/846 | ||
$CLANG_LOCATION = cygpath -m $(Split-Path (Get-Command swiftc).Source) | ||
$SWIFTC = cygpath -m (Get-Command swiftc).Source | ||
$CC = "${{ matrix.cc }}" | ||
$CXX = "${{ matrix.cxx }}" | ||
$SDKROOT = cygpath -m ${env:SDKROOT} | ||
# Workaround for compiler and STL version mismatch on Windows. | ||
$CxxFlags += " -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH" | ||
$SwiftFlags += " -Xcc -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH" | ||
$LIBPYTHON_PATH = "${env:PYTHON_LOCATION_${{ matrix.arch }}}/libs/python39.lib" | ||
$PYTHON_INCLUDE_DIR = "${env:PYTHON_LOCATION_${{ matrix.arch }}}/include" | ||
$PYTHON_BINARY="python.exe" | ||
Remove-Item env:\SDKROOT | ||
} elseif ( "${{ matrix.os }}" -eq "Darwin" ) { | ||
# Default swiftc comes from /usr/bin and is not compatible with the toolchain. | ||
$CLANG_LOCATION = "${env:HOME}/Library/Developer/Toolchains/swift-${{ env.WORKAROUND_MACOS_PINNED_BOOTSTRAP_TOOLCHAIN_TAG }}.xctoolchain/usr/bin" | ||
$SWIFTC = Join-Path $CLANG_LOCATION "swiftc" | ||
# We need to use llvm-17 to build the compiler on macOS. We get it from the Swift toolchain. | ||
$CC = Join-Path $CLANG_LOCATION ${{ matrix.cc }} | ||
$CXX = Join-Path $CLANG_LOCATION ${{ matrix.cxx }} | ||
$SDKROOT = xcrun --sdk macosx --show-sdk-path | ||
# TODO: Use early-swift-driver on Windows too. | ||
$ExtraFlags += " -D SWIFT_EARLY_SWIFT_DRIVER_BUILD=${{ github.workspace }}/BinaryCache/swift-driver/bin" | ||
$LIBPYTHON_PATH = "${env:pythonLocation}/lib/python3.9/config-3.9-darwin/libpython3.9.a" | ||
$PYTHON_INCLUDE_DIR = "${env:pythonLocation}/include/python3.9" | ||
$PYTHON_BINARY="python3" | ||
} | ||
$SwiftFlags += " -sdk `"${SDKROOT}`"" | ||
# Output the context for the configure task. | ||
$Context = @" | ||
cc=${CC} | ||
cxx=${CXX} | ||
swiftc=${SWIFTC} | ||
cxxflags=${CxxFlags} | ||
swiftflags=${SwiftFlags} | ||
extra_flags=${ExtraFlags} | ||
clang_location=${CLANG_LOCATION} | ||
libpython_path=${LIBPYTHON_PATH} | ||
python_include_dir=${PYTHON_INCLUDE_DIR} | ||
python_binary=${PYTHON_BINARY} | ||
sdkroot=${SDKROOT} | ||
"@ | ||
Write-Output $Context | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | ||
- name: Configure Compilers | ||
env: | ||
NDKPATH: ${{ steps.setup-ndk.outputs.ndk-path }} | ||
run: | | ||
if ( "${{ matrix.os }}" -eq "Windows" ) { | ||
$ExeSuffix = ".exe" | ||
Remove-Item env:\SDKROOT | ||
} elseif ( "${{ matrix.os }}" -eq "Darwin" ) { | ||
$ExeSuffix = "" | ||
} | ||
cmake -B ${{ github.workspace }}/BinaryCache/1 ` | ||
-C "${{ github.workspace }}/SourceCache/swift/cmake/caches/${{ matrix.os }}-${{ matrix.cpu }}.cmake" ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER="${{ steps.setup-context.outputs.cc }}" ` | ||
-D CMAKE_C_COMPILER_LAUNCHER=sccache ` | ||
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" ` | ||
-D CMAKE_CXX_COMPILER="${{ steps.setup-context.outputs.cxx }}" ` | ||
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache ` | ||
-D CMAKE_CXX_FLAGS="${{ steps.setup-context.outputs.cxxflags }}" ` | ||
-D CMAKE_Swift_COMPILER="${{ steps.setup-context.outputs.swiftc }}" ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_FLAGS="${{ steps.setup-context.outputs.swiftflags }}" ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_STATIC_LIBRARY_PREFIX_Swift= ` | ||
-D CMAKE_FIND_PACKAGE_PREFER_CONFIG=YES ` | ||
<<<<<<< HEAD | ||
<<<<<<< HEAD | ||
<<<<<<< HEAD | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr ` | ||
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} ` | ||
======= | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/0.0.0+Asserts.xctoolchain/usr ` | ||
>>>>>>> 4439dd5 (rewords -development to 0.0.0) | ||
======= | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/0.0.0+Asserts/usr ` | ||
>>>>>>> 614506e (fix: naming conventions) | ||
======= | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
>>>>>>> 6e8dbd3 (use inputs.swift_version instead of hardcode?) | ||
${{ steps.setup-context.outputs.extra_flags }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/llvm-project/llvm ` | ||
-D CLANG_TABLEGEN="${{ github.workspace }}/BinaryCache/0/bin/clang-tblgen${ExeSuffix}" ` | ||
-D CLANG_TIDY_CONFUSABLE_CHARS_GEN="${{ github.workspace }}/BinaryCache/0/bin/clang-tidy-confusable-chars-gen${ExeSuffix}" ` | ||
-D LLDB_TABLEGEN="${{ github.workspace }}/BinaryCache/0/bin/lldb-tblgen${ExeSuffix}" ` | ||
-D LLVM_CONFIG_PATH="${{ github.workspace }}/BinaryCache/0/bin/llvm-config${ExeSuffix}" ` | ||
-D LLVM_EXTERNAL_SWIFT_SOURCE_DIR=${{ github.workspace }}/SourceCache/swift ` | ||
-D LLVM_NATIVE_TOOL_DIR=${{ github.workspace }}/BinaryCache/0/bin ` | ||
-D LLVM_TABLEGEN="${{ github.workspace }}/BinaryCache/0/bin/llvm-tblgen${ExeSuffix}" ` | ||
-D LLVM_USE_HOST_TOOLS=NO ` | ||
-D SWIFT_BUILD_DYNAMIC_SDK_OVERLAY=NO ` | ||
-D SWIFT_BUILD_DYNAMIC_STDLIB=NO ` | ||
-D SWIFT_BUILD_REMOTE_MIRROR=NO ` | ||
-D SWIFT_BUILD_SWIFT_SYNTAX=YES ` | ||
-D SWIFT_CLANG_LOCATION="${{ steps.setup-context.outputs.clang_location }}" ` | ||
-D SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY=YES ` | ||
-D SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP=YES ` | ||
-D SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED=YES ` | ||
-D SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING=YES ` | ||
-D SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION=YES ` | ||
-D SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING=YES ` | ||
-D SWIFT_ENABLE_SYNCHRONIZATION=YES ` | ||
-D SWIFT_NATIVE_SWIFT_TOOLS_PATH=${{ github.workspace }}/BinaryCache/0/bin ` | ||
-D SWIFT_PATH_TO_LIBDISPATCH_SOURCE=${{ github.workspace }}/SourceCache/swift-corelibs-libdispatch ` | ||
-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 ` | ||
-D SWIFT_PATH_TO_SWIFT_SDK="${{ steps.setup-context.outputs.sdkroot }}" ` | ||
-D CLANG_VENDOR=compnerd.org ` | ||
-D CLANG_VENDOR_UTI=org.compnerd.dt ` | ||
-D cmark-gfm_DIR=${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake ` | ||
-D LibXml2_DIR=${{ github.workspace }}/BinaryCache/Library/libxml2-${{ inputs.libxml2_version }}/usr/lib/cmake/libxml2-${{ inputs.libxml2_version }} ` | ||
-D PACKAGE_VENDOR=compnerd.org ` | ||
-D SWIFT_VENDOR=compnerd.org ` | ||
-D LLVM_PARALLEL_LINK_JOBS=2 ` | ||
-D SWIFT_PARALLEL_LINK_JOBS=2 ` | ||
-D LLVM_APPEND_VC_REV=NO ` | ||
-D LLVM_VERSION_SUFFIX="" ` | ||
-D LLDB_PYTHON_EXE_RELATIVE_PATH=${{ steps.setup-context.outputs.python_binary }} ` | ||
-D LLDB_PYTHON_EXT_SUFFIX=.pyd ` | ||
-D LLDB_PYTHON_RELATIVE_PATH=lib/site-packages ` | ||
-D Python3_EXECUTABLE=${{ steps.python.outputs.python-path }} ` | ||
-D Python3_INCLUDE_DIR=${{ steps.setup-context.outputs.python_include_dir }} ` | ||
-D Python3_LIBRARY=${{ steps.setup-context.outputs.libpython_path }} ` | ||
-D Python3_ROOT_DIR=$env:pythonLocation | ||
- name: Build Compiler Distribution | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/1 --target distribution | ||
- name: Install Compiler Distribution | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/1 --target install-distribution-stripped | ||
- name: Copy cmark-gfm shared libraries | ||
run: | | ||
if ("${{ matrix.os }}" -eq "Windows") { | ||
Copy-Item -Path "${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/bin/*.dll" -Destination "${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin" | ||
} else { | ||
Copy-Item -Path "${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/*.dylib" -Destination "${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/lib/swift/host/compiler" | ||
} | ||
- uses: actions/setup-python@v5 | ||
- uses: jannekem/run-python-script-action@v1 | ||
with: | ||
script: | | ||
import os | ||
import plistlib | ||
from datetime import datetime | ||
now = datetime.now() | ||
info_plist = r'${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/ToolchainInfo.plist' | ||
with open(os.path.normpath(info_plist), 'wb') as plist: | ||
plistlib.dump({ 'Identifier': 'org.compnerd.dt.toolchain.{0}.{1}-asserts'.format(now.strftime('%Y%m%d'), now.timetuple().tm_hour % 6) }, plist) | ||
- name: Upload Compilers | ||
uses: thebrowsercompany/gha-upload-tar-artifact@e18c33b1cd416d0d96a91dc6dce06219f98e4e27 # main | ||
with: | ||
name: compilers-${{ matrix.os }}-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BuildRoot/Library | ||
- name: Extract swift-syntax | ||
run: | | ||
New-Item -Path ${{ github.workspace }}/BinaryCache/swift-syntax/lib/swift/host -ItemType Directory | Out-Null | ||
$ToolchainRoot = "${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts" | ||
if ("${{ matrix.os }}" -eq "Windows") { | ||
$bindir = cygpath -m "${{ github.workspace }}/BinaryCache/1" | ||
Copy-Item -Path "${ToolchainRoot}/usr/lib/*.lib" -Destination "${{ github.workspace }}/BinaryCache/swift-syntax/lib" | ||
Copy-Item -Path "${ToolchainRoot}/usr/lib/*.lib" -Destination "${{ github.workspace }}/BinaryCache/swift-syntax/lib/swift/host" | ||
} else { | ||
$bindir = "${{ github.workspace }}/BinaryCache/1" | ||
Copy-Item -Path "${ToolchainRoot}/usr/lib/*.dylib" -Destination "${{ github.workspace }}/BinaryCache/swift-syntax/lib" | ||
Copy-Item -Path "${ToolchainRoot}/usr/lib/swift/host/*.dylib" -Destination "${{ github.workspace }}/BinaryCache/swift-syntax/lib/swift/host" | ||
} | ||
Copy-Item -Path "${ToolchainRoot}/usr/lib/swift/host/*.swiftmodule" -Destination "${{ github.workspace }}/BinaryCache/swift-syntax/lib/swift/host" -Recurse | ||
$module = "${{ github.workspace }}/BinaryCache/1/cmake/modules/SwiftSyntaxConfig.cmake" | ||
(Get-Content $module).Replace("${bindir}", '<BINARY_DIR>') | Set-Content $module | ||
New-Item -Path ${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules -ItemType Directory | Out-Null | ||
Copy-Item -Path $module -Destination "${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules" | ||
- name: Upload swift-syntax | ||
uses: thebrowsercompany/gha-upload-tar-artifact@e18c33b1cd416d0d96a91dc6dce06219f98e4e27 # main | ||
with: | ||
name: swift-syntax-${{matrix.os }}-${{ matrix.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.os }}-${{ matrix.arch }}-debug-info | ||
path: | | ||
${{ github.workspace }}/BinaryCache/1/**/*.pdb | ||
- name: Upload PDBs to Azure | ||
uses: microsoft/[email protected] | ||
if: ${{ inputs.debug_info && matrix.os == 'Windows' }} | ||
with: | ||
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }} | ||
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }} | ||
symbolsFolder: ${{ github.workspace }}/BinaryCache/1 | ||
searchPattern: '**/*.pdb' | ||
- name: Upload DLLs to Azure | ||
uses: microsoft/[email protected] | ||
if: ${{ inputs.debug_info && matrix.os == 'Windows' }} | ||
with: | ||
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }} | ||
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }} | ||
symbolsFolder: ${{ github.workspace }}/BinaryCache/1 | ||
searchPattern: '**/*.dll' | ||
- name: Upload EXEs to Azure | ||
uses: microsoft/[email protected] | ||
if: ${{ inputs.debug_info && matrix.os == 'Windows' }} | ||
with: | ||
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }} | ||
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }} | ||
symbolsFolder: ${{ github.workspace }}/BinaryCache/1 | ||
searchPattern: '**/*.exe' | ||
zlib: | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(inputs.target_matrix) }} | ||
name: ${{ matrix.os }} ${{ matrix.arch }} zlib | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: madler/zlib | ||
ref: ${{ inputs.zlib_revision }} | ||
path: ${{ github.workspace }}/SourceCache/zlib | ||
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' | ||
- name: Compute workspace hash | ||
id: workspace_hash | ||
run: | | ||
$stringAsStream = [System.IO.MemoryStream]::new() | ||
$writer = [System.IO.StreamWriter]::new($stringAsStream) | ||
$writer.write("${{ github.workspace }}") | ||
$writer.Flush() | ||
$stringAsStream.Position = 0 | ||
$hash = (Get-FileHash -Algorithm SHA256 -InputStream $stringAsStream).Hash | ||
echo "hash=$hash" >> $env:GITHUB_OUTPUT | ||
- name: Setup sccache | ||
uses: hendrikmuhs/ccache-action@2e0e89e8d74340a03f75d58d02aae4c5ee1b15c6 | ||
with: | ||
max-size: 100M | ||
key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-zlib | ||
variant: sccache | ||
- uses: nttld/setup-ndk@v1 | ||
if: matrix.os == 'Android' | ||
id: setup-ndk | ||
with: | ||
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }} | ||
- name: Configure zlib | ||
run: | | ||
if ("${{ matrix.os }}" -eq "Android") { | ||
$NDKPATH = "${{ steps.setup-ndk.outputs.ndk-path }}" | ||
if ( "${{ inputs.build_os }}" -eq "Windows" ) { | ||
$NDKPATH = cygpath -m $NDKPATH | ||
} | ||
# Since win/arm64 doesn't have one, this logic is necessary because | ||
# passing an empty CMAKE_ANDROID_NDK value causes a failure. | ||
$CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH" | ||
} | ||
cmake -B ${{ github.workspace }}/BinaryCache/zlib-${{ inputs.zlib_version }} ` | ||
-D BUILD_SHARED_LIBS=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${{ matrix.cc }} ` | ||
-D CMAKE_C_COMPILER_LAUNCHER=sccache ` | ||
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" ` | ||
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} ` | ||
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache ` | ||
-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 }} ` | ||
$CMAKE_NDK_FLAG ` | ||
-D CMAKE_POSITION_INDEPENDENT_CODE=YES ` | ||
${{ matrix.extra_flags }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/zlib ` | ||
-D SKIP_INSTALL_FILES=YES | ||
- name: Build zlib | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/zlib-${{ inputs.zlib_version }} | ||
- name: Install zlib | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/zlib-${{ inputs.zlib_version }} --target install | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: zlib-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.zlib_version }} | ||
path: ${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr | ||
curl: | ||
needs: [zlib] | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(inputs.target_matrix) }} | ||
name: ${{ matrix.os }} ${{ matrix.arch }} curl | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: curl/curl | ||
ref: ${{ inputs.curl_revision }} | ||
path: ${{ github.workspace }}/SourceCache/curl | ||
show-progress: false | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: zlib-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.zlib_version }} | ||
path: ${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr | ||
- 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' | ||
- name: Compute workspace hash | ||
id: workspace_hash | ||
run: | | ||
$stringAsStream = [System.IO.MemoryStream]::new() | ||
$writer = [System.IO.StreamWriter]::new($stringAsStream) | ||
$writer.write("${{ github.workspace }}") | ||
$writer.Flush() | ||
$stringAsStream.Position = 0 | ||
$hash = (Get-FileHash -Algorithm SHA256 -InputStream $stringAsStream).Hash | ||
echo "hash=$hash" >> $env:GITHUB_OUTPUT | ||
- name: Setup sccache | ||
uses: hendrikmuhs/ccache-action@2e0e89e8d74340a03f75d58d02aae4c5ee1b15c6 | ||
with: | ||
max-size: 100M | ||
key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-curl | ||
variant: sccache | ||
- uses: nttld/setup-ndk@v1 | ||
if: matrix.os == 'Android' | ||
id: setup-ndk | ||
with: | ||
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }} | ||
- name: Configure curl | ||
run: | | ||
if ("${{ matrix.os }}" -eq "Android") { | ||
$NDKPATH = "${{ steps.setup-ndk.outputs.ndk-path }}" | ||
if ( "${{ inputs.build_os }}" -eq "Windows" ) { | ||
$NDKPATH = cygpath -m $NDKPATH | ||
} | ||
# Since win/arm64 doesn't have one, this logic is necessary because | ||
# passing an empty CMAKE_ANDROID_NDK value causes a failure. | ||
$CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH" | ||
} | ||
cmake -B ${{ github.workspace }}/BinaryCache/curl-${{ inputs.curl_version }} ` | ||
-D BUILD_SHARED_LIBS=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${{ matrix.cc }} ` | ||
-D CMAKE_C_COMPILER_LAUNCHER=sccache ` | ||
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" ` | ||
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} ` | ||
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache ` | ||
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/curl-${{ inputs.curl_version }}/usr ` | ||
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} ` | ||
${{ matrix.extra_flags }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/curl ` | ||
-D BUILD_TESTING=NO ` | ||
-D BUILD_CURL_EXE=NO ` | ||
-D CURL_CA_BUNDLE="none" ` | ||
-D CURL_CA_FALLBACK=NO ` | ||
-D CURL_CA_PATH="none" ` | ||
-D CURL_BROTLI=NO ` | ||
-D CURL_DISABLE_ALTSVC=NO ` | ||
-D CURL_DISABLE_AWS=YES ` | ||
-D CURL_DISABLE_BASIC_AUTH=NO ` | ||
-D CURL_DISABLE_BEARER_AUTH=NO ` | ||
-D CURL_DISABLE_COOKIES=NO ` | ||
-D CURL_DISABLE_DICT=YES ` | ||
-D CURL_DISABLE_DIGEST_AUTH=NO ` | ||
-D CURL_DISABLE_DOH=NO ` | ||
-D CURL_DISABLE_FILE=YES ` | ||
-D CURL_DISABLE_FORM_API=NO ` | ||
-D CURL_DISABLE_FTP=YES ` | ||
-D CURL_DISABLE_GETOPTIONS=NO ` | ||
-D CURL_DISABLE_GOPHER=YES ` | ||
-D CURL_DISABLE_HSTS=NO ` | ||
-D CURL_DISABLE_HTTP=NO ` | ||
-D CURL_DISABLE_HTTP_AUTH=NO ` | ||
-D CURL_DISABLE_IMAP=YES ` | ||
-D CURL_DISABLE_KERBEROS_AUTH=NO ` | ||
-D CURL_DISABLE_LDAP=YES ` | ||
-D CURL_DISABLE_LDAPS=YES ` | ||
-D CURL_DISABLE_MIME=NO ` | ||
-D CURL_DISABLE_MQTT=YES ` | ||
-D CURL_DISABLE_NEGOTIATE_AUTH=NO ` | ||
-D CURL_DISABLE_NETRC=NO ` | ||
-D CURL_DISABLE_NTLM=NO ` | ||
-D CURL_DISABLE_PARSEDATE=NO ` | ||
-D CURL_DISABLE_POP3=YES ` | ||
-D CURL_DISABLE_PROGRESS_METER=YES ` | ||
-D CURL_DISABLE_PROXY=NO ` | ||
-D CURL_DISABLE_RTSP=YES ` | ||
-D CURL_DISABLE_SHUFFLE_DNS=YES ` | ||
-D CURL_DISABLE_SMB=YES ` | ||
-D CURL_DISABLE_SMTP=YES ` | ||
-D CURL_DISABLE_SOCKETPAIR=YES ` | ||
-D CURL_DISABLE_SRP=NO ` | ||
-D CURL_DISABLE_TELNET=YES ` | ||
-D CURL_DISABLE_TFTP=YES ` | ||
-D CURL_DISABLE_VERBOSE_STRINGS=NO ` | ||
-D CURL_LTO=NO ` | ||
-D CURL_USE_BEARSSL=NO ` | ||
-D CURL_USE_GNUTLS=NO ` | ||
-D CURL_USE_GSSAPI=NO ` | ||
-D CURL_USE_LIBPSL=NO ` | ||
-D CURL_USE_LIBSSH=NO ` | ||
-D CURL_USE_LIBSSH2=NO ` | ||
-D CURL_USE_MBEDTLS=NO ` | ||
-D CURL_USE_OPENSSL=NO ` | ||
-D CURL_USE_SCHANNEL=${{ matrix.os == 'Windows' && 'YES' || 'NO' }} ` | ||
-D CURL_USE_WOLFSSL=NO ` | ||
-D CURL_WINDOWS_SSPI=${{ matrix.os == 'Windows' && 'YES' || 'NO' }} ` | ||
-D CURL_ZLIB=YES ` | ||
-D CURL_ZSTD=NO ` | ||
-D ENABLE_ARES=NO ` | ||
-D ENABLE_CURLDEBUG=NO ` | ||
-D ENABLE_DEBUG=NO ` | ||
-D ENABLE_IPV6=YES ` | ||
-D ENABLE_MANUAL=NO ` | ||
-D ENABLE_THREADED_RESOLVER=NO ` | ||
-D ENABLE_UNICODE=YES ` | ||
-D ENABLE_UNIX_SOCKETS=NO ` | ||
-D ENABLE_WEBSOCKETS=NO ` | ||
-D HAVE_POLL_FINE=NO ` | ||
-D USE_IDN2=NO ` | ||
-D USE_MSH3=NO ` | ||
-D USE_NGHTTP2=NO ` | ||
-D USE_NGTCP2=NO ` | ||
-D USE_QUICHE=NO ` | ||
-D USE_WIN32_IDN=${{ matrix.os == 'Windows' && 'YES' || 'NO' }} ` | ||
-D USE_WIN32_LARGE_FILES=${{ matrix.os == 'Windows' && 'YES' || 'NO' }} ` | ||
-D USE_WIN32_LDAP=NO ` | ||
-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 ` | ||
$CMAKE_NDK_FLAG | ||
- name: Build curl | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/curl-${{ inputs.curl_version }} | ||
- name: Install curl | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/curl-${{ inputs.curl_version }} --target install | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: curl-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.curl_version }} | ||
path: ${{ github.workspace }}/BuildRoot/Library/curl-${{ inputs.curl_version }}/usr | ||
libxml2: | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(inputs.target_matrix) }} | ||
name: ${{ matrix.os }} ${{ matrix.arch }} libxml2 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: gnome/libxml2 | ||
ref: ${{ inputs.libxml2_revision }} | ||
path: ${{ github.workspace }}/SourceCache/libxml2 | ||
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' | ||
- name: Compute workspace hash | ||
id: workspace_hash | ||
shell: pwsh | ||
run: | | ||
$stringAsStream = [System.IO.MemoryStream]::new() | ||
$writer = [System.IO.StreamWriter]::new($stringAsStream) | ||
$writer.write("${{ github.workspace }}") | ||
$writer.Flush() | ||
$stringAsStream.Position = 0 | ||
$hash = (Get-FileHash -Algorithm SHA256 -InputStream $stringAsStream).Hash | ||
echo "hash=$hash" >> $env:GITHUB_OUTPUT | ||
- name: Setup sccache | ||
uses: hendrikmuhs/ccache-action@2e0e89e8d74340a03f75d58d02aae4c5ee1b15c6 | ||
with: | ||
max-size: 100M | ||
key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-libxml2 | ||
variant: sccache | ||
- uses: nttld/setup-ndk@v1 | ||
if: matrix.os == 'Android' | ||
id: setup-ndk | ||
with: | ||
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }} | ||
- name: Configure libxml2 | ||
run: | | ||
if ("${{ matrix.os }}" -eq "Android") { | ||
$NDKPATH = "${{ steps.setup-ndk.outputs.ndk-path }}" | ||
if ( "${{ inputs.build_os }}" -eq "Windows" ) { | ||
$NDKPATH = cygpath -m $NDKPATH | ||
} | ||
# Since win/arm64 doesn't have one, this logic is necessary because | ||
# passing an empty CMAKE_ANDROID_NDK value causes a failure. | ||
$CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH" | ||
} | ||
cmake -B ${{ github.workspace }}/BinaryCache/libxml2-${{ inputs.libxml2_version }} ` | ||
-D BUILD_SHARED_LIBS=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${{ matrix.cc }} ` | ||
-D CMAKE_C_COMPILER_LAUNCHER=sccache ` | ||
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" ` | ||
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} ` | ||
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache ` | ||
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/libxml2-${{ inputs.libxml2_version }}/usr ` | ||
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} ` | ||
${{ matrix.extra_flags }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/libxml2 ` | ||
-D LIBXML2_WITH_ICONV=NO ` | ||
-D LIBXML2_WITH_ICU=NO ` | ||
-D LIBXML2_WITH_LZMA=NO ` | ||
-D LIBXML2_WITH_PYTHON=NO ` | ||
-D LIBXML2_WITH_TESTS=NO ` | ||
-D LIBXML2_WITH_THREADS=YES ` | ||
-D LIBXML2_WITH_ZLIB=NO ` | ||
-D CMAKE_POSITION_INDEPENDENT_CODE=YES ` | ||
$CMAKE_NDK_FLAG | ||
- name: Build libxml2 | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/libxml2-${{ inputs.libxml2_version }} | ||
- name: Install libxml2 | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/libxml2-${{ inputs.libxml2_version }} --target install | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: libxml2-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.libxml2_version }} | ||
path: ${{ github.workspace }}/BuildRoot/Library/libxml2-${{ inputs.libxml2_version }}/usr | ||
stdlib: | ||
# TODO: Build this on macOS or make an equivalent Mac-only job | ||
if: inputs.build_os == 'Windows' | ||
needs: [compilers, cmark_gfm] | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- arch: amd64 | ||
cpu: 'x86_64' | ||
triple: 'x86_64-unknown-windows-msvc' | ||
triple_no_api_level: 'x86_64-unknown-windows-msvc' | ||
cc: '$CLANG_CL' | ||
cflags: ${{ inputs.WINDOWS_CMAKE_C_FLAGS }} | ||
cxx: '$CLANG_CL' | ||
cxxflags: ${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }} | ||
swiftflags: ${{ inputs.CMAKE_Swift_FLAGS }} | ||
os: Windows | ||
llvm_flags: | ||
linker_flags: '-D CMAKE_EXE_LINKER_FLAGS="${{ inputs.WINDOWS_CMAKE_EXE_LINKER_FLAGS }}" -D CMAKE_SHARED_LINKER_FLAGS="${{ inputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}" -D CMAKE_STATIC_LIBRARY_PREFIX_Swift=lib' | ||
extra_flags: | ||
- arch: arm64 | ||
cpu: 'aarch64' | ||
triple: 'aarch64-unknown-windows-msvc' | ||
triple_no_api_level: 'aarch64-unknown-windows-msvc' | ||
cc: '$CLANG_CL' | ||
cflags: ${{ inputs.WINDOWS_CMAKE_C_FLAGS }} | ||
cxx: '$CLANG_CL' | ||
cxxflags: ${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }} | ||
swiftflags: ${{ inputs.CMAKE_Swift_FLAGS }} | ||
os: Windows | ||
llvm_flags: | ||
linker_flags: '-D CMAKE_EXE_LINKER_FLAGS="${{ inputs.WINDOWS_CMAKE_EXE_LINKER_FLAGS }}" -D CMAKE_SHARED_LINKER_FLAGS="${{ inputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}" -D CMAKE_STATIC_LIBRARY_PREFIX_Swift=lib' | ||
extra_flags: | ||
- arch: x86 | ||
cpu: 'i686' | ||
triple: 'i686-unknown-windows-msvc' | ||
triple_no_api_level: 'i686-unknown-windows-msvc' | ||
cc: '$CLANG_CL' | ||
cflags: ${{ inputs.WINDOWS_CMAKE_C_FLAGS }} | ||
cxx: '$CLANG_CL' | ||
cxxflags: ${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }} | ||
swiftflags: ${{ inputs.CMAKE_Swift_FLAGS }} | ||
os: Windows | ||
llvm_flags: | ||
linker_flags: '-D CMAKE_EXE_LINKER_FLAGS="${{ inputs.WINDOWS_CMAKE_EXE_LINKER_FLAGS }}" -D CMAKE_SHARED_LINKER_FLAGS="${{ inputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}"' | ||
extra_flags: | ||
- arch: arm64 | ||
cpu: 'aarch64' | ||
triple: 'aarch64-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }}' | ||
triple_no_api_level: aarch64-unknown-linux-android | ||
cc: clang | ||
cflags: ${{ inputs.ANDROID_CMAKE_C_FLAGS }} | ||
cxx: clang++ | ||
cxxflags: ${{ inputs.ANDROID_CMAKE_CXX_FLAGS }} | ||
swiftflags: -sdk $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -target -Xclang-linker aarch64-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }} -Xclang-linker --sysroot -Xclang-linker $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -resource-dir -Xclang-linker $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/lib/clang/17 -L ${{ github.workspace }}/BinaryCache/swift/lib/swift/android -g | ||
os: Android | ||
llvm_flags: -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DLLVM_HOST_TRIPLE=aarch64-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }} | ||
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=arm64-v8a | ||
- arch: armv7 | ||
cpu: armv7 | ||
triple: 'armv7a-unknown-linux-androideabi${{ inputs.ANDROID_API_LEVEL }}' | ||
triple_no_api_level: armv7-unknown-linux-androideabi | ||
cc: clang | ||
cflags: ${{ inputs.ANDROID_CMAKE_C_FLAGS }} | ||
cxx: clang++ | ||
cxxflags: ${{ inputs.ANDROID_CMAKE_CXX_FLAGS }} | ||
swiftflags: -sdk $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -target -Xclang-linker armv7a-unknown-linux-androideabi${{ inputs.ANDROID_API_LEVEL }} -Xclang-linker --sysroot -Xclang-linker $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -resource-dir -Xclang-linker $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/lib/clang/17 -L ${{ github.workspace }}/BinaryCache/swift/lib/swift/android -g | ||
os: Android | ||
llvm_flags: -DCMAKE_SYSTEM_PROCESSOR=armv7-a -DLLVM_HOST_TRIPLE=armv7a-unknown-linux-androideabi${{ inputs.ANDROID_API_LEVEL }} | ||
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=armeabi-v7a | ||
- arch: i686 | ||
cpu: i686 | ||
triple: 'i686-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }}' | ||
triple_no_api_level: i686-unknown-linux-android | ||
cc: clang | ||
cflags: ${{ inputs.ANDROID_CMAKE_C_FLAGS }} | ||
cxx: clang++ | ||
cxxflags: ${{ inputs.ANDROID_CMAKE_CXX_FLAGS }} | ||
swiftflags: -sdk $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -target -Xclang-linker i686-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }} -Xclang-linker --sysroot -Xclang-linker $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -resource-dir -Xclang-linker $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/lib/clang/17 -L ${{ github.workspace }}/BinaryCache/swift/lib/swift/android -g | ||
os: Android | ||
llvm_flags: -DCMAKE_SYSTEM_PROCESSOR=i686 -DLLVM_HOST_TRIPLE=i686-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }} | ||
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 | ||
- arch: x86_64 | ||
cpu: 'x86_64' | ||
triple: 'x86_64-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }}' | ||
triple_no_api_level: x86_64-unknown-linux-android | ||
cc: clang | ||
cflags: ${{ inputs.ANDROID_CMAKE_C_FLAGS }} | ||
cxx: clang++ | ||
cxxflags: ${{ inputs.ANDROID_CMAKE_CXX_FLAGS }} | ||
swiftflags: -sdk $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -target -Xclang-linker x86_64-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }} -Xclang-linker --sysroot -Xclang-linker $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -resource-dir -Xclang-linker $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/lib/clang/17 -L ${{ github.workspace }}/BinaryCache/swift/lib/swift/android -g | ||
os: Android | ||
llvm_flags: -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DLLVM_HOST_TRIPLE=x86_64-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }} | ||
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 | ||
steps: | ||
- name: Download Compilers | ||
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main | ||
with: | ||
name: compilers-Windows-${{ inputs.build_arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/llvm-project | ||
ref: ${{ inputs.llvm_project_revision }} | ||
path: ${{ github.workspace }}/SourceCache/llvm-project | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift | ||
ref: ${{ inputs.swift_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: apple/swift-corelibs-libdispatch | ||
ref: ${{ inputs.swift_corelibs_libdispatch_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-corelibs-libdispatch | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-experimental-string-processing | ||
ref: ${{ inputs.swift_experimental_string_processing_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-experimental-string-processing | ||
show-progress: false | ||
- name: Install Swift Toolchain | ||
uses: compnerd/gha-setup-swift@6c9f2db7c3155c57fe35f160bcd5cf5859b9c1ba # main | ||
with: | ||
github-repo: ${{ env.WORKAROUND_WINDOWS_PINNED_BOOTSTRAP_TOOLCHAIN_REPO }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
release-asset-name: installer-${{ inputs.build_arch }}.exe | ||
release-tag-name: ${{ env.WORKAROUND_WINDOWS_PINNED_BOOTSTRAP_TOOLCHAIN_RELEASE }} | ||
# NOTE(compnerd): we execute unconditionally as we use CMake from VSDevEnv | ||
- 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: nttld/setup-ndk@v1 | ||
if: matrix.os == 'Android' && inputs.build_android | ||
id: setup-ndk | ||
with: | ||
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }} | ||
- name: Configure LLVM | ||
if: matrix.os != 'Android' || inputs.build_android | ||
run: | | ||
# NOTE: used by `matrix.cc` | ||
$CLANG_CL = "cl" | ||
if ("${{ matrix.os }}" -eq "Android") { | ||
$NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} | ||
# Since win/arm64 doesn't have one, this logic is necessary because | ||
# passing an empty CMAKE_ANDROID_NDK value causes a failure. | ||
$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 }} ` | ||
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" ` | ||
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} ` | ||
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/usr ` | ||
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} ` | ||
${{ matrix.llvm_flags }} ` | ||
${{ matrix.extra_flags }} ` | ||
$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_android | ||
run: | | ||
# NOTE: used by `matrix.cc` | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
if ("${{ matrix.os }}" -eq "Android") { | ||
$NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} | ||
# Since win/arm64 doesn't have one, this logic is necessary because | ||
# passing an empty CMAKE_ANDROID_NDK value causes a failure. | ||
$CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH" | ||
$SWIFT_NDK_FLAG = "-DSWIFT_ANDROID_NDK_PATH=$NDKPATH" | ||
} | ||
$CMAKE_CPU = if ("${{ matrix.cpu }}" -eq "armv7") { | ||
"armv7-a" | ||
} else { | ||
"${{ matrix.cpu }}" | ||
} | ||
Remove-Item env:\SDKROOT | ||
cmake -B ${{ github.workspace }}/BinaryCache/swift ` | ||
-C ${{ github.workspace }}/SourceCache/swift/cmake/caches/Runtime-${{ matrix.os }}-${{ matrix.cpu }}.cmake ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${{ matrix.cc }} ` | ||
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} ` | ||
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" ` | ||
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/usr ` | ||
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${CMAKE_CPU} ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple_no_api_level }} ` | ||
-D CMAKE_Swift_FLAGS="-resource-dir ${{ github.workspace }}/BinaryCache/swift/lib/swift ${{ matrix.swiftflags }}" ` | ||
-D MSVC_C_ARCHITECTURE_ID=${{ matrix.arch }} ` | ||
-D MSVC_CXX_ARCHITECTURE_ID=${{ matrix.arch }} ` | ||
${{ matrix.linker_flags }} ` | ||
${{ matrix.extra_flags }} ` | ||
$CMAKE_NDK_FLAG ` | ||
$SWIFT_NDK_FLAG ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift ` | ||
-D LLVM_DIR=${{ github.workspace }}/BinaryCache/llvm/lib/cmake/llvm ` | ||
-D SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY=YES ` | ||
-D SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP=YES ` | ||
-D SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED=YES ` | ||
-D SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING=YES ` | ||
-D SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION=YES ` | ||
-D SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING=YES ` | ||
-D SWIFT_ENABLE_SYNCHRONIZATION=YES ` | ||
-D SWIFT_ENABLE_VOLATILE=YES ` | ||
-D SWIFT_NATIVE_SWIFT_TOOLS_PATH=${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin ` | ||
-D SWIFT_PATH_TO_LIBDISPATCH_SOURCE=${{ github.workspace }}/SourceCache/swift-corelibs-libdispatch ` | ||
-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_android | ||
run: | | ||
Remove-Item env:\SDKROOT | ||
cmake --build ${{ github.workspace }}/BinaryCache/swift | ||
- name: Install Swift Standard Library | ||
if: matrix.os != 'Android' || inputs.build_android | ||
run: | | ||
Remove-Item env:\SDKROOT | ||
cmake --build ${{ github.workspace }}/BinaryCache/swift --target install | ||
- uses: actions/upload-artifact@v4 | ||
if: matrix.os != 'Android' || inputs.build_android | ||
with: | ||
name: ${{ matrix.os }}-stdlib-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BuildRoot/Library | ||
- uses: actions/upload-artifact@v4 | ||
if: matrix.os == 'Windows' | ||
with: | ||
name: windows-vfs-overlay-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml | ||
- name: Upload PDBs to Azure | ||
uses: microsoft/[email protected] | ||
if: ${{ inputs.debug_info && matrix.os == 'Windows' }} | ||
with: | ||
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }} | ||
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }} | ||
symbolsFolder: ${{ github.workspace }}/BinaryCache | ||
searchPattern: '**/*.pdb' | ||
- name: Upload DLLs to Azure | ||
uses: microsoft/[email protected] | ||
if: ${{ inputs.debug_info && matrix.os == 'Windows' }} | ||
with: | ||
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }} | ||
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }} | ||
symbolsFolder: ${{ github.workspace }}/BinaryCache | ||
searchPattern: '**/*.dll' | ||
macros: | ||
# TODO: Build this on macOS or make an equivalent Mac-only job | ||
if: inputs.build_os == 'Windows' | ||
needs: [compilers, cmark_gfm, stdlib] | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(inputs.host_matrix) }} | ||
name: Windows ${{ matrix.arch }} Macros | ||
steps: | ||
- name: Download Compilers | ||
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main | ||
with: | ||
name: compilers-Windows-${{ inputs.build_arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library | ||
- name: Download swift-syntax | ||
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main | ||
with: | ||
name: swift-syntax-Windows-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BinaryCache/swift-syntax | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Windows-stdlib-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library | ||
- uses: actions/download-artifact@v4 | ||
if: matrix.arch == 'arm64' | ||
with: | ||
name: Windows-stdlib-${{ inputs.build_arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: windows-vfs-overlay-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BinaryCache/swift/stdlib | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift | ||
ref: ${{ inputs.swift_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: apple/swift-foundation | ||
ref: ${{ inputs.swift_foundation_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-foundation | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-testing | ||
ref: ${{ inputs.swift_testing_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-testing | ||
show-progress: false | ||
# NOTE(compnerd): we execute unconditionally as we use CMake from VSDevEnv | ||
- 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 }} | ||
- run: | | ||
$RTLPath = cygpath -w ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/bin | ||
echo ${RTLPath} | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | ||
- name: extract swift-syntax | ||
run: | | ||
$module = "${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules/SwiftSyntaxConfig.cmake" | ||
$bindir = cygpath -m ${{ github.workspace }}/BinaryCache/swift-syntax | ||
(Get-Content $module).Replace('<BINARY_DIR>', "${bindir}") | Set-Content $module | ||
- name: Configure Foundation Macros | ||
run: | | ||
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/swift-foundation-macros ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_FLAGS="-resource-dir ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/lib/swift -L${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/lib/swift/windows -vfsoverlay ${WINDOWS_VFS_OVERLAY} -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules ${{ inputs.CMAKE_Swift_FLAGS }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-foundation/Sources/FoundationMacros ` | ||
-D SwiftSyntax_DIR=${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules | ||
- name: Build Foundation Macros | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-foundation-macros | ||
- name: Configure Testing Macros | ||
run: | | ||
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/swift-testing-macros ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_FLAGS="-resource-dir ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/lib/swift -L${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/lib/swift/windows -vfsoverlay ${WINDOWS_VFS_OVERLAY} -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules ${{ inputs.CMAKE_Swift_FLAGS }}" ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-testing/Sources/TestingMacros ` | ||
-D SwiftSyntax_DIR=${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules | ||
- name: Build Testing Macros | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-testing-macros | ||
- name: Install Foundation Macros | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-foundation-macros --target install | ||
- name: Install Testing Macros | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-testing-macros --target install | ||
- name: Upload macros | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: macros-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BuildRoot/Library | ||
- name: Upload PDBs to Azure | ||
uses: microsoft/[email protected] | ||
if: ${{ inputs.debug_info }} | ||
with: | ||
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }} | ||
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }} | ||
symbolsFolder: ${{ github.workspace }}/BinaryCache/swift-foundation-macros | ||
searchPattern: '**/*.pdb' | ||
- name: Upload DLLs to Azure | ||
uses: microsoft/[email protected] | ||
if: ${{ inputs.debug_info }} | ||
with: | ||
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }} | ||
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }} | ||
symbolsFolder: ${{ github.workspace }}/BinaryCache/swift-foundation-macros | ||
searchPattern: '**/*.dll' | ||
sdk: | ||
# TODO: Build this on macOS or make an equivalent Mac-only job | ||
if: inputs.build_os == 'Windows' | ||
needs: [libxml2, curl, zlib, compilers, cmark_gfm, stdlib, macros] | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- arch: amd64 | ||
cpu: 'x86_64' | ||
triple: 'x86_64-unknown-windows-msvc' | ||
triple_no_api_level: 'x86_64-unknown-windows-msvc' | ||
cc: '$CLANG_CL' | ||
cflags: ${{ inputs.WINDOWS_CMAKE_C_FLAGS }} | ||
cxx: '$CLANG_CL' | ||
cxxflags: ${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }} | ||
swiftflags: ${{ inputs.CMAKE_Swift_FLAGS }} | ||
os: Windows | ||
linker_flags: '-D CMAKE_EXE_LINKER_FLAGS="${{ inputs.WINDOWS_CMAKE_EXE_LINKER_FLAGS }}" -D CMAKE_SHARED_LINKER_FLAGS="${{ inputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}" -D CMAKE_STATIC_LIBRARY_PREFIX_Swift=lib' | ||
extra_flags: | ||
- arch: arm64 | ||
cpu: 'aarch64' | ||
triple: 'aarch64-unknown-windows-msvc' | ||
triple_no_api_level: 'aarch64-unknown-windows-msvc' | ||
cc: '$CLANG_CL' | ||
cflags: ${{ inputs.WINDOWS_CMAKE_C_FLAGS }} | ||
cxx: '$CLANG_CL' | ||
cxxflags: ${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }} | ||
swiftflags: ${{ inputs.CMAKE_Swift_FLAGS }} | ||
os: Windows | ||
linker_flags: '-D CMAKE_EXE_LINKER_FLAGS="${{ inputs.WINDOWS_CMAKE_EXE_LINKER_FLAGS }}" -D CMAKE_SHARED_LINKER_FLAGS="${{ inputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}" -D CMAKE_STATIC_LIBRARY_PREFIX_Swift=lib' | ||
extra_flags: | ||
- arch: x86 | ||
cpu: 'i686' | ||
triple: 'i686-unknown-windows-msvc' | ||
triple_no_api_level: 'i686-unknown-windows-msvc' | ||
cc: '$CLANG_CL' | ||
cflags: ${{ inputs.WINDOWS_CMAKE_C_FLAGS }} | ||
cxx: '$CLANG_CL' | ||
cxxflags: ${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }} | ||
swiftflags: ${{ inputs.CMAKE_Swift_FLAGS }} | ||
os: Windows | ||
linker_flags: '-D CMAKE_EXE_LINKER_FLAGS="${{ inputs.WINDOWS_CMAKE_EXE_LINKER_FLAGS }}" -D CMAKE_SHARED_LINKER_FLAGS="${{ inputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}" -D CMAKE_STATIC_LIBRARY_PREFIX_Swift=lib' | ||
extra_flags: | ||
- arch: arm64 | ||
cpu: 'aarch64' | ||
triple: 'aarch64-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }}' | ||
triple_no_api_level: aarch64-unknown-linux-android | ||
cc: clang | ||
cflags: ${{ inputs.ANDROID_CMAKE_C_FLAGS }} | ||
cxx: clang++ | ||
cxxflags: ${{ inputs.ANDROID_CMAKE_CXX_FLAGS }} | ||
swiftflags: -sdk $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -target -Xclang-linker aarch64-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }} -Xclang-linker --sysroot -Xclang-linker $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -resource-dir -Xclang-linker $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/lib/clang/17 -L ${{ github.workspace }}/BinaryCache/swift/lib/swift/android -g | ||
os: Android | ||
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=arm64-v8a | ||
- arch: armv7 | ||
cpu: armv7 | ||
triple: 'armv7a-unknown-linux-androideabi${{ inputs.ANDROID_API_LEVEL }}' | ||
triple_no_api_level: armv7-unknown-linux-androideabi | ||
cc: clang | ||
cflags: ${{ inputs.ANDROID_CMAKE_C_FLAGS }} | ||
cxx: clang++ | ||
cxxflags: ${{ inputs.ANDROID_CMAKE_CXX_FLAGS }} | ||
swiftflags: -sdk $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -target -Xclang-linker armv7a-unknown-linux-androideabi${{ inputs.ANDROID_API_LEVEL }} -Xclang-linker --sysroot -Xclang-linker $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -resource-dir -Xclang-linker $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/lib/clang/17 -L ${{ github.workspace }}/BinaryCache/swift/lib/swift/android -g | ||
os: Android | ||
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=armeabi-v7a | ||
- arch: i686 | ||
cpu: i686 | ||
triple: 'i686-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }}' | ||
triple_no_api_level: i686-unknown-linux-android | ||
cc: clang | ||
cflags: ${{ inputs.ANDROID_CMAKE_C_FLAGS }} | ||
cxx: clang++ | ||
cxxflags: ${{ inputs.ANDROID_CMAKE_CXX_FLAGS }} | ||
swiftflags: -sdk $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -target -Xclang-linker i686-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }} -Xclang-linker --sysroot -Xclang-linker $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -resource-dir -Xclang-linker $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/lib/clang/17 -L ${{ github.workspace }}/BinaryCache/swift/lib/swift/android -g | ||
os: Android | ||
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 | ||
- arch: x86_64 | ||
cpu: 'x86_64' | ||
triple: 'x86_64-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }}' | ||
triple_no_api_level: x86_64-unknown-linux-android | ||
cc: clang | ||
cflags: ${{ inputs.ANDROID_CMAKE_C_FLAGS }} | ||
cxx: clang++ | ||
cxxflags: ${{ inputs.ANDROID_CMAKE_CXX_FLAGS }} | ||
swiftflags: -sdk $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -target -Xclang-linker x86_64-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }} -Xclang-linker --sysroot -Xclang-linker $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -resource-dir -Xclang-linker $NDKPATH/toolchains/llvm/prebuilt/windows-x86_64/lib/clang/17 -L ${{ github.workspace }}/BinaryCache/swift/lib/swift/android -g | ||
os: Android | ||
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 | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
if: matrix.os != 'Android' || inputs.build_android | ||
with: | ||
name: libxml2-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.libxml2_version }} | ||
path: ${{ github.workspace }}/BuildRoot/Library/libxml2-${{ inputs.libxml2_version }}/usr | ||
- uses: actions/download-artifact@v4 | ||
if: matrix.os != 'Android' || inputs.build_android | ||
with: | ||
name: curl-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.curl_version }} | ||
path: ${{ github.workspace }}/BuildRoot/Library/curl-${{ inputs.curl_version }}/usr | ||
- uses: actions/download-artifact@v4 | ||
if: matrix.os != 'Android' || inputs.build_android | ||
with: | ||
name: zlib-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.zlib_version }} | ||
path: ${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr | ||
- name: Download Compilers | ||
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main | ||
with: | ||
name: compilers-Windows-${{ inputs.build_arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library | ||
- uses: actions/download-artifact@v4 | ||
if: matrix.os != 'Android' || inputs.build_android | ||
with: | ||
name: ${{ matrix.os }}-stdlib-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Windows-stdlib-${{ inputs.build_arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library | ||
- uses: actions/download-artifact@v4 | ||
if: matrix.os == 'Windows' | ||
with: | ||
name: windows-vfs-overlay-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BinaryCache/swift/stdlib | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: macros-${{ inputs.build_arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: apple/swift-corelibs-libdispatch | ||
ref: ${{ inputs.swift_corelibs_libdispatch_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-corelibs-libdispatch | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: apple/swift-corelibs-foundation | ||
ref: ${{ inputs.swift_corelibs_foundation_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-corelibs-foundation | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: apple/swift-foundation | ||
ref: ${{ inputs.swift_foundation_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-foundation | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: apple/swift-foundation-icu | ||
ref: ${{ inputs.swift_foundation_icu_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-foundation-icu | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: apple/swift-collections | ||
ref: ${{ inputs.swift_collections_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-collections | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-corelibs-xctest | ||
ref: ${{ inputs.swift_corelibs_xctest_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-corelibs-xctest | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-testing | ||
ref: ${{ inputs.swift_testing_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-testing | ||
show-progress: false | ||
- run: | | ||
$RTLPath = cygpath -w ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/bin | ||
echo ${RTLPath} | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | ||
$SDKRoot = cygpath -w ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk | ||
echo "SDKROOT=${SDKRoot}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | ||
# NOTE(compnerd): we execute unconditionally as we use CMake from VSDevEnv | ||
- 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 }} | ||
# FIXME(compnerd): workaround CMake 3.29-3.30 issue | ||
- uses: lukka/get-cmake@aa1df13cce8c30d2cb58efa871271c5a764623f8 # main | ||
with: | ||
cmakeVersion: 3.28.6 | ||
- uses: nttld/setup-ndk@v1 | ||
if: matrix.os == 'Android' && inputs.build_android | ||
id: setup-ndk | ||
with: | ||
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }} | ||
- name: Configure libdispatch | ||
if: matrix.os != 'Android' || inputs.build_android | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
if ("${{ matrix.os }}" -eq "Android") { | ||
$NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} | ||
# Since win/arm64 doesn't have one, this logic is necessary because | ||
# passing an empty CMAKE_ANDROID_NDK value causes a failure. | ||
$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") { | ||
"-vfsoverlay ${WINDOWS_VFS_OVERLAY} -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules" | ||
} else { | ||
"" | ||
} | ||
$CMAKE_CPU = if ("${{ matrix.cpu }}" -eq "armv7") { "armv7-a" } else { "${{ matrix.cpu }}" } | ||
cmake -B ${{ github.workspace }}/BinaryCache/libdispatch ` | ||
-D BUILD_SHARED_LIBS=YES ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${{ matrix.cc }} ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" ` | ||
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} ` | ||
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/usr ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple_no_api_level }} ` | ||
-D CMAKE_Swift_FLAGS="-resource-dir ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/usr/lib/swift -L${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/usr/lib/swift/${{ matrix.os }} ${OVERLAY_FLAGS} ${{ matrix.swiftflags }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${CMAKE_CPU} ` | ||
-D MSVC_C_ARCHITECTURE_ID=${{ matrix.arch }} ` | ||
-D MSVC_CXX_ARCHITECTURE_ID=${{ matrix.arch }} ` | ||
${{ matrix.linker_flags }} ` | ||
${{ matrix.extra_flags }} ` | ||
$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_android | ||
run: | | ||
cmake --build ${{ github.workspace }}/BinaryCache/libdispatch | ||
- name: Configure Foundation | ||
if: matrix.os != 'Android' || inputs.build_android | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
if ("${{ matrix.os }}" -eq "Android") { | ||
$NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} | ||
# Since win/arm64 doesn't have one, this logic is necessary because | ||
# passing an empty CMAKE_ANDROID_NDK value causes a failure. | ||
$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") { | ||
"-vfsoverlay ${WINDOWS_VFS_OVERLAY} -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules" | ||
} else { | ||
"" | ||
} | ||
$CMAKE_CPU = if ("${{ matrix.cpu }}" -eq "armv7") { "armv7-a" } else { "${{ matrix.cpu }}" } | ||
$DEFINITION_FLAG = if ("${{ matrix.os }}" -eq "Windows") { "/D" } else { "-D" } | ||
$LIBZ = if ("${{ matrix.os }}" -eq "Windows") { "zlibstatic.lib" } else { "libz.a" } | ||
$SWIFT_FOUNDATION_SOURCE_DIR = cygpath -m ${{ github.workspace }}/SourceCache/swift-foundation | ||
$SWIFT_FOUNDATION_ICU_SOURCE_DIR = cygpath -m ${{ github.workspace }}/SourceCache/swift-foundation-icu | ||
$SWIFT_COLLECTIONS_SOURCE_DIR = cygpath -m ${{ github.workspace }}/SourceCache/swift-collections | ||
$build_tools = if ("${{ matrix.os }}" -eq "Windows") { "YES" } else { "NO" } | ||
cmake -B ${{ github.workspace }}/BinaryCache/foundation ` | ||
-D BUILD_SHARED_LIBS=YES ` | ||
-D CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL="/MD" ` | ||
-D CMAKE_ASM_FLAGS="--target=${{ matrix.triple }}" ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${{ matrix.cc }} ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" ` | ||
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} ` | ||
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" ` | ||
-D CMAKE_EXE_LINKER_FLAGS="${{ inputs.WINDOWS_CMAKE_EXE_LINKER_FLAGS }}" ` | ||
-D CMAKE_FIND_PACKAGE_PREFER_CONFIG=YES ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/usr ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple_no_api_level }} ` | ||
-D CMAKE_Swift_FLAGS="-resource-dir ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/usr/lib/swift -L${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/usr/lib/swift/${{ matrix.os }} ${OVERLAY_FLAGS} ${{ matrix.swiftflags }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${CMAKE_CPU} ` | ||
-D MSVC_C_ARCHITECTURE_ID=${{ matrix.arch }} ` | ||
-D MSVC_CXX_ARCHITECTURE_ID=${{ matrix.arch }} ` | ||
${{ matrix.linker_flags }} ` | ||
${{ matrix.extra_flags }} ` | ||
$CMAKE_NDK_FLAG ` | ||
$SWIFT_NDK_FLAG ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-corelibs-foundation ` | ||
-D dispatch_DIR=${{ github.workspace }}/BinaryCache/libdispatch/cmake/modules ` | ||
-D CURL_DIR=${{ github.workspace }}/BuildRoot/Library/curl-${{ inputs.curl_version }}/usr/lib/cmake/CURL ` | ||
-D FOUNDATION_BUILD_TOOLS=${build_tools} ` | ||
-D Foundation_MACRO=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin ` | ||
-D ENABLE_TESTING=NO ` | ||
-D _SwiftFoundation_SourceDIR=$SWIFT_FOUNDATION_SOURCE_DIR ` | ||
-D _SwiftFoundationICU_SourceDIR=$SWIFT_FOUNDATION_ICU_SOURCE_DIR ` | ||
-D _SwiftCollections_SourceDIR=$SWIFT_COLLECTIONS_SOURCE_DIR ` | ||
-D LibXml2_DIR=${{ github.workspace }}/BuildRoot/Library/libxml2-${{ inputs.libxml2_version }}/usr/lib/cmake/libxml2-${{ inputs.libxml2_version }} ` | ||
-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/$LIBZ ` | ||
-D SwiftFoundation_MACRO=${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin | ||
- name: Build foundation | ||
if: matrix.os != 'Android' || inputs.build_android | ||
run: | | ||
cmake --build ${{ github.workspace }}/BinaryCache/foundation | ||
# TODO(compnerd) correctly version XCTest | ||
- name: Configure xctest | ||
if: matrix.os != 'Android' || inputs.build_android | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
if ("${{ matrix.os }}" -eq "Android") { | ||
$NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} | ||
# Since win/arm64 doesn't have one, this logic is necessary because | ||
# passing an empty CMAKE_ANDROID_NDK value causes a failure. | ||
$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") { | ||
"-vfsoverlay ${WINDOWS_VFS_OVERLAY} -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules" | ||
} else { | ||
"" | ||
} | ||
$CMAKE_CPU = if ("${{ matrix.cpu }}" -eq "armv7") { "armv7-a" } else { "${{ matrix.cpu }}" } | ||
cmake -B ${{ github.workspace }}/BinaryCache/xctest ` | ||
-D BUILD_SHARED_LIBS=YES ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_BUILD_WITH_INSTALL_RPATH=YES ` | ||
-D CMAKE_C_COMPILER=${{ matrix.cc }} ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" ` | ||
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} ` | ||
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/Library/XCTest-development/usr ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple_no_api_level }} ` | ||
-D CMAKE_Swift_FLAGS="-resource-dir ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/usr/lib/swift -L${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/usr/lib/swift/${{ matrix.os }} ${OVERLAY_FLAGS} ${{ matrix.swiftflags }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${CMAKE_CPU} ` | ||
${{ matrix.linker_flags }} ` | ||
${{ matrix.extra_flags }} ` | ||
$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_android | ||
run: | | ||
cmake --build ${{ github.workspace }}/BinaryCache/xctest | ||
- name: Configure Testing | ||
if: matrix.os != 'Android' || inputs.build_android | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
if ("${{ matrix.os }}" -eq "Android") { | ||
$NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }} | ||
# Since win/arm64 doesn't have one, this logic is necessary because | ||
# passing an empty CMAKE_ANDROID_NDK value causes a failure. | ||
$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") { | ||
"-vfsoverlay ${WINDOWS_VFS_OVERLAY} -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules" | ||
} else { | ||
"" | ||
} | ||
# Workaround the issue of not using the new Swift driver , that forces us to disable the CMP0157 policy. | ||
(Get-Content -Path "${{ github.workspace }}\SourceCache\swift-testing\CMakeLists.txt") -replace 'cmake_policy\(SET CMP0157 NEW\)', 'cmake_policy(SET CMP0157 OLD)' | Set-Content -Path "${{ github.workspace }}\SourceCache\swift-testing\CMakeLists.txt" | ||
$CMAKE_CPU = if ("${{ matrix.cpu }}" -eq "armv7") { "armv7-a" } else { "${{ matrix.cpu }}" } | ||
cmake -B ${{ github.workspace }}/BinaryCache/testing ` | ||
-D BUILD_SHARED_LIBS=YES ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_BUILD_WITH_INSTALL_RPATH=YES ` | ||
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} ` | ||
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/Library/Testing-development/usr ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple_no_api_level }} ` | ||
-D CMAKE_Swift_FLAGS="-package-name swift_testing -resource-dir ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/usr/lib/swift -L${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/usr/lib/swift/${{ matrix.os }} ${OVERLAY_FLAGS} ${{ matrix.swiftflags }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${CMAKE_CPU} ` | ||
${{ matrix.linker_flags }} ` | ||
${{ matrix.extra_flags }} ` | ||
$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/{{ inputs.swift_version }}+Asserts/usr/bin/TestingMacros.dll | ||
- name: Build Testing | ||
if: matrix.os != 'Android' || inputs.build_android | ||
run: | | ||
cmake --build ${{ github.workspace }}/BinaryCache/testing | ||
- name: Install Testing | ||
if: matrix.os != 'Android' || inputs.build_android | ||
run: | | ||
cmake --build ${{ github.workspace }}/BinaryCache/testing --target install | ||
- name: Install xctest | ||
if: matrix.os != 'Android' || inputs.build_android | ||
run: | | ||
cmake --build ${{ github.workspace }}/BinaryCache/xctest --target install | ||
- name: Install foundation | ||
if: matrix.os != 'Android' || inputs.build_android | ||
run: | | ||
cmake --build ${{ github.workspace }}/BinaryCache/foundation --target install | ||
- name: Install libdispatch | ||
if: matrix.os != 'Android' || inputs.build_android | ||
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_android | ||
with: | ||
script: | | ||
import os | ||
import plistlib | ||
info_plist = r'${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/${{ matrix.os }}.platform/Info.plist' | ||
with open(os.path.normpath(info_plist), 'wb') as plist: | ||
# TODO(compnerd) derive this from the install directory | ||
plistlib.dump({ 'DefaultProperties': { 'XCTEST_VERSION': 'development', 'SWIFTC_FLAGS': ['-use-ld=lld'] } }, plist) | ||
sdk_settings_plist = r'${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/SDKSettings.plist' | ||
with open(os.path.normpath(sdk_settings_plist), 'wb') as plist: | ||
# TODO(compnerd) derive this from the CMAKE_BUILD_TYPE for the | ||
# runtime. | ||
plistlib.dump({ 'DefaultProperties': { 'DEFAULT_USE_RUNTIME': 'MD' } }, plist) | ||
- run: | | ||
$SDKSettings = @{ | ||
CanonicalName = "${{ matrix.triple }}" | ||
DisplayName = "${{ matrix.os }}" | ||
IsBaseSDK = "NO" | ||
Version = "${{ inputs.swift_version }}" | ||
VersionMap = @{} | ||
DefaultProperties = @{ | ||
PLATFORM_NAME = "${{ matrix.os }}" | ||
DEFAULT_COMPILER = [string]::Format(".org.compnerd.dt.toolchain.{0}.{1}-asserts", (Get-Date -Format "yyyymmdd"), ((Get-Date).Hour % 6)) | ||
} | ||
} | ||
if ("${{ matrix.os }}" -eq "Windows") { | ||
$SDKSettings.DefaultProperties.DEFAULT_USE_RUNTIME = "MD" | ||
} | ||
New-Item -ItemType Directory -Path "${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk" -Force | Out-Null | ||
$SDKSettings | ConvertTo-JSON | Out-File -FilePath "${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk/SDKSettings.json" | ||
- uses: actions/upload-artifact@v4 | ||
if: matrix.os != 'Android' || inputs.build_android | ||
with: | ||
name: ${{ matrix.os }}-sdk-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/${{ matrix.os }}.platform | ||
- name: Upload PDBs to Azure | ||
uses: microsoft/[email protected] | ||
if: ${{ inputs.debug_info && matrix.os == 'Windows' }} | ||
with: | ||
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }} | ||
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }} | ||
symbolsFolder: ${{ github.workspace }}/BinaryCache | ||
searchPattern: '**/*.pdb' | ||
- name: Upload DLLs to Azure | ||
uses: microsoft/[email protected] | ||
if: ${{ inputs.debug_info && matrix.os == 'Windows' }} | ||
with: | ||
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }} | ||
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }} | ||
symbolsFolder: ${{ github.workspace }}/BinaryCache | ||
searchPattern: '**/*.dll' | ||
devtools: | ||
# TODO: Build this on macOS or make an equivalent Mac-only job | ||
if: inputs.build_os == 'Windows' | ||
needs: [sqlite, compilers, stdlib, sdk] | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(inputs.host_matrix) }} | ||
name: Windows ${{ matrix.arch }} Developer Tools | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: sqlite-Windows-${{ matrix.arch }}-${{ inputs.swift_toolchain_sqlite_version }} | ||
path: ${{ github.workspace }}/BinaryCache/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr | ||
- name: Download Compilers | ||
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main | ||
with: | ||
name: compilers-Windows-${{ inputs.build_arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Windows-stdlib-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Windows-sdk-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: macros-${{ inputs.build_arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library | ||
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main | ||
with: | ||
name: swift-syntax-Windows-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BinaryCache/swift-syntax | ||
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main | ||
with: | ||
name: cmark-gfm-Windows-${{ matrix.arch }}-${{ inputs.swift_cmark_version }} | ||
path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/indexstore-db | ||
ref: ${{ inputs.indexstore_db_revision }} | ||
path: ${{ github.workspace }}/SourceCache/indexstore-db | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/sourcekit-lsp | ||
ref: ${{ inputs.sourcekit_lsp_revision }} | ||
path: ${{ github.workspace }}/SourceCache/sourcekit-lsp | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: apple/swift-argument-parser | ||
ref: ${{ inputs.swift_argument_parser_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-argument-parser | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: apple/swift-asn1 | ||
ref: ${{ inputs.swift_asn1_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-asn1 | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: apple/swift-certificates | ||
ref: ${{ inputs.swift_certificates_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-certificates | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: apple/swift-collections | ||
ref: ${{ inputs.swift_collections_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-collections | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: apple/swift-crypto | ||
ref: ${{ inputs.swift_crypto_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-crypto | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-driver | ||
ref: ${{ inputs.swift_driver_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-driver | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-format | ||
ref: ${{ inputs.swift_format_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-format | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-llbuild | ||
ref: ${{ inputs.swift_llbuild_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-llbuild | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-lmdb | ||
ref: ${{ inputs.swift_lmdb_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-lmdb | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-markdown | ||
ref: ${{ inputs.swift_markdown_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-markdown | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-package-manager | ||
ref: ${{ inputs.swift_package_manager_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-package-manager | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: apple/swift-system | ||
ref: ${{ inputs.swift_system_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-system | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-tools-support-core | ||
ref: ${{ inputs.swift_tools_support_core_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-tools-support-core | ||
show-progress: false | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift | ||
ref: ${{ inputs.swift_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift | ||
show-progress: false | ||
- run: | | ||
$RTLPath = cygpath -w ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/bin | ||
echo ${RTLPath} | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | ||
$SDKRoot = cygpath -w ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk | ||
echo "SDKROOT=${SDKRoot}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | ||
- 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 }} | ||
- run: | | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/dispatch ${env:SDKROOT}/usr/include/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/os ${env:SDKROOT}/usr/include/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/Block ${env:SDKROOT}/usr/include/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/_foundation_unicode ${env:SDKROOT}/usr/include | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/_FoundationCShims ${env:SDKROOT}/usr/include | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/BlocksRuntime.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/dispatch.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/swiftDispatch.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/Foundation.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/FoundationXML.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/FoundationNetworking.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/_FoundationICU.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/FoundationEssentials.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/FoundationInternationalization.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
# 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-${{ inputs.build_arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Windows-sdk-${{ inputs.build_arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform | ||
- name: Configure swift-argument-parser | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/swift-argument-parser ` | ||
-D BUILD_SHARED_LIBS=YES ` | ||
-D BUILD_TESTING=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" ` | ||
-D CMAKE_CXX_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }}" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${{ inputs.CMAKE_Swift_FLAGS }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-argument-parser | ||
- name: Build swift-argument-parser | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-argument-parser | ||
- name: Configure swift-collections | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/swift-collections ` | ||
-D BUILD_SHARED_LIBS=YES ` | ||
-D BUILD_TESTING=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" ` | ||
-D CMAKE_CXX_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }}" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${{ inputs.CMAKE_Swift_FLAGS }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-collections | ||
- name: Build swift-collections | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-collections | ||
- name: Configure swift-crypto | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/swift-crypto ` | ||
-D BUILD_SHARED_LIBS=NO ` | ||
-D BUILD_TESTING=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=cl ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" ` | ||
-D CMAKE_CXX_COMPILER=cl ` | ||
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }}" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${{ inputs.CMAKE_Swift_FLAGS }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-crypto | ||
- name: Build swift-crypto | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-crypto | ||
- name: Configure swift-llbuild | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/swift-llbuild ` | ||
-D BUILD_SHARED_LIBS=YES ` | ||
-D BUILD_TESTING=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=cl ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" ` | ||
-D CMAKE_CXX_COMPILER=cl ` | ||
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }}" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${{ inputs.CMAKE_Swift_FLAGS }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-llbuild ` | ||
-D LLBUILD_SUPPORT_BINDINGS=Swift ` | ||
-D SQLite3_LIBRARY=${{ github.workspace }}/BinaryCache/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr/lib/SQLite3.lib ` | ||
-D SQLite3_INCLUDE_DIR=${{ github.workspace }}/BinaryCache/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr/include | ||
- name: Build swift-llbuild | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-llbuild | ||
- name: Configure swift-system | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/swift-system ` | ||
-D BUILD_SHARED_LIBS=YES ` | ||
-D BUILD_TESTING=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" ` | ||
-D CMAKE_CXX_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }}" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${{ inputs.CMAKE_Swift_FLAGS }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-system | ||
- name: Build swift-system | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-system | ||
- name: Configure swift-tools-support-core | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/swift-tools-support-core ` | ||
-D BUILD_SHARED_LIBS=YES ` | ||
-D BUILD_TESTING=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" ` | ||
-D CMAKE_CXX_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }}" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${{ inputs.CMAKE_Swift_FLAGS }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-tools-support-core ` | ||
-D SwiftSystem_DIR=${{ github.workspace }}/BinaryCache/swift-system/cmake/modules ` | ||
-D SQLite3_LIBRARY=${{ github.workspace }}/BinaryCache/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr/lib/SQLite3.lib ` | ||
-D SQLite3_INCLUDE_DIR=${{ github.workspace }}/BinaryCache/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr/include | ||
- name: Build swift-tools-support-core | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-tools-support-core | ||
- name: Configure swift-driver | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/swift-driver ` | ||
-D BUILD_SHARED_LIBS=YES ` | ||
-D BUILD_TESTING=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" ` | ||
-D CMAKE_CXX_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }}" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${{ inputs.CMAKE_Swift_FLAGS }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-driver ` | ||
-D ArgumentParser_DIR=${{ github.workspace }}/BinaryCache/swift-argument-parser/cmake/modules ` | ||
-D LLBuild_DIR=${{ github.workspace }}/BinaryCache/swift-llbuild/cmake/modules ` | ||
-D SwiftSystem_DIR=${{ github.workspace }}/BinaryCache/swift-system/cmake/modules ` | ||
-D SQLite3_LIBRARY=${{ github.workspace }}/BinaryCache/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr/lib/SQLite3.lib ` | ||
-D SQLite3_INCLUDE_DIR=${{ github.workspace }}/BinaryCache/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr/include ` | ||
-D TSC_DIR=${{ github.workspace }}/BinaryCache/swift-tools-support-core/cmake/modules | ||
- name: Build swift-driver | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-driver | ||
- name: Configure swift-asn1 | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/swift-asn1 ` | ||
-D BUILD_SHARED_LIBS=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${{ inputs.CMAKE_Swift_FLAGS }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-asn1 | ||
- name: Build swift-asn1 | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-asn1 | ||
- name: Configure swift-certificates | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/swift-certificates ` | ||
-D BUILD_SHARED_LIBS=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${{ inputs.CMAKE_Swift_FLAGS }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-certificates ` | ||
-D SwiftASN1_DIR=${{ github.workspace }}/BinaryCache/swift-asn1/cmake/modules ` | ||
-D SwiftCrypto_DIR=${{ github.workspace }}/BinaryCache/swift-crypto/cmake/modules | ||
- name: Build swift-certificates | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-certificates | ||
- name: extract swift-syntax | ||
run: | | ||
$module = "${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules/SwiftSyntaxConfig.cmake" | ||
$bindir = cygpath -m ${{ github.workspace }}/BinaryCache/swift-syntax | ||
(Get-Content $module).Replace('<BINARY_DIR>', "${bindir}") | Set-Content $module | ||
- name: Configure swift-package-manager | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/swift-package-manager ` | ||
-D BUILD_SHARED_LIBS=YES ` | ||
-D BUILD_TESTING=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" ` | ||
-D CMAKE_CXX_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }}" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${{ inputs.CMAKE_Swift_FLAGS }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-package-manager ` | ||
-D ArgumentParser_DIR=${{ github.workspace }}/BinaryCache/swift-argument-parser/cmake/modules ` | ||
-D LLBuild_DIR=${{ github.workspace }}/BinaryCache/swift-llbuild/cmake/modules ` | ||
-D SQLite3_INCLUDE_DIR=${{ github.workspace }}/BinaryCache/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr/include ` | ||
-D SQLite3_LIBRARY=${{ github.workspace }}/BinaryCache/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr/lib/SQLite3.lib ` | ||
-D SwiftASN1_DIR=${{ github.workspace }}/BinaryCache/swift-asn1/cmake/modules ` | ||
-D SwiftCertificates_DIR=${{ github.workspace }}/BinaryCache/swift-certificates/cmake/modules ` | ||
-D SwiftCollections_DIR=${{ github.workspace }}/BinaryCache/swift-collections/cmake/modules ` | ||
-D SwiftCrypto_DIR=${{ github.workspace }}/BinaryCache/swift-crypto/cmake/modules ` | ||
-D SwiftDriver_DIR=${{ github.workspace }}/BinaryCache/swift-driver/cmake/modules ` | ||
-D SwiftSyntax_DIR=${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules ` | ||
-D SwiftSystem_DIR=${{ github.workspace }}/BinaryCache/swift-system/cmake/modules ` | ||
-D TSC_DIR=${{ github.workspace }}/BinaryCache/swift-tools-support-core/cmake/modules | ||
- name: Build swift-package-manager | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-package-manager | ||
- name: Configure Markdown | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/swift-markdown ` | ||
-D BUILD_SHARED_LIBS=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
-D CMAKE_C_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" ` | ||
-D CMAKE_CXX_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }}" ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${{ inputs.CMAKE_Swift_FLAGS }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-markdown ` | ||
-D ArgumentParser_DIR=${{ github.workspace }}/BinaryCache/swift-argument-parser/cmake/modules ` | ||
-D cmark-gfm_DIR=${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake | ||
- name: Build Markdown | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-markdown | ||
- name: Configure Format | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/swift-format ` | ||
-D BUILD_SHARED_LIBS=YES ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
-D CMAKE_C_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${{ inputs.CMAKE_Swift_FLAGS }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-format ` | ||
-D ArgumentParser_DIR=${{ github.workspace }}/BinaryCache/swift-argument-parser/cmake/modules ` | ||
-D cmark-gfm_DIR=${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake ` | ||
-D SwiftMarkdown_DIR=${{ github.workspace }}/BinaryCache/swift-markdown/cmake/modules ` | ||
-D SwiftSyntax_DIR=${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules | ||
- name: Build swift-format | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-format | ||
- name: Configure swift-lmdb | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/swift-lmdb ` | ||
-D BUILD_SHARED_LIBS=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
-D CMAKE_C_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift-lmdb | ||
- name: Build swift-lmdb | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-lmdb | ||
- name: Configure IndexStoreDB | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/indexstore-db ` | ||
-D BUILD_SHARED_LIBS=NO ` | ||
-D BUILD_TESTING=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" ` | ||
-D CMAKE_CXX_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }} -I${env:SDKROOT}/usr/include -I${env:SDKROOT}/usr/include/Block" ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${{ inputs.CMAKE_Swift_FLAGS }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/indexstore-db ` | ||
-D LMDB_DIR=${{ github.workspace }}/BinaryCache/swift-lmdb/cmake/modules | ||
- name: Build indexstore-db | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/indexstore-db | ||
- name: Configure SourceKit-LSP | ||
run: | | ||
# Workaround CMake 3.20 issue | ||
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/sourcekit-lsp ` | ||
-D BUILD_SHARED_LIBS=YES ` | ||
-D BUILD_TESTING=NO ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_C_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" ` | ||
-D CMAKE_CXX_COMPILER=${CLANG_CL} ` | ||
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }}" ` | ||
<<<<<<< HEAD | ||
<<<<<<< HEAD | ||
<<<<<<< HEAD | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr ` | ||
======= | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/0.0.0+Asserts.xctoolchain/usr ` | ||
>>>>>>> 4439dd5 (rewords -development to 0.0.0) | ||
======= | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/0.0.0+Asserts/usr ` | ||
>>>>>>> 614506e (fix: naming conventions) | ||
======= | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
>>>>>>> 6e8dbd3 (use inputs.swift_version instead of hardcode?) | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${{ inputs.CMAKE_Swift_FLAGS }}" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
${{ matrix.cmake_linker_flags }} ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/sourcekit-lsp ` | ||
-D ArgumentParser_DIR=${{ github.workspace }}/BinaryCache/swift-argument-parser/cmake/modules ` | ||
-D IndexStoreDB_DIR=${{ github.workspace }}/BinaryCache/indexstore-db/cmake/modules ` | ||
-D LLBuild_DIR=${{ github.workspace }}/BinaryCache/swift-llbuild/cmake/modules ` | ||
-D SwiftCollections_DIR=${{ github.workspace }}/BinaryCache/swift-collections/cmake/modules ` | ||
-D SwiftCrypto_DIR=${{ github.workspace }}/BinaryCache/swift-crypto/cmake/modules ` | ||
-D SwiftPM_DIR=${{ github.workspace }}/BinaryCache/swift-package-manager/cmake/modules ` | ||
-D SwiftSyntax_DIR=${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules ` | ||
-D SwiftSystem_DIR=${{ github.workspace }}/BinaryCache/swift-system/cmake/modules ` | ||
-D TSC_DIR=${{ github.workspace }}/BinaryCache/swift-tools-support-core/cmake/modules ` | ||
-D LMDB_DIR=${{ github.workspace }}/BinaryCache/swift-lmdb/cmake/modules | ||
- name: Build SourceKit-LSP | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/SourceKit-LSP | ||
- name: Install swift-argument-parser | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-argument-parser --target install | ||
- name: Install swift-collections | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-collections --target install | ||
- name: Install swift-llbuild | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-llbuild --target install | ||
- name: Install swift-system | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-system --target install | ||
- name: Install swift-tools-support-core | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-tools-support-core --target install | ||
- name: Install swift-driver | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-driver --target install | ||
- name: Install swift-package-manager | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-package-manager --target install | ||
- name: Install SourceKit-LSP | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/sourcekit-lsp --target install | ||
- name: Install swift-format | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-format --target install | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: devtools-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BuildRoot/Library | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: swift-argument-parser-Windows-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BinaryCache/swift-argument-parser | ||
- name: Upload PDBs to Azure | ||
uses: microsoft/[email protected] | ||
if: ${{ inputs.debug_info }} | ||
with: | ||
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }} | ||
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }} | ||
symbolsFolder: ${{ github.workspace }}/BinaryCache | ||
searchPattern: '**/*.pdb' | ||
- name: Upload DLLs to Azure | ||
uses: microsoft/[email protected] | ||
if: ${{ inputs.debug_info }} | ||
with: | ||
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }} | ||
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }} | ||
symbolsFolder: ${{ github.workspace }}/BinaryCache | ||
searchPattern: '**/*.dll' | ||
- name: Upload EXEs to Azure | ||
uses: microsoft/[email protected] | ||
if: ${{ inputs.debug_info }} | ||
with: | ||
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }} | ||
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }} | ||
symbolsFolder: ${{ github.workspace }}/BinaryCache | ||
searchPattern: '**/*.exe' | ||
debugging_tools: | ||
# TODO: Build this on macOS or make an equivalent Mac-only job | ||
if: inputs.build_os == 'Windows' | ||
needs: [compilers, devtools, stdlib, sdk] | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(inputs.host_matrix) }} | ||
name: Windows ${{ matrix.arch }} Debugging Tools | ||
steps: | ||
- name: Download swift-argument-parser | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: swift-argument-parser-Windows-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BinaryCache/swift-argument-parser | ||
- name: Download Compilers | ||
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main | ||
with: | ||
name: compilers-Windows-${{ inputs.build_arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library | ||
- name: Download stdlib | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: Windows-stdlib-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library | ||
- name: Download SDK | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: Windows-sdk-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift | ||
ref: ${{ inputs.swift_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift | ||
show-progress: false | ||
- run: | | ||
$RTLPath = cygpath -w "${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/bin" | ||
echo ${RTLPath} | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | ||
$SDKRoot = cygpath -w "${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk" | ||
echo "SDKROOT=${SDKRoot}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | ||
- uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main | ||
with: | ||
host_arch: amd64 | ||
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' | ||
arch: ${{ matrix.arch }} | ||
- run: | | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/dispatch ${env:SDKROOT}/usr/include/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/os ${env:SDKROOT}/usr/include/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/Block ${env:SDKROOT}/usr/include/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/_foundation_unicode ${env:SDKROOT}/usr/include | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/_FoundationCShims ${env:SDKROOT}/usr/include | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/BlocksRuntime.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/dispatch.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/swiftDispatch.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/Foundation.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/FoundationXML.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/FoundationNetworking.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/_FoundationICU.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/FoundationEssentials.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/FoundationInternationalization.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/ | ||
# 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-${{ inputs.build_arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Windows-sdk-${{ inputs.build_arch }} | ||
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform | ||
- name: Configure swift-inspect | ||
run: | | ||
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe | ||
cmake -B ${{ github.workspace }}/BinaryCache/${{ matrix.arch }}/swift-inspect ` | ||
-D CMAKE_BUILD_TYPE=Release ` | ||
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts/usr ` | ||
-D CMAKE_Swift_COMPILER=${SWIFTC} ` | ||
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} ` | ||
-D CMAKE_Swift_COMPILER_WORKS=YES ` | ||
-D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${{ inputs.CMAKE_Swift_FLAGS }} -Xcc `"-I${env:SDKROOT}/usr/include/swift/SwiftRemoteMirror`"" ` | ||
-D CMAKE_Swift_FLAGS_RELEASE="-O" ` | ||
-D CMAKE_SYSTEM_NAME=Windows ` | ||
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} ` | ||
-G Ninja ` | ||
-S ${{ github.workspace }}/SourceCache/swift/tools/swift-inspect ` | ||
-D ArgumentParser_DIR=${{ github.workspace }}/BinaryCache/swift-argument-parser/cmake/modules | ||
- name: Build swift-inspect | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/${{ matrix.arch }}/swift-inspect | ||
- name: Install swift-inspect | ||
run: cmake --build ${{ github.workspace }}/BinaryCache/${{ matrix.arch }}/swift-inspect --target install | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: debugging_tools-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BuildRoot/Library | ||
package_tools: | ||
# TODO: Build this on macOS or make an equivalent Mac-only job | ||
if: inputs.build_os == 'Windows' | ||
name: Package Tools | ||
needs: [compilers, macros, debugging_tools, devtools] | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(inputs.host_matrix) }} | ||
steps: | ||
- name: Download Debugging Tools | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: debugging_tools-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BuildRoot/Library | ||
- name: Download Compilers | ||
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main | ||
with: | ||
name: compilers-Windows-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BuildRoot/Library | ||
- name: Download Developer Tools | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: devtools-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BuildRoot/Library | ||
- name: Download Macros | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: macros-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BuildRoot/Library | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-installer-scripts | ||
ref: ${{ inputs.swift_installer_scripts_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-installer-scripts | ||
show-progress: false | ||
- uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main | ||
with: | ||
host_arch: ${{ inputs.build_arch }} | ||
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' | ||
arch: ${{ matrix.arch }} | ||
- run: | | ||
$CertificatePath = Join-Path -Path ${env:RUNNER_TEMP} -ChildPath CodeSign.b64 | ||
$PFXPath = Join-Path -Path ${env:RUNNER_TEMP} -ChildPath CodeSign.pfx | ||
Set-Content -Path $CertificatePath -Value '${{ secrets.CERTIFICATE }}' | ||
certutil -decode $CertificatePath $PFXPath | ||
Echo CERTIFICATE=$PFXPath | Out-File -FilePath ${env:GITHUB_ENV} -Encoding utf8 -Append | ||
if: ${{ inputs.signed }} | ||
- name: Install WixToolset.Sdk | ||
run: | | ||
if ((Get-Package -Name WixToolset.Sdk -ErrorAction SilentlyContinue) -eq $null) { | ||
Install-Package -Name WixToolset.Sdk -RequiredVersion 4.0.1 -Force | ||
} | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: microsoft/mimalloc | ||
ref: ${{ inputs.mimalloc_revision }} | ||
path: ${{ github.workspace }}/SourceCache/mimalloc | ||
- name: Build and apply mimalloc | ||
run: | | ||
$HostMSArch = if ("${{ matrix.arch }}" -eq "arm64") { "arm64" } else { "x64" } | ||
$HostSuffix = if ("${{ matrix.arch }}" -eq "arm64") { "-arm64" } else { "" } | ||
$BuildSuffix = if ("${{ inputs.build_arch }}" -eq "arm64") { "-arm64" } else { "" } | ||
# Reference: https://github.com/microsoft/mimalloc/tree/dev/bin#minject | ||
msbuild ${{ github.workspace }}\SourceCache\mimalloc\ide\vs2022\mimalloc.sln -p:Configuration=Release -p:Platform=$HostMSArch | ||
$ToolchainBin = "${{ github.workspace }}\BuildRoot\Library\Developer\Toolchains\{{ inputs.swift_version }}+Asserts\usr\bin" | ||
Copy-Item -Path "${{ github.workspace }}\SourceCache\mimalloc\out\msvc-$HostMSArch\Release\mimalloc.dll" ` | ||
-Destination "$ToolchainBin" | ||
Copy-Item -Path "${{ github.workspace }}\SourceCache\mimalloc\out\msvc-$HostMSArch\Release\mimalloc-redirect$HostSuffix.dll" ` | ||
-Destination "$ToolchainBin" | ||
# When cross-compiling, bundle the second mimalloc redirect dll as a workaround for | ||
# https://github.com/microsoft/mimalloc/issues/997 | ||
if ("${{ inputs.build_arch }}" -ne "${{ matrix.arch }}") { | ||
Copy-Item -Path "${{ github.workspace }}\SourceCache\mimalloc\out\msvc-$HostMSArch\Release\mimalloc-redirect$HostSuffix.dll" ` | ||
-Destination "$ToolchainBin/mimalloc-redirect$BuildSuffix.dll" | ||
} | ||
$MimallocExecutables = @("swift.exe", | ||
"swiftc.exe", | ||
"swift-driver.exe", | ||
"swift-frontend.exe", | ||
"clang.exe", | ||
"clang++.exe", | ||
"clang-cl.exe", | ||
"lld.exe", | ||
"lld-link.exe", | ||
"ld.lld.exe", | ||
"ld64.lld.exe") | ||
foreach ($Exe in $MimallocExecutables) { | ||
# Binary-patch in place | ||
& "${{ github.workspace }}\SourceCache\mimalloc\bin\minject$BuildSuffix" -f -i -v "$ToolchainBin\$Exe" | ||
# Log the import table | ||
& "${{ github.workspace }}\SourceCache\mimalloc\bin\minject$BuildSuffix" -l "$ToolchainBin\$Exe" | ||
} | ||
- name: Package Build Tools | ||
run: | | ||
# When cross-compiling, bundle the second mimalloc redirect dll as a workaround for | ||
# https://github.com/microsoft/mimalloc/issues/997 | ||
$WORKAROUND_MIMALLOC_ISSUE_997 = if ("${{ inputs.build_arch }}" -ne "${{ matrix.arch }}") { "true" } else { "false" } | ||
msbuild -nologo -restore -maxCpuCount ` | ||
-p:BaseOutputPath=${{ github.workspace }}\BinaryCache\installer\ ` | ||
-p:Configuration=Release ` | ||
-p:SignOutput=${{ inputs.signed }} ` | ||
-p:CERTIFICATE=${env:CERTIFICATE} ` | ||
-p:PASSPHRASE=${{ secrets.PASSPHRASE }} ` | ||
-p:TOOLCHAIN_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts ` | ||
-p:ENABLE_MIMALLOC=true ` | ||
-p:WORKAROUND_MIMALLOC_ISSUE_997=$WORKAROUND_MIMALLOC_ISSUE_997 ` | ||
-p:ProductArchitecture=${{ matrix.arch }} ` | ||
-p:ProductVersion=${{ inputs.swift_version }} ` | ||
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/bld/bld.wixproj | ||
- name: Package CLI Tools | ||
run: | | ||
msbuild -nologo -restore -maxCpuCount ` | ||
-p:BaseOutputPath=${{ github.workspace }}\BinaryCache\installer\ ` | ||
-p:Configuration=Release ` | ||
-p:SignOutput=${{ inputs.signed }} ` | ||
-p:CERTIFICATE=${env:CERTIFICATE} ` | ||
-p:PASSPHRASE=${{ secrets.PASSPHRASE }} ` | ||
-p:TOOLCHAIN_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts ` | ||
-p:ProductArchitecture=${{ matrix.arch }} ` | ||
-p:ProductVersion=${{ inputs.swift_version }} ` | ||
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/cli/cli.wixproj | ||
- name: Package Debugging Tools | ||
run: | | ||
msbuild -nologo -restore -maxCpuCount ` | ||
-p:BaseOutputPath=${{ github.workspace }}\BinaryCache\installer\ ` | ||
-p:Configuration=Release ` | ||
-p:SignOutput=${{ inputs.signed }} ` | ||
-p:CERTIFICATE=${env:CERTIFICATE} ` | ||
-p:PASSPHRASE=${{ secrets.PASSPHRASE }} ` | ||
-p:TOOLCHAIN_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts ` | ||
-p:ProductArchitecture=${{ matrix.arch }} ` | ||
-p:ProductVersion=${{ inputs.swift_version }} ` | ||
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/dbg/dbg.wixproj | ||
- name: Package IDE Tools | ||
run: | | ||
msbuild -nologo -restore -maxCpuCount ` | ||
-p:BaseOutputPath=${{ github.workspace }}\BinaryCache\installer\ ` | ||
-p:Configuration=Release ` | ||
-p:SignOutput=${{ inputs.signed }} ` | ||
-p:CERTIFICATE=${env:CERTIFICATE} ` | ||
-p:PASSPHRASE=${{ secrets.PASSPHRASE }} ` | ||
-p:TOOLCHAIN_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/{{ inputs.swift_version }}+Asserts ` | ||
-p:ProductArchitecture=${{ matrix.arch }} ` | ||
-p:ProductVersion=${{ inputs.swift_version }} ` | ||
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/ide/ide.wixproj | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: bld-${{ matrix.arch }}-msi | ||
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 | ||
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 | ||
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 | ||
path: | | ||
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/ide.msi | ||
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/ide.cab | ||
package_windows_sdk_runtime: | ||
# TODO: Build this on macOS or make an equivalent Mac-only job | ||
if: inputs.build_os == 'Windows' | ||
name: Package Windows SDK & Runtime | ||
needs: [stdlib, sdk] | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- arch: amd64 | ||
platform: x64 | ||
- arch: arm64 | ||
platform: arm64 | ||
- arch: x86 | ||
platform: x86 | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Windows-stdlib-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BuildRoot/Library | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Windows-sdk-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-installer-scripts | ||
ref: ${{ inputs.swift_installer_scripts_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-installer-scripts | ||
show-progress: false | ||
- uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main | ||
with: | ||
host_arch: ${{ inputs.build_arch }} | ||
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' | ||
arch: ${{ matrix.arch }} | ||
- run: | | ||
$CertificatePath = Join-Path -Path ${env:RUNNER_TEMP} -ChildPath CodeSign.b64 | ||
$PFXPath = Join-Path -Path ${env:RUNNER_TEMP} -ChildPath CodeSign.pfx | ||
Set-Content -Path $CertificatePath -Value '${{ secrets.CERTIFICATE }}' | ||
certutil.exe -decode $CertificatePath $PFXPath | ||
Write-Output CERTIFICATE=$PFXPath | Out-File -FilePath ${env:GITHUB_ENV} -Encoding utf8 -Append | ||
if: ${{ inputs.signed }} | ||
- name: Install WixToolset.Sdk | ||
run: | | ||
if ((Get-Package -Name WixToolset.Sdk -ErrorAction SilentlyContinue) -eq $null) { | ||
Install-Package -Name WixToolset.Sdk -RequiredVersion 4.0.1 -Force | ||
} | ||
- name: Package SDK | ||
run: | | ||
msbuild -nologo -restore -maxCpuCount ` | ||
-p:BaseOutputPath=${{ github.workspace }}\BinaryCache\installer\ ` | ||
-p:Configuration=Release ` | ||
-p:SignOutput=${{ inputs.signed }} ` | ||
-p:CERTIFICATE=${env:CERTIFICATE} ` | ||
-p:PASSPHRASE=${{ secrets.PASSPHRASE }} ` | ||
-p:PLATFORM_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform ` | ||
-p:SDK_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk ` | ||
-p:ProductVersion=${{ inputs.swift_version }} ` | ||
-p:ProductArchitecture=${{ matrix.arch }} ` | ||
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/sdk/win/sdk.wixproj | ||
- name: Package Runtime | ||
run: | | ||
msbuild -nologo -restore -maxCpuCount ` | ||
-p:BaseOutputPath=${{ github.workspace }}\BinaryCache\installer\ ` | ||
-p:Configuration=Release ` | ||
-p:SignOutput=${{ inputs.signed }} ` | ||
-p:CERTIFICATE=${env:CERTIFICATE} ` | ||
-p:PASSPHRASE=${{ secrets.PASSPHRASE }} ` | ||
-p:PLATFORM_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform ` | ||
-p:SDK_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk ` | ||
-p:ProductVersion=${{ inputs.swift_version }} ` | ||
-p:ProductArchitecture=${{ matrix.arch }} ` | ||
-p:VCRedistDir="${env:VCToolsRedistDir}\${env:VSCMD_ARG_TGT_ARCH}\Microsoft.VC143.CRT\" ` | ||
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/rtl/msi/rtlmsi.wixproj | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: sdk-windows-${{ matrix.arch }}-msi | ||
path: | | ||
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/sdk.windows.${{ matrix.arch }}.msi | ||
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/sdk.windows.${{ matrix.arch }}.cab | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: rtl-windows-${{ matrix.arch }}-msi | ||
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 | ||
path: | | ||
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/rtl.${{ matrix.arch }}.msm | ||
package_android_sdk_runtime: | ||
# TODO: Build this on macOS or make an equivalent Mac-only job | ||
name: Package Android SDK & Runtime | ||
needs: [stdlib, ds2, sdk] | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- arch: arm64 | ||
msarch: arm64 | ||
triple_no_api_level: aarch64-unknown-linux-android | ||
- arch: armv7 | ||
msarch: arm | ||
triple_no_api_level: armv7-unknown-linux-androideabi | ||
- arch: i686 | ||
msarch: x86 | ||
triple_no_api_level: i686-unknown-linux-android | ||
- arch: x86_64 | ||
msarch: amd64 | ||
triple_no_api_level: x86_64-unknown-linux-android | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
# There is currently no Android NDK for Windows ARM64 so build Android only on Windows X64 host only | ||
if: inputs.build_android | ||
with: | ||
name: Android-stdlib-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BuildRoot/Library | ||
- uses: actions/download-artifact@v4 | ||
if: inputs.build_android | ||
with: | ||
name: Android-sdk-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform | ||
- uses: actions/download-artifact@v4 | ||
if: inputs.build_android | ||
with: | ||
name: ds2-Android-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform/Developer/Library/${{ matrix.triple_no_api_level }} | ||
- uses: actions/checkout@v4 | ||
if: inputs.build_android | ||
with: | ||
repository: swiftlang/swift-installer-scripts | ||
ref: ${{ inputs.swift_installer_scripts_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-installer-scripts | ||
show-progress: false | ||
- uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main | ||
if: inputs.build_android | ||
with: | ||
host_arch: ${{ inputs.build_arch }} | ||
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' | ||
arch: ${{ matrix.arch }} | ||
- run: | | ||
$CertificatePath = Join-Path -Path ${env:RUNNER_TEMP} -ChildPath CodeSign.b64 | ||
$PFXPath = Join-Path -Path ${env:RUNNER_TEMP} -ChildPath CodeSign.pfx | ||
Set-Content -Path $CertificatePath -Value '${{ secrets.CERTIFICATE }}' | ||
certutil.exe -decode $CertificatePath $PFXPath | ||
Write-Output CERTIFICATE=$PFXPath | Out-File -FilePath ${env:GITHUB_ENV} -Encoding utf8 -Append | ||
if: ${{ inputs.signed && inputs.build_android }} | ||
- name: Install WixToolset.Sdk | ||
if: inputs.build_android | ||
run: | | ||
if ((Get-Package -Name WixToolset.Sdk -ErrorAction SilentlyContinue) -eq $null) { | ||
Install-Package -Name WixToolset.Sdk -RequiredVersion 4.0.1 -Force | ||
} | ||
- name: Package SDK | ||
if: inputs.build_android | ||
run: | | ||
if ("${{ inputs.build_arch }}" -eq "amd64") { | ||
$InstallerPlatform = "x64" | ||
} else { | ||
$InstallerPlatform = "arm64" | ||
} | ||
msbuild -nologo -restore -maxCpuCount ` | ||
-p:BaseOutputPath=${{ github.workspace }}\BinaryCache\installer\ ` | ||
-p:Configuration=Release ` | ||
-p:SignOutput=${{ inputs.signed }} ` | ||
-p:ANDROID_INCLUDE_DS2=${{ inputs.build_android }} ` | ||
-p:CERTIFICATE=${env:CERTIFICATE} ` | ||
-p:PASSPHRASE=${{ secrets.PASSPHRASE }} ` | ||
-p:PLATFORM_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform ` | ||
-p:SDK_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform/Developer/SDKs/Android.sdk ` | ||
-p:ProductVersion=${{ inputs.swift_version }} ` | ||
-p:ProductArchitecture=${{ matrix.msarch }} ` | ||
-p:InstallerPlatform=${InstallerPlatform} ` | ||
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/sdk/drd/sdk.wixproj | ||
- uses: actions/upload-artifact@v4 | ||
if: inputs.build_android | ||
with: | ||
name: sdk-android-${{ matrix.arch }}-msi | ||
path: | | ||
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.msarch }}/sdk.android.${{ matrix.msarch }}.msi | ||
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.msarch }}/sdk.android.${{ matrix.msarch }}.cab | ||
installer: | ||
# TODO: Build this on macOS or make an equivalent Mac-only job | ||
if: inputs.build_os == 'Windows' | ||
needs: [package_tools, package_windows_sdk_runtime, package_android_sdk_runtime] | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(inputs.host_matrix) }} | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: bld-${{ matrix.arch }}-msi | ||
path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }} | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: cli-${{ matrix.arch }}-msi | ||
path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }} | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: dbg-${{ matrix.arch }}-msi | ||
path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }} | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: ide-${{ matrix.arch }}-msi | ||
path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }} | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: rtl-windows-${{ matrix.arch }}-msi | ||
path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }} | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: rtl-windows-amd64-msm | ||
path: ${{ github.workspace }}/BinaryCache/installer/Release/amd64 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: rtl-windows-x86-msm | ||
path: ${{ github.workspace }}/BinaryCache/installer/Release/x86 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: rtl-windows-arm64-msm | ||
path: ${{ github.workspace }}/BinaryCache/installer/Release/arm64 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: sdk-windows-amd64-msi | ||
path: ${{ github.workspace }}/BinaryCache/installer/Release/amd64 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: sdk-windows-x86-msi | ||
path: ${{ github.workspace }}/BinaryCache/installer/Release/x86 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: sdk-windows-arm64-msi | ||
path: ${{ github.workspace }}/BinaryCache/installer/Release/arm64 | ||
- uses: actions/download-artifact@v4 | ||
if: inputs.build_android | ||
with: | ||
name: sdk-android-arm64-msi | ||
path: ${{ github.workspace }}/BinaryCache/installer/Release/aarch64 | ||
- uses: actions/download-artifact@v4 | ||
if: inputs.build_android | ||
with: | ||
name: sdk-android-x86_64-msi | ||
path: ${{ github.workspace }}/BinaryCache/installer/Release/x86_64 | ||
- uses: actions/download-artifact@v4 | ||
if: inputs.build_android | ||
with: | ||
name: sdk-android-armv7-msi | ||
path: ${{ github.workspace }}/BinaryCache/installer/Release/armv7 | ||
- uses: actions/download-artifact@v4 | ||
if: inputs.build_android | ||
with: | ||
name: sdk-android-i686-msi | ||
path: ${{ github.workspace }}/BinaryCache/installer/Release/i686 | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: swiftlang/swift-installer-scripts | ||
ref: ${{ inputs.swift_installer_scripts_revision }} | ||
path: ${{ github.workspace }}/SourceCache/swift-installer-scripts | ||
show-progress: false | ||
- uses: compnerd/gha-setup-vsdevenv@f1ba60d553a3216ce1b89abe0201213536bc7557 # main | ||
with: | ||
host_arch: ${{ inputs.build_arch }} | ||
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64' | ||
arch: ${{ matrix.arch }} | ||
- run: | | ||
$CertificatePath = Join-Path -Path ${env:RUNNER_TEMP} -ChildPath CodeSign.b64 | ||
$PFXPath = Join-Path -Path ${env:RUNNER_TEMP} -ChildPath CodeSign.pfx | ||
Set-Content -Path $CertificatePath -Value '${{ secrets.CERTIFICATE }}' | ||
certutil -decode $CertificatePath $PFXPath | ||
Echo CERTIFICATE=$PFXPath | Out-File -FilePath ${env:GITHUB_ENV} -Encoding utf8 -Append | ||
if: ${{ inputs.signed }} | ||
# The installer bundle needs the shared project for localization strings, | ||
# but it won't build the dependency on its own due to -p:BuildProjectReferences=false. | ||
- name: Build shared project | ||
run: | | ||
msbuild -nologo -restore -maxCpuCount ` | ||
-p:BaseOutputPath=${{ github.workspace }}\BinaryCache\installer\ ` | ||
-p:Configuration=Release ` | ||
-p:SignOutput=${{ inputs.signed }} ` | ||
-p:CERTIFICATE=${env:CERTIFICATE} ` | ||
-p:PASSPHRASE=${{ secrets.PASSPHRASE }} ` | ||
-p:ProductArchitecture=${{ matrix.arch }} ` | ||
-p:ProductVersion=${{ inputs.swift_version }}-${{ inputs.swift_tag }} ` | ||
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/shared/shared.wixproj | ||
- name: Build installer bundle | ||
run: | | ||
msbuild -nologo -restore -maxCpuCount ` | ||
-p:BaseOutputPath=${{ github.workspace }}\BinaryCache\installer\ ` | ||
-p:Configuration=Release ` | ||
-p:BuildProjectReferences=false ` | ||
-p:SignOutput=${{ inputs.signed }} ` | ||
-p:CERTIFICATE=${env:CERTIFICATE} ` | ||
-p:PASSPHRASE=${{ secrets.PASSPHRASE }} ` | ||
-p:BundleFlavor=offline ` | ||
-p:INCLUDE_WINDOWS_AMD64_SDK=true ` | ||
-p:INCLUDE_WINDOWS_X86_SDK=true ` | ||
-p:INCLUDE_WINDOWS_ARM64_SDK=true ` | ||
-p:INCLUDE_ANDROID_ARM64_SDK=${{ inputs.build_android }} ` | ||
-p:INCLUDE_ANDROID_x86_64_SDK=${{ inputs.build_android }} ` | ||
-p:INCLUDE_ANDROID_ARM_SDK=${{ inputs.build_android }} ` | ||
-p:INCLUDE_ANDROID_X86_SDK=${{ inputs.build_android }} ` | ||
-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 }} | ||
path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/installer.exe | ||
smoke_test: | ||
# TODO: Build this on macOS or make an equivalent Mac-only job | ||
if: inputs.build_os == 'Windows' | ||
needs: [installer] | ||
runs-on: ${{ inputs.default_build_runner }} | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: installer-${{ 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 | ||
- run: | | ||
function Update-EnvironmentVariables { | ||
foreach ($level in "Machine", "User") { | ||
[Environment]::GetEnvironmentVariables($level).GetEnumerator() | % { | ||
# For Path variables, append the new values, if they're not already in there | ||
if ($_.Name -Match 'Path$') { | ||
$_.Value = ($((Get-Content "Env:$($_.Name)") + ";$($_.Value)") -Split ';' | Select -Unique) -Join ';' | ||
} | ||
$_ | ||
} | Set-Content -Path { "Env:$($_.Name)" } | ||
} | ||
} | ||
try { | ||
Write-Host "Starting Install installer.exe..." | ||
$Process = Start-Process -FilePath ${{ github.workspace }}/tmp/installer.exe -ArgumentList ("-q") -Wait -PassThru | ||
$ExitCode = $Process.ExitCode | ||
if ($ExitCode -eq 0 -or $ExitCode -eq 3010) { | ||
Write-Host "Installation successful" | ||
} else { | ||
Write-Host "non-zero exit code returned by the installation process: $ExitCode" | ||
exit $ExitCode | ||
} | ||
} catch { | ||
Write-Host "Failed to install: $($_.Exception.Message)" | ||
exit 1 | ||
} | ||
Update-EnvironmentVariables | ||
# Reset Path and environment | ||
echo "$env:Path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 | ||
Get-ChildItem Env: | % { echo "$($_.Name)=$($_.Value)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append } | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: compnerd/swift-win32 | ||
ref: refs/heads/main | ||
path: ${{ github.workspace }}/SourceCache/swift-win32 | ||
show-progress: false | ||
- run: swift build | ||
working-directory: ${{ github.workspace }}/SourceCache/swift-win32 | ||
- run: swift test -Xswiftc -DENABLE_TESTING | ||
working-directory: ${{ github.workspace }}/SourceCache/swift-win32 | ||
smoke_test_android: | ||
# TODO: Run this job on macOS or make an equivalent Mac-only job | ||
if: inputs.build_os == 'Windows' && inputs.build_android | ||
needs: [installer] | ||
runs-on: ${{ inputs.default_build_runner }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: [ x86_64, aarch64 ] | ||
steps: | ||
- name: Download Swift SDK | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: installer-${{ 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 | ||
- name: Install Swift SDK | ||
run: | | ||
function Update-EnvironmentVariables { | ||
foreach ($level in "Machine", "User") { | ||
[Environment]::GetEnvironmentVariables($level).GetEnumerator() | % { | ||
# For Path variables, append the new values, if they're not already in there | ||
if ($_.Name -Match 'Path$') { | ||
$_.Value = ($((Get-Content "Env:$($_.Name)") + ";$($_.Value)") -Split ';' | Select -Unique) -Join ';' | ||
} | ||
$_ | ||
} | Set-Content -Path { "Env:$($_.Name)" } | ||
} | ||
} | ||
try { | ||
Write-Host "Starting Install installer.exe..." | ||
$Process = Start-Process -FilePath ${{ github.workspace }}/tmp/installer.exe -ArgumentList ("-q") -Wait -PassThru | ||
$ExitCode = $Process.ExitCode | ||
if ($ExitCode -eq 0 -or $ExitCode -eq 3010) { | ||
Write-Host "Installation successful" | ||
} else { | ||
Write-Host "non-zero exit code returned by the installation process: $ExitCode" | ||
exit $ExitCode | ||
} | ||
} catch { | ||
Write-Host "Failed to install: $($_.Exception.Message)" | ||
exit 1 | ||
} | ||
Update-EnvironmentVariables | ||
# Reset Path and environment | ||
echo "$env:Path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 | ||
Get-ChildItem Env: | % { echo "$($_.Name)=$($_.Value)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append } | ||
- name: Install Android NDK | ||
uses: nttld/setup-ndk@v1 | ||
id: setup-ndk | ||
with: | ||
ndk-version: r26d | ||
local-cache: true | ||
- name: Setup Swift environment | ||
id: android-swift-env | ||
run: | | ||
echo "sysroot=$(resolve-path ${{ steps.setup-ndk.outputs.ndk-path }}\toolchains\llvm\prebuilt\windows-x86_64\sysroot)" >> $env:GITHUB_OUTPUT | ||
echo "sdkroot=$(resolve-path $env:SDKROOT\..\..\..\..\Android.platform\Developer\SDKs\Android.sdk)" >> $env:GITHUB_OUTPUT | ||
echo "clang-resource-dir=$(& $(resolve-path "${{ steps.setup-ndk.outputs.ndk-path }}\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe") -print-resource-dir)" >> $env:GITHUB_OUTPUT | ||
- name: Checkout cassowary project | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: compnerd/cassowary | ||
ref: 0.0.2 | ||
path: ${{ github.workspace }}/SourceCache/cassowary | ||
- name: Build cassowary project | ||
run: | | ||
swift build ` | ||
--package-path ${{ github.workspace }}/SourceCache/cassowary ` | ||
--triple ${{ matrix.arch }}-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }} ` | ||
--sdk "${{ steps.android-swift-env.outputs.sysroot }}" ` | ||
-Xswiftc -sdk -Xswiftc "${{ steps.android-swift-env.outputs.sdkroot }}" ` | ||
-Xswiftc -sysroot -Xswiftc "${{ steps.android-swift-env.outputs.sysroot }}" ` | ||
-Xswiftc -I -Xswiftc "${{ steps.android-swift-env.outputs.sdkroot }}\usr\include" ` | ||
-Xswiftc -Xclang-linker -Xswiftc -resource-dir -Xswiftc -Xclang-linker -Xswiftc ${{ steps.android-swift-env.outputs.clang-resource-dir }} |