Skip to content

Temporary

Temporary #3099

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_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_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
yams_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
secrets:
SYMBOL_SERVER_PAT:
required: true
CERTIFICATE:
required: true
PASSPHRASE:
required: true
env:
SCCACHE_DIRECT: on
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 (building on ${{ inputs.build_os }} ${{ inputs.build_arch }})
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@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@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_MT=mt `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr `
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} `
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} `
-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 }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr
ds2_tools:
# TODO: Build this on macOS or make an equivalent Mac-only job
if: inputs.build_os == 'Windows' && inputs.build_arch == 'amd64'
runs-on: ${{ inputs.default_build_runner }}
name: ds2 Build Tools (building on ${{ inputs.build_os }} ${{ inputs.build_arch }})
steps:
- uses: actions/checkout@v4
with:
repository: compnerd/ds2
ref: ${{ inputs.ds2_revision }}
path: ${{ github.workspace }}/SourceCache/ds2
show-progress: false
- uses: compnerd/gha-setup-vsdevenv@main
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
- name: Install Flex and Bison Tools
run: choco install winflexbison3
- name: Configure RegsGen2
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 }}" `
-D CMAKE_MT=mt `
-G Ninja
- name: Build RegsGen2
run: cmake --build ${{ github.workspace }}/BinaryCache/RegsGen2 --config Release
- uses: actions/upload-artifact@v4
with:
name: windows-regsgen2
path: |
${{ github.workspace }}/BinaryCache/RegsGen2/regsgen2.exe
ds2:
# TODO: Build this on macOS or make an equivalent Mac-only job
if: inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
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 (building on ${{ inputs.build_os }} ${{ inputs.build_arch }})
steps:
- uses: actions/checkout@v4
with:
repository: compnerd/ds2
ref: ${{ inputs.ds2_revision }}
path: ${{ github.workspace }}/SourceCache/ds2
show-progress: false
- uses: compnerd/gha-setup-vsdevenv@main
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
- name: Install Flex and Bison Tools
run: choco install winflexbison3
- uses: actions/download-artifact@v4
with:
name: windows-regsgen2
path: ${{ github.workspace }}/BinaryCache/RegsGen2
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }}
- name: Configure DS2
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 CMAKE_MT=mt `
-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
run: cmake --build ${{ github.workspace }}/BinaryCache/ds2
- name: Install DS2
run: cmake --build ${{ github.workspace }}/BinaryCache/ds2 --target install
- uses: actions/upload-artifact@v4
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 (building on ${{ inputs.build_os }} ${{ inputs.build_arch }})
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@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@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_MT=mt `
-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 }} `
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} `
-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: actions/upload-artifact@v4
with:
name: cmark-gfm-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.swift_cmark_version }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr
build_tools:
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 (building on ${{ inputs.build_os }} ${{ inputs.build_arch }})
steps:
- uses: actions/download-artifact@v4
with:
name: cmark-gfm-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.swift_cmark_version }}-built-on-${{ inputs.build_arch }}
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@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@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 }}" `
-D CMAKE_MT=mt `
-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: Export binary paths
id: export-binary-paths
run: |
$Suffix = if ( "${{ matrix.os }}" -eq "Windows" ) { ".exe" } else { "" }
echo "llvm_tblgen=${{ github.workspace }}/BinaryCache/0/bin/llvm-tblgen${Suffix}" >> $env:GITHUB_OUTPUT
echo "clang_tblgen=${{ github.workspace }}/BinaryCache/0/bin/clang-tblgen${Suffix}" >> $env:GITHUB_OUTPUT
echo "lldb_tblgen=${{ github.workspace }}/BinaryCache/0/bin/lldb-tblgen${Suffix}" >> $env:GITHUB_OUTPUT
echo "llvm_config=${{ github.workspace }}/BinaryCache/0/bin/llvm-config${Suffix}" >> $env:GITHUB_OUTPUT
echo "clang_pseudo_gen=${{ github.workspace }}/BinaryCache/0/bin/clang-pseudo-gen${Suffix}" >> $env:GITHUB_OUTPUT
echo "clang_tidy_confusable_chars_gen=${{ github.workspace }}/BinaryCache/0/bin/clang-tidy-confusable-chars-gen${Suffix}" >> $env:GITHUB_OUTPUT
echo "swift_def_to_strings_converter=${{ github.workspace }}/BinaryCache/0/bin/swift-def-to-strings-converter${Suffix}" >> $env:GITHUB_OUTPUT
echo "swift_serialize_diagnostics=${{ github.workspace }}/BinaryCache/0/bin/swift-serialize-diagnostics${Suffix}" >> $env:GITHUB_OUTPUT
echo "swift_compatibility_symbols=${{ github.workspace }}/BinaryCache/0/bin/swift-compatibility-symbols${Suffix}" >> $env:GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
with:
name: build-tools-${{ matrix.os }}-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: |
${{ steps.export-binary-paths.outputs.llvm_tblgen }}
${{ steps.export-binary-paths.outputs.clang_tblgen }}
${{ steps.export-binary-paths.outputs.lldb_tblgen }}
${{ steps.export-binary-paths.outputs.llvm_config }}
${{ steps.export-binary-paths.outputs.clang_pseudo_gen }}
${{ steps.export-binary-paths.outputs.clang_tidy_confusable_chars_gen }}
${{ steps.export-binary-paths.outputs.swift_def_to_strings_converter }}
${{ steps.export-binary-paths.outputs.swift_serialize_diagnostics }}
${{ steps.export-binary-paths.outputs.swift_compatibility_symbols }}
compilers:
# TODO: Build this on macOS or make an equivalent Mac-only job
if: inputs.build_os == 'Windows'
needs: [build_tools, cmark_gfm]
runs-on: ${{ inputs.compilers_build_runner }}
env:
# Must be a full version string from https://www.nuget.org/packages/pythonarm64
PYTHON_VERSION: 3.9.10
strategy:
fail-fast: false
matrix: ${{ fromJSON(inputs.host_matrix) }}
name: Windows ${{ matrix.arch }} Toolchain (building on ${{ inputs.build_os }} ${{ inputs.build_arch }})
steps:
- uses: actions/download-artifact@v4
with:
name: build-tools-Windows-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/0/bin
- uses: actions/download-artifact@v4
with:
name: cmark-gfm-Windows-${{ matrix.arch }}-${{ inputs.swift_cmark_version }}-built-on-${{ inputs.build_arch }}
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: 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 }} (Host)
if: matrix.arch == 'amd64' || inputs.build_arch == 'amd64'
uses: actions/setup-python@v5
id: python
with:
python-version: '${{ env.PYTHON_VERSION }}'
architecture: x64
- uses: nuget/setup-nuget@v2
if: matrix.arch == 'arm64' || inputs.build_arch == 'arm64'
# TODO(lxbndr) use actions/cache to improve this step timings
- name: Install Python ${{ env.PYTHON_VERSION }} (arm64)
if: matrix.arch == 'arm64' || 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 }}
- name: Export Python Location
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 }}\tools" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- uses: compnerd/gha-setup-vsdevenv@main
with:
host_arch: ${{ inputs.build_arch }}
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
arch: ${{ matrix.arch }}
- name: Install Swift Toolchain
uses: compnerd/gha-setup-swift@main
with:
github-repo: thebrowsercompany/swift-build
github-token: ${{ secrets.GITHUB_TOKEN }}
release-asset-name: installer-${{ inputs.build_arch }}.exe
release-tag-name: '20231016.0'
- uses: nttld/setup-ndk@v1
if: inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
id: setup-ndk
with:
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }}
- 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 }}-windows-${{ matrix.arch }}-compilers
variant: sccache
- name: Configure Compilers
# env:
# NDKPATH: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
if ( "${{ matrix.arch }}" -eq "arm64" ) {
$CMAKE_SYSTEM_NAME="-D CMAKE_SYSTEM_NAME=Windows"
$CMAKE_SYSTEM_PROCESSOR="-D CMAKE_SYSTEM_PROCESSOR=ARM64"
$CACHE="Windows-aarch64.cmake"
# FIXME(compnerd) re-enable runtimes after we sort out compiler-rt
(Get-Content ${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-aarch64.cmake).Replace(' runtimes', '') | Set-Content ${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-aarch64.cmake
} else {
$CACHE="Windows-x86_64.cmake"
}
$SWIFTC = cygpath -m (Get-Command swiftc).Source
$SDKROOT = cygpath -m ${env:SDKROOT}
# Use toolchain clang to avoid broken __prefetch intrinsic on arm64 in Clang 18.
$CLANG_LOCATION = cygpath -m (Split-Path (Get-Command swiftc).Source)
Remove-Item env:\SDKROOT
cmake -B ${{ github.workspace }}/BinaryCache/1 `
-C ${{ github.workspace }}/SourceCache/swift/cmake/caches/${CACHE} `
-D CMAKE_BUILD_TYPE=Release `
-D CMAKE_C_COMPILER=cl `
-D CMAKE_C_COMPILER_LAUNCHER=sccache `
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" `
-D CMAKE_CXX_COMPILER=cl `
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }} -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH" `
-D CMAKE_MT=mt `
-D CMAKE_Swift_COMPILER="${SWIFTC}" `
-D CMAKE_Swift_COMPILER_WORKS=YES `
-D CMAKE_Swift_FLAGS="-sdk `"${SDKROOT}`" -Xcc -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH" `
-D CMAKE_EXE_LINKER_FLAGS="${{ inputs.WINDOWS_CMAKE_EXE_LINKER_FLAGS }}" `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr `
-D CMAKE_SHARED_LINKER_FLAGS="${{ inputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}" `
${CMAKE_SYSTEM_NAME} `
${CMAKE_SYSTEM_PROCESSOR} `
-G Ninja `
-S ${{ github.workspace }}/SourceCache/llvm-project/llvm `
-D CLANG_TABLEGEN=${{ github.workspace }}/BinaryCache/0/bin/clang-tblgen.exe `
-D CLANG_TIDY_CONFUSABLE_CHARS_GEN=${{ github.workspace }}/BinaryCache/0/bin/clang-tidy-confusable-chars-gen.exe `
-D LLDB_TABLEGEN=${{ github.workspace }}/BinaryCache/0/bin/lldb-tblgen.exe `
-D LLVM_CONFIG_PATH=${{ github.workspace }}/BinaryCache/0/bin/llvm-config.exe `
-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.exe `
-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=${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="${SDKROOT}" `
-D CLANG_VENDOR=compnerd.org `
-D CLANG_VENDOR_UTI=org.compnerd.dt `
-D cmark-gfm_DIR=${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake `
-D PACKAGE_VENDOR=compnerd.org `
-D SWIFT_VENDOR=compnerd.org `
-D LLVM_PARALLEL_LINK_JOBS=8 `
-D SWIFT_PARALLEL_LINK_JOBS=8 `
-D LLVM_APPEND_VC_REV=NO `
-D LLVM_VERSION_SUFFIX="" `
-D LLDB_PYTHON_EXE_RELATIVE_PATH=python.exe `
-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=$env:PYTHON_LOCATION_${{ matrix.arch }}\include `
-D Python3_LIBRARY=$env:PYTHON_LOCATION_${{ matrix.arch }}\libs\python39.lib `
-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: Upload Compilers
uses: actions/upload-artifact@v4
with:
name: compilers-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library
- name: extract swift-syntax
run: |
$module = "${{ github.workspace }}/BinaryCache/1/cmake/modules/SwiftSyntaxConfig.cmake"
$bindir = cygpath -m ${{ github.workspace }}/BinaryCache/1
(Get-Content $module).Replace("${bindir}", '<BINARY_DIR>') | Set-Content $module
New-Item -Path ${{ github.workspace }}/BinaryCache/swift-syntax/lib/swift/host -ItemType Directory | Out-Null
Copy-Item -Path "${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/lib/*.lib" -Destination "${{ github.workspace }}/BinaryCache/swift-syntax/lib"
Copy-Item -Path "${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/lib/*.lib" -Destination "${{ github.workspace }}/BinaryCache/swift-syntax/lib/swift/host"
Copy-Item -Path "${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/lib/swift/host/*.swiftmodule" -Destination "${{ github.workspace }}/BinaryCache/swift-syntax/lib/swift/host" -Recurse
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: actions/upload-artifact@v4
with:
name: swift-syntax-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/swift-syntax
# TODO(compnerd) this takes ~1h due to the size, see if we can compress first
- uses: actions/upload-artifact@v4
if: false # ${{ inputs.debug_info }}
with:
name: compilers-${{ matrix.arch }}-debug-info-built-on-${{ inputs.build_arch }}
path: |
${{ github.workspace }}/BinaryCache/1/**/*.pdb
- 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/1
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/1
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/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 (building on ${{ inputs.build_os }} ${{ inputs.build_arch }})
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@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@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: inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
id: setup-ndk
with:
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }}
- name: Configure zlib
run: |
if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) {
$NDKPATH = "${{ steps.setup-ndk.outputs.ndk-path }}"
if ( "${{ inputs.build_os }}" -eq "Windows" ) {
$NDKPATH = cygpath -m $NDKPATH
}
$CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH"
}
cmake -B ${{ github.workspace }}/BinaryCache/zlib-${{ inputs.zlib_version }} `
-D BUILD_SHARED_LIBS=NO `
-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_MT=mt `
-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 }}-built-on-${{ inputs.build_arch }}
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 (building on ${{ inputs.build_os }} ${{ inputs.build_arch }})
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 }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr
- uses: compnerd/gha-setup-vsdevenv@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@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: inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
id: setup-ndk
with:
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }}
- name: Configure curl
run: |
if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) {
$NDKPATH = "${{ steps.setup-ndk.outputs.ndk-path }}"
if ( "${{ inputs.build_os }}" -eq "Windows" ) {
$NDKPATH = cygpath -m $NDKPATH
}
$CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH"
}
cmake -B ${{ github.workspace }}/BinaryCache/curl-${{ inputs.curl_version }} `
-D BUILD_SHARED_LIBS=NO `
-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_MT=mt `
-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 }}-built-on-${{ inputs.build_arch }}
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 (building on ${{ inputs.build_os }} ${{ inputs.build_arch }})
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@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@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: inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
id: setup-ndk
with:
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }}
- name: Configure libxml2
run: |
if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) {
$NDKPATH = "${{ steps.setup-ndk.outputs.ndk-path }}"
if ( "${{ inputs.build_os }}" -eq "Windows" ) {
$NDKPATH = cygpath -m $NDKPATH
}
$CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH"
}
cmake -B ${{ github.workspace }}/BinaryCache/libxml2-${{ inputs.libxml2_version }} `
-D BUILD_SHARED_LIBS=NO `
-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_MT=mt `
-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 }}-built-on-${{ inputs.build_arch }}
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 }}"'
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 }}"'
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 (building on ${{ inputs.build_os }} ${{ inputs.build_arch }})
# Skip Android when building on Windows ARM64
if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'

Check failure on line 1437 in .github/workflows/swift-toolchain.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/swift-toolchain.yml

Invalid workflow file

You have an error in your yaml syntax on line 1437
steps:
- name: Download Compilers
uses: actions/download-artifact@v4
with:
name: compilers-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library
- uses: actions/download-artifact@v4
with:
name: cmark-gfm-Windows-${{ inputs.build_arch }}-${{ inputs.swift_cmark_version }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr
- name: cmark-gfm Setup
run: Copy-Item ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/bin/*.dll ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/
- 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
# NOTE(compnerd) While we do not have ABI stability on Windows yet, we use
# Swift in the compiler, which requires that we have the Swift runtime. As
# we have not yet built the runtime, this requires that we use the runtime
# from the previous build.
- name: Install Swift Toolchain
uses: compnerd/gha-setup-swift@main
with:
github-repo: thebrowsercompany/swift-build
github-token: ${{ secrets.GITHUB_TOKEN }}
release-asset-name: installer-${{ inputs.build_arch }}.exe
release-tag-name: '20231016.0'
# NOTE(compnerd): we execute unconditionally as we use CMake from VSDevEnv
- uses: compnerd/gha-setup-vsdevenv@main
with:
host_arch: ${{ inputs.build_arch }}
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
arch: ${{ matrix.arch }}
# NOTE(compnerd): we execute unconditionally as we reference outputs
- uses: nttld/setup-ndk@v1
if: inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
id: setup-ndk
with:
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }}
- name: Configure LLVM
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
run: |
# NOTE: used by `matrix.cc`
$CLANG_CL = "cl"
if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) {
$NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }}
$CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH"
$SWIFT_NDK_FLAG = "-DSWIFT_ANDROID_NDK_PATH=$NDKPATH"
}
cmake -B ${{ github.workspace }}/BinaryCache/llvm `
-D CMAKE_BUILD_TYPE=Release `
-D CMAKE_C_COMPILER=${{ matrix.cc }} `
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" `
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} `
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" `
-D CMAKE_MT=mt `
-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_os != 'Windows' || inputs.build_arch != 'arm64'
run: |
# NOTE: used by `matrix.cc`
$CLANG_CL = cygpath -m ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) {
$NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }}
$CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH"
$SWIFT_NDK_FLAG = "-DSWIFT_ANDROID_NDK_PATH=$NDKPATH"
}
$CMAKE_CPU = if ("${{ matrix.cpu }}" -eq "armv7") {
"armv7-a"
} 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_MT=mt `
-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 }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/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_os != 'Windows' || inputs.build_arch != 'arm64'
run: |
Remove-Item env:\SDKROOT
cmake --build ${{ github.workspace }}/BinaryCache/swift
- name: Install Swift Standard Library
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
run: |
Remove-Item env:\SDKROOT
cmake --build ${{ github.workspace }}/BinaryCache/swift --target install
- uses: actions/upload-artifact@v4
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
with:
name: ${{ matrix.os }}-stdlib-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/${{ matrix.os }}.platform
- uses: actions/upload-artifact@v4
if: matrix.os == 'Windows'
with:
name: windows-vfs-overlay-${{ matrix.arch }}-built-on-${{ inputs.build_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:
include:
- arch: 'amd64'
cpu: 'x86_64'
triple: 'x86_64-unknown-windows-msvc'
- arch: 'arm64'
cpu: 'aarch64'
triple: 'aarch64-unknown-windows-msvc'
name: Windows ${{ matrix.arch }} Macros (building on ${{ inputs.build_os }} ${{ inputs.build_arch }})
steps:
- name: Download Compilers
uses: actions/download-artifact@v4
with:
name: compilers-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library
- name: Download swift-syntax
uses: actions/download-artifact@v4
with:
name: swift-syntax-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/swift-syntax
- uses: actions/download-artifact@v4
with:
name: Windows-stdlib-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform
- uses: actions/download-artifact@v4
if: matrix.arch == 'arm64'
with:
name: Windows-stdlib-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform
- uses: actions/download-artifact@v4
with:
name: windows-vfs-overlay-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/swift/stdlib
- uses: actions/download-artifact@v4
with:
name: cmark-gfm-Windows-${{ inputs.build_arch }}-${{ inputs.swift_cmark_version }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr
- name: cmark-gfm Setup
run: Copy-Item ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/bin/*.dll ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/
- 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@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/unknown-Asserts-development.xctoolchain/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/unknown-Asserts-development.xctoolchain/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/unknown-Asserts-development.xctoolchain/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/unknown-Asserts-development.xctoolchain/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 }}-built-on-${{ inputs.build_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 }}"'
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 }}"'
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 }}"'
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 (building on ${{ inputs.build_os }} ${{ inputs.build_arch }})
# Skip Android when building on Windows ARM64
if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
steps:
- uses: actions/download-artifact@v4
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
with:
name: libxml2-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.libxml2_version }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/libxml2-${{ inputs.libxml2_version }}/usr
- uses: actions/download-artifact@v4
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
with:
name: curl-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.curl_version }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/curl-${{ inputs.curl_version }}/usr
- uses: actions/download-artifact@v4
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
with:
name: zlib-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.zlib_version }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr
- name: Download Compilers
uses: actions/download-artifact@v4
with:
name: compilers-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library
- uses: actions/download-artifact@v4
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
with:
name: ${{ matrix.os }}-stdlib-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform
- uses: actions/download-artifact@v4
with:
name: Windows-stdlib-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform
- uses: actions/download-artifact@v4
if: matrix.os == 'Windows'
with:
name: windows-vfs-overlay-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/swift/stdlib
- uses: actions/download-artifact@v4
with:
name: macros-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library
- uses: actions/download-artifact@v4
with:
name: cmark-gfm-Windows-${{ inputs.build_arch }}-${{ inputs.swift_cmark_version }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr
- name: cmark-gfm Setup
run: Copy-Item ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/bin/*.dll ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/
- 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
if: matrix.os != 'Android'
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
if: matrix.os == 'Android'
with:
repository: hyp/swift-corelibs-foundation
ref: eng/recore-android-build
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@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: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.28'
# NOTE(compnerd): we execute unconditionally as we reference outputs
- uses: nttld/setup-ndk@v1
if: inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
id: setup-ndk
with:
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }}
- name: Configure libdispatch
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
run: |
# Workaround CMake 3.20 issue
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) {
$NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }}
$CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH"
$SWIFT_NDK_FLAG = "-DSWIFT_ANDROID_NDK_PATH=$NDKPATH"
}
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
$OVERLAY_FLAGS = if ("${{ matrix.os }}" -eq "Windows") {
"-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_MT=mt `
-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_os != 'Windows' || inputs.build_arch != 'arm64'
run: |
cmake --build ${{ github.workspace }}/BinaryCache/libdispatch
- name: Configure Foundation
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
run: |
# Workaround CMake 3.20 issue
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) {
$NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }}
$CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH"
$SWIFT_NDK_FLAG = "-DSWIFT_ANDROID_NDK_PATH=$NDKPATH"
}
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
$OVERLAY_FLAGS = if ("${{ matrix.os }}" -eq "Windows") {
"-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" }
$LIBXML = if ("${{ matrix.os }}" -eq "Windows") { "libxml2s.lib" } else { "libxml2.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_MT=mt `
-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/unknown-Asserts-development.xctoolchain/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_DEFINITIONS="${DEFINITION_FLAG}LIBXML_STATIC" `
-D LIBXML2_INCLUDE_DIR=${{ github.workspace }}/BuildRoot/Library/libxml2-${{ inputs.libxml2_version }}/usr/include/libxml2 `
-D LIBXML2_LIBRARY=${{ github.workspace }}/BuildRoot/Library/libxml2-${{ inputs.libxml2_version }}/usr/lib/$LIBXML `
-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/unknown-Asserts-development.xctoolchain/usr/bin
- name: Build foundation
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
run: |
cmake --build ${{ github.workspace }}/BinaryCache/foundation
# TODO(compnerd) correctly version XCTest
- name: Configure xctest
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
run: |
# Workaround CMake 3.20 issue
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) {
$NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }}
$CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH"
$SWIFT_NDK_FLAG = "-DSWIFT_ANDROID_NDK_PATH=$NDKPATH"
}
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
$OVERLAY_FLAGS = if ("${{ matrix.os }}" -eq "Windows") {
"-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_MT=mt `
-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_os != 'Windows' || inputs.build_arch != 'arm64'
run: |
cmake --build ${{ github.workspace }}/BinaryCache/xctest
- name: Configure Testing
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
run: |
# Workaround CMake 3.20 issue
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
if ( "${{ inputs.build_os }}" -ne "Windows" -or "${{ inputs.build_arch }}" -ne "arm64" ) {
$NDKPATH = cygpath -m ${{ steps.setup-ndk.outputs.ndk-path }}
$CMAKE_NDK_FLAG = "-DCMAKE_ANDROID_NDK=$NDKPATH"
$SWIFT_NDK_FLAG = "-DSWIFT_ANDROID_NDK_PATH=$NDKPATH"
}
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
$OVERLAY_FLAGS = if ("${{ matrix.os }}" -eq "Windows") {
"-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="-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/unknown-Asserts-development.xctoolchain/usr/bin/TestingMacros.dll
- name: Build Testing
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
run: |
cmake --build ${{ github.workspace }}/BinaryCache/testing
- name: Install Testing
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
run: |
cmake --build ${{ github.workspace }}/BinaryCache/testing --target install
- name: Install xctest
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
run: |
cmake --build ${{ github.workspace }}/BinaryCache/xctest --target install
- name: Install foundation
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
run: |
cmake --build ${{ github.workspace }}/BinaryCache/foundation --target install
- name: Install libdispatch
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
run: |
cmake --build ${{ github.workspace }}/BinaryCache/libdispatch --target install
- uses: actions/setup-python@v5
- uses: jannekem/run-python-script-action@v1
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
with:
script: |
import os
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)
- uses: actions/upload-artifact@v4
#if: matrix.os != 'Android' || inputs.build_os != 'Windows' || inputs.build_arch != 'arm64'
with:
name: ${{ matrix.os }}-sdk-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/${{ matrix.os }}.platform
- name: Upload PDBs to Azure
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 (building on ${{ inputs.build_os }} ${{ inputs.build_arch }})
steps:
- uses: actions/download-artifact@v4
with:
name: sqlite-Windows-${{ matrix.arch }}-${{ inputs.swift_toolchain_sqlite_version }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr
- name: Download Compilers
uses: actions/download-artifact@v4
with:
name: compilers-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library
- uses: actions/download-artifact@v4
with:
name: Windows-stdlib-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform
- uses: actions/download-artifact@v4
with:
name: Windows-sdk-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform
- uses: actions/download-artifact@v4
with:
name: macros-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library
- uses: actions/download-artifact@v4
with:
name: swift-syntax-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/swift-syntax
- uses: actions/download-artifact@v4
with:
name: cmark-gfm-Windows-${{ inputs.build_arch }}-${{ inputs.swift_cmark_version }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr
- name: cmark-gfm Setup
run: Copy-Item ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/bin/*.dll ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/
- uses: actions/download-artifact@v4
if: matrix.arch != inputs.build_arch
with:
name: cmark-gfm-Windows-${{ matrix.arch }}-${{ inputs.swift_cmark_version }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr
- uses: actions/checkout@v4
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-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: jpsim/Yams
ref: ${{ inputs.yams_revision }}
path: ${{ github.workspace }}/SourceCache/Yams
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@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 }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform
- uses: actions/download-artifact@v4
with:
name: Windows-sdk-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform
- name: Configure swift-argument-parser
run: |
# Workaround CMake 3.20 issue
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
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_MT=mt `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/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" `
-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/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
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_MT=mt `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/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" `
-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/unknown-Asserts-development.xctoolchain/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_MT=mt `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/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" `
-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 Yams
run: |
# Workaround CMake 3.20 issue
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
cmake -B ${{ github.workspace }}/BinaryCache/yams `
-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_MT=mt `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/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" `
-D CMAKE_SYSTEM_NAME=Windows `
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
-G Ninja `
-S ${{ github.workspace }}/SourceCache/Yams
- name: Build Yams
run: cmake --build ${{ github.workspace }}/BinaryCache/yams
- name: Configure swift-llbuild
run: |
# Workaround CMake 3.20 issue
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/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_MT=mt `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/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" `
-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/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
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_MT=mt `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/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" `
-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/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
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_MT=mt `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/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" `
-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/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
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_MT=mt `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/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" `
-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 `
-D Yams_DIR=${{ github.workspace }}/BinaryCache/yams/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/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
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" `
-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/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
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" `
-D CMAKE_SYSTEM_NAME=Windows `
-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/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
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_MT=mt `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/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" `
-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 `
-D Yams_DIR=${{ github.workspace }}/BinaryCache/yams/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/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
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/unknown-Asserts-development.xctoolchain/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" `
-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/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
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/unknown-Asserts-development.xctoolchain/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" `
-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 IndexStoreDB
run: |
# Workaround CMake 3.20 issue
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
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_MT=mt `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/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" `
-D CMAKE_SYSTEM_NAME=Windows `
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
-G Ninja `
-S ${{ github.workspace }}/SourceCache/indexstore-db
- 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/unknown-Asserts-development.xctoolchain/usr/bin/clang-cl.exe
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
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 }}" `
-D CMAKE_MT=mt `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/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" `
-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
- 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 }}-built-on-${{ inputs.build_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
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 (building on ${{ inputs.build_os }} ${{ inputs.build_arch }})
steps:
- name: Download Compilers
uses: actions/download-artifact@v4
with:
name: compilers-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library
- name: Download Devtools
uses: actions/download-artifact@v4
with:
name: devtools-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library
- name: Download stdlib
uses: actions/download-artifact@v4
with:
name: Windows-stdlib-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform
- name: Download SDK
uses: actions/download-artifact@v4
with:
name: Windows-sdk-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform
- uses: actions/download-artifact@v4
with:
name: cmark-gfm-Windows-${{ inputs.build_arch }}-${{ inputs.swift_cmark_version }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr
- name: cmark-gfm Setup
run: Copy-Item ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/bin/*.dll ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/
- uses: actions/download-artifact@v4
if: matrix.arch != inputs.build_arch
with:
name: cmark-gfm-Windows-${{ matrix.arch }}-${{ inputs.swift_cmark_version }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr
- name: Update environment variables
run: |
$SDKRoot = cygpath -w "${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk"
echo "SDKROOT=${SDKRoot}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$ToolchainPath = cygpath -w "${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin"
echo "${ToolchainPath}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "AR=${ToolchainPath}\llvm-ar.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$RTLPath = cygpath -w "${{ github.workspace }}/BinaryCache/Developer/SDKs/Windows.sdk/usr/bin"
echo "${RTLPath}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- 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 }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform
- uses: actions/download-artifact@v4
with:
name: Windows-sdk-${{ inputs.build_arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform
- name: Move host libs to the host architecture directory
if: matrix.arch == 'arm64'
run: |
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/BlocksRuntime.lib ${env:SDKROOT}/usr/lib/swift/windows/x86_64/
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/dispatch.lib ${env:SDKROOT}/usr/lib/swift/windows/x86_64/
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/swiftDispatch.lib ${env:SDKROOT}/usr/lib/swift/windows/x86_64/
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/Foundation.lib ${env:SDKROOT}/usr/lib/swift/windows/x86_64/
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/FoundationXML.lib ${env:SDKROOT}/usr/lib/swift/windows/x86_64/
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/FoundationNetworking.lib ${env:SDKROOT}/usr/lib/swift/windows/x86_64/
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/_FoundationICU.lib ${env:SDKROOT}/usr/lib/swift/windows/x86_64/
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/FoundationEssentials.lib ${env:SDKROOT}/usr/lib/swift/windows/x86_64/
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/FoundationInternationalization.lib ${env:SDKROOT}/usr/lib/swift/windows/x86_64/
- name: Move host runtime DLLs to the runtime binary directory.
run: |
Remove-Item -Path ${env:SDKROOT}/usr/lib/swift/dispatch -Recurse -Force
Remove-Item -Path ${env:SDKROOT}/usr/lib/swift/os -Recurse -Force
Remove-Item -Path ${env:SDKROOT}/usr/lib/swift/Block -Recurse -Force
Remove-Item -Path ${env:SDKROOT}/usr/lib/swift/_foundation_unicode -Recurse -Force
Remove-Item -Path ${env:SDKROOT}/usr/lib/swift/_FoundationCShims -Recurse -Force
$RTLPath = cygpath -w "${{ github.workspace }}/BinaryCache/Developer/SDKs/Windows.sdk/usr/bin"
mkdir $RTLPath
Get-ChildItem -Path ${env:SDKROOT}/usr/bin -Filter "*.dll" | Move-Item -Destination $RTLPath
- uses: actions/checkout@v4
with:
repository: swiftlang/swift
ref: ${{ inputs.swift_revision }}
path: ${{ github.workspace }}/SourceCache/swift
show-progress: false
- name: Build swift-inspect
id: swift_inspect
shell: cmd
run: |
swift build ^
--triple=${{ matrix.triple }} ^
--scratch-path="${{ github.workspace }}/BinaryCache/${{ matrix.arch }}/swift-inspect" ^
--sdk="%SDKROOT%" ^
--package-path="${{ github.workspace }}/SourceCache/swift/tools/swift-inspect" ^
-c="release" ^
-Xbuild-tools-swiftc="-L%SDKROOT%/usr/lib/swift/windows" ^
-Xbuild-tools-swiftc="-I%SDKROOT%/usr/lib/swift" ^
-Xbuild-tools-swiftc="-use-ld=lld" ^
-Xcc="-I%SDKROOT%/usr/include/swift/SwiftRemoteMirror" ^
-Xswiftc="-use-ld=lld" ^
-Xlinker="%SDKROOT%/usr/lib/swift/windows/${{ matrix.cpu }}/swiftRemoteMirror.lib"
- name: Copy swift-inspect executable
run: |
New-Item -Path ${{ github.workspace }}/BuildRoot-DebuggingTools/swift-inspect -ItemType Directory -Force | Out-Null
$SwiftInspectPath="${{ github.workspace }}/BinaryCache/${{ matrix.arch }}/swift-inspect/${{ matrix.triple }}/release/swift-inspect.exe"
Copy-Item ${SwiftInspectPath} -Destination "${{ github.workspace }}/BuildRoot-DebuggingTools/swift-inspect/"
- uses: actions/upload-artifact@v4
with:
name: debugging_tools-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot-DebuggingTools
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 }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/DebuggingTools
- name: Download Compilers
uses: actions/download-artifact@v4
with:
name: compilers-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library
- name: Download Developer Tools
uses: actions/download-artifact@v4
with:
name: devtools-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library
- name: Download Macros
uses: actions/download-artifact@v4
with:
name: macros-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library
- name: Download cmark-gfm
uses: actions/download-artifact@v4
with:
name: cmark-gfm-Windows-${{ matrix.arch }}-${{ inputs.swift_cmark_version }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr
- name: cmark-gfm Setup
run: Copy-Item ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/bin/*.dll ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/
- 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@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) {
if ([string]::IsNullOrEmpty((Get-PackageSource | %{ $_.Location } | Select-String -Pattern api.nuget.org))) {
Register-PackageSource -Name NuGet -Location https://www.nuget.org/api/v2 -ProviderName NuGet
}
Install-Package -Name WixToolset.Sdk -RequiredVersion 4.0.1 -Force
}
- uses: actions/checkout@v4
if: matrix.arch == 'amd64'
with:
repository: microsoft/mimalloc
ref: ${{ inputs.mimalloc_revision }}
path: ${{ github.workspace }}/SourceCache/mimalloc
- name: Build and apply mimalloc
if: matrix.arch == 'amd64'
run: |
# Reference: https://github.com/microsoft/mimalloc/tree/dev/bin#minject
msbuild ${{ github.workspace }}\SourceCache\mimalloc\ide\vs2022\mimalloc.sln -p:Configuration=Release
$ToolchainBin = "${{ github.workspace }}\BuildRoot\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin"
Copy-Item -Path "${{ github.workspace }}\SourceCache\mimalloc\out\msvc-x64\Release\mimalloc-override.dll" `
-Destination "$ToolchainBin"
Copy-Item -Path "${{ github.workspace }}\SourceCache\mimalloc\out\msvc-x64\Release\mimalloc-redirect.dll" `
-Destination "$ToolchainBin"
$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 -f -i -v "$ToolchainBin\$Exe"
# Log the import table
${{ github.workspace }}\SourceCache\mimalloc\bin\minject -l "$ToolchainBin\$Exe"
}
- name: Package Build 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:DEVTOOLS_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain `
-p:TOOLCHAIN_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain `
-p:ENABLE_MIMALLOC=${{ matrix.arch == 'amd64' && 'true' || 'false' }} `
-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:DEVTOOLS_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain `
-p:TOOLCHAIN_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain `
-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:DEVTOOLS_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain `
-p:TOOLCHAIN_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain `
-p:INCLUDE_SWIFT_INSPECT=true `
-p:SWIFT_INSPECT_BUILD=${{ github.workspace }}/BuildRoot/DebuggingTools/swift-inspect `
-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:DEVTOOLS_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain `
-p:TOOLCHAIN_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain `
-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-built-on-${{ inputs.build_arch }}
path: |
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/bld.msi
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/bld.cab
- uses: actions/upload-artifact@v4
with:
name: cli-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }}
path: |
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/cli.msi
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/cli.cab
- uses: actions/upload-artifact@v4
with:
name: dbg-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }}
path: |
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/dbg.msi
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/dbg.cab
- uses: actions/upload-artifact@v4
with:
name: ide-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }}
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 }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform
- uses: actions/download-artifact@v4
with:
name: Windows-sdk-${{ matrix.arch }}-built-on-${{ inputs.build_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@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) {
if ([string]::IsNullOrEmpty((Get-PackageSource | %{ $_.Location } | Select-String -Pattern api.nuget.org))) {
Register-PackageSource -Name NuGet -Location https://www.nuget.org/api/v2 -ProviderName NuGet
}
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/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-built-on-${{ inputs.build_arch }}
path: |
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/sdk.${{ matrix.arch }}.msi
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/sdk.${{ matrix.arch }}.cab
- uses: actions/upload-artifact@v4
with:
name: rtl-windows-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }}
path: |
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/rtl.msi
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/rtl.cab
- uses: actions/upload-artifact@v4
with:
name: rtl-windows-${{ matrix.arch }}-msm-built-on-${{ inputs.build_arch }}
path: |
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/rtl.${{ matrix.arch }}.msm
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/rtl.${{ matrix.arch }}.cab
package_android_sdk_runtime:
# TODO: Build this on macOS or make an equivalent Mac-only job
if: inputs.build_os == 'Windows' && inputs.build_arch == 'amd64'
name: Package Android SDK & Runtime
needs: [stdlib, ds2, sdk]
runs-on: ${{ inputs.default_build_runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: arm64
cpu: aarch64
triple_no_api_level: aarch64-unknown-linux-android
- arch: armv7
cpu: armv7
triple_no_api_level: armv7-unknown-linux-androideabi
- arch: i686
cpu: i686
triple_no_api_level: i686-unknown-linux-android
- arch: x86_64
cpu: x86_64
triple_no_api_level: x86_64-unknown-linux-android
steps:
- uses: actions/download-artifact@v4
with:
name: Android-stdlib-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform
- uses: actions/download-artifact@v4
with:
name: Android-sdk-${{ matrix.arch }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform
- uses: actions/download-artifact@v4
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
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@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) {
if ([string]::IsNullOrEmpty((Get-PackageSource | %{ $_.Location } | Select-String -Pattern api.nuget.org))) {
Register-PackageSource -Name NuGet -Location https://www.nuget.org/api/v2 -ProviderName NuGet
}
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:ANDROID_INCLUDE_DS2=${{ inputs.build_arch == 'amd64' && true || false }} `
-p:CERTIFICATE=${env:CERTIFICATE} `
-p:PASSPHRASE=${{ secrets.PASSPHRASE }} `
-p:PLATFORM_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform `
-p:SDK_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Android.platform/Developer/SDKs/Android.sdk `
-p:ProductVersion=${{ inputs.swift_version }} `
-p:ProductArchitecture=${{ matrix.cpu }} `
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/android_sdk/android_sdk.wixproj
- uses: actions/upload-artifact@v4
with:
name: sdk-android-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }}
path: |
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.cpu }}/android_sdk.${{ matrix.cpu }}.msi
${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.cpu }}/android_sdk.${{ matrix.cpu }}.cab
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-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}
- uses: actions/download-artifact@v4
with:
name: cli-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}
- uses: actions/download-artifact@v4
with:
name: dbg-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}
- uses: actions/download-artifact@v4
with:
name: ide-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}
- uses: actions/download-artifact@v4
with:
name: rtl-windows-${{ matrix.arch }}-msi-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}
- uses: actions/download-artifact@v4
with:
name: rtl-windows-amd64-msm-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/installer/Release/amd64
- uses: actions/download-artifact@v4
with:
name: rtl-windows-x86-msm-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/installer/Release/x86
- uses: actions/download-artifact@v4
with:
name: rtl-windows-arm64-msm-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/installer/Release/arm64
- uses: actions/download-artifact@v4
with:
name: sdk-windows-amd64-msi-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/installer/Release/amd64
- uses: actions/download-artifact@v4
with:
name: sdk-windows-x86-msi-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/installer/Release/x86
- uses: actions/download-artifact@v4
with:
name: sdk-windows-arm64-msi-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/installer/Release/arm64
- uses: actions/download-artifact@v4
if: inputs.build_arch == 'amd64'
with:
name: sdk-android-arm64-msi-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/installer/Release/aarch64
- uses: actions/download-artifact@v4
if: inputs.build_arch == 'amd64'
with:
name: sdk-android-x86_64-msi-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/installer/Release/x86_64
- uses: actions/download-artifact@v4
if: inputs.build_arch == 'amd64'
with:
name: sdk-android-armv7-msi-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/BinaryCache/installer/Release/armv7
- uses: actions/download-artifact@v4
if: inputs.build_arch == 'amd64'
with:
name: sdk-android-i686-msi-built-on-${{ inputs.build_arch }}
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@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 }}
# TODO(issues/154): Preload WixToolset.Sdk on Azure images so we can remove this step.
- name: Install WixToolset.Sdk
run: |
if ([string]::IsNullOrEmpty((Get-PackageSource | %{ $_.Location } | Select-String -Pattern api.nuget.org))) {
Register-PackageSource -Name NuGet -Location https://www.nuget.org/api/v2 -ProviderName NuGet
}
Install-Package -Name WixToolset.Sdk -RequiredVersion 4.0.1 -Force
# 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_AMD64_SDK=true `
-p:INCLUDE_X86_SDK=true `
-p:INCLUDE_ARM64_SDK=true `
-p:ANDROID_INCLUDE_ARM64_SDK=${{ inputs.build_arch == 'amd64' && true || false }} `
-p:ANDROID_INCLUDE_x86_64_SDK=${{ inputs.build_arch == 'amd64' && true || false }} `
-p:ANDROID_INCLUDE_ARM_SDK=${{ inputs.build_arch == 'amd64' && true || false }} `
-p:ANDROID_INCLUDE_X86_SDK=${{ inputs.build_arch == 'amd64' && true || false }} `
-p:ProductArchitecture=${{ matrix.arch }} `
-p:ProductVersion=${{ inputs.swift_version }}-${{ inputs.swift_tag }} `
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/bundle/installer.wixproj
- uses: actions/upload-artifact@v4
with:
name: installer-${{ matrix.arch }}-built-on-${{ inputs.build_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 }}-built-on-${{ inputs.build_arch }}
path: ${{ github.workspace }}/tmp
# TODO(compnerd): migrate this to compnerd/gha-setup-swift after the work that @mangini is doing is completed
- 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