@@ -6422,3 +6422,269 @@ jobs:
64226422 - name : Build firebase-swift
64236423 working-directory : ${{ github.workspace }}/SourceCache/swift-firebase
64246424 run : cmake --build out
6425+
6426+ swift_test :
6427+ if : inputs.build_os == ${{ runner.os }}
6428+ needs : [compilers]
6429+ runs-on : ${{ inputs.compilers_build_runner }}
6430+
6431+ strategy :
6432+ fail-fast : false
6433+ # TODO: maybe refactor without using a matrix
6434+ matrix : ${{ fromJSON(inputs.build_matrix) }}
6435+
6436+ name : ${{ matrix.os }} ${{ matrix.arch }} Asserts Swift Test
6437+
6438+ steps :
6439+ 6440+ with :
6441+ path : ${{ github.workspace }}/SourceCache/ci-build
6442+ show-progress : false
6443+ - uses : ./SourceCache/ci-build/.github/actions/setup-build
6444+ with :
6445+ setup-vs-dev-env : true
6446+ host-arch : ${{ matrix.arch }}
6447+ swift-version : ${{ env.PINNED_BOOTSTRAP_TOOLCHAIN_VERSION }}
6448+
6449+ - name : Compute workspace hash
6450+ id : workspace_hash
6451+ shell : pwsh
6452+ run : |
6453+ $stringAsStream = [System.IO.MemoryStream]::new()
6454+ $writer = [System.IO.StreamWriter]::new($stringAsStream)
6455+ $writer.write("${{ github.workspace }}")
6456+ $writer.Flush()
6457+ $stringAsStream.Position = 0
6458+ $hash = (Get-FileHash -Algorithm SHA256 -InputStream $stringAsStream).Hash
6459+ echo "hash=$hash" >> $env:GITHUB_OUTPUT
6460+ - name : Setup sccache
6461+ uses : ./SourceCache/ci-build/.github/actions/setup-sccache
6462+ with :
6463+ s3-bucket : ${{ vars.SCCACHE_S3_BUCKET }}
6464+ aws-region : ${{ vars.SCCACHE_AWS_REGION }}
6465+ aws-arn : ${{ vars.SCCACHE_AWS_ARN }}
6466+ disk-max-size : 500M
6467+ disk-cache-key : ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-Asserts-compilers
6468+
6469+ - uses : thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
6470+ with :
6471+ name : ${{ inputs.build_os }}-${{ inputs.build_arch }}-build-tools
6472+ path : ${{ github.workspace }}/BinaryCache/0/bin
6473+ - uses : actions/download-artifact@v4
6474+ with :
6475+ name : ${{ matrix.os }}-${{ matrix.arch }}-libxml2-${{ inputs.libxml2_version }}
6476+ path : ${{ github.workspace }}/BinaryCache/Library/libxml2-${{ inputs.libxml2_version }}/usr
6477+ - uses : thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
6478+ with :
6479+ name : ${{ matrix.os }}-${{ matrix.arch }}-cmark-gfm-${{ inputs.swift_cmark_version }}
6480+ path : ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr
6481+ - uses : thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
6482+ with :
6483+ name : ${{ inputs.build_os }}-${{ inputs.build_arch }}-early-swift-driver
6484+ path : ${{ github.workspace }}/BinaryCache/swift-driver
6485+
6486+ 6487+ with :
6488+ repository : swiftlang/llvm-project
6489+ ref : ${{ inputs.llvm_project_revision }}
6490+ path : ${{ github.workspace }}/SourceCache/llvm-project
6491+ show-progress : false
6492+ 6493+ with :
6494+ repository : swiftlang/swift
6495+ ref : ${{ inputs.swift_revision }}
6496+ path : ${{ github.workspace }}/SourceCache/swift
6497+ show-progress : false
6498+ 6499+ with :
6500+ repository : swiftlang/swift-experimental-string-processing
6501+ ref : ${{ inputs.swift_experimental_string_processing_revision }}
6502+ path : ${{ github.workspace }}/SourceCache/swift-experimental-string-processing
6503+ show-progress : false
6504+ 6505+ with :
6506+ repository : swiftlang/swift-syntax
6507+ ref : ${{ inputs.swift_syntax_revision }}
6508+ path : ${{ github.workspace }}/SourceCache/swift-syntax
6509+ show-progress : false
6510+ 6511+ with :
6512+ repository : apple/swift-corelibs-libdispatch
6513+ ref : ${{ inputs.swift_corelibs_libdispatch_revision }}
6514+ path : ${{ github.workspace }}/SourceCache/swift-corelibs-libdispatch
6515+ show-progress : false
6516+
6517+ - uses : actions/setup-python@v5
6518+ id : python
6519+ with :
6520+ python-version : ${{ inputs.python_version }}
6521+ architecture : x64 # FIXME(#1004): Remove workaround installing x64 Python on ARM64 CI hosts
6522+
6523+ - name : Download and expand Python
6524+ env :
6525+ INPUT_PYTHON_DOWNLOAD_LOCATIONS : ${{ inputs.python_download_locations }}
6526+ INPUT_PYTHON_VERSION : ${{ inputs.python_version }}
6527+ run : |
6528+ function DownloadAndVerify($URL, $Destination, $Hash) {
6529+ New-Item -ItemType Directory (Split-Path -Path $Destination -Parent) -ErrorAction Ignore | Out-Null
6530+ $WebClient = New-Object Net.WebClient
6531+ $WebClient.DownloadFile($URL, $Destination)
6532+ $ExpectedHash = $Hash.ToUpperInvariant()
6533+ $SHA256 = (Get-FileHash -Path $Destination -Algorithm SHA256).Hash.ToUpperInvariant()
6534+ if ($SHA256 -ne $ExpectedHash) {
6535+ throw "SHA256 mismatch ($SHA256 vs $Hash) for $URL"
6536+ }
6537+ }
6538+
6539+ $KnownPythons = $env:INPUT_PYTHON_DOWNLOAD_LOCATIONS | ConvertFrom-Json
6540+ $version = $env:INPUT_PYTHON_VERSION
6541+ $archKey = "${{ matrix.arch }}".ToUpper()
6542+ $pythonInfo = $KnownPythons."$version"."$archKey"
6543+ if ($null -eq $pythonInfo) {
6544+ throw "No python download info for version $version and architecture $archKey"
6545+ }
6546+ Write-Host "Downloading Python $version for $archKey"
6547+
6548+ # Download the Python package
6549+ $packagePath = "${{ github.workspace }}\BinaryCache\Python-$archKey-$version.zip"
6550+ DownloadAndVerify -URL $pythonInfo.URL -Destination $packagePath -Hash $pythonInfo.SHA256
6551+ Write-Host "Downloaded Python $version for $archKey to $packagePath"
6552+
6553+ # Extract the Python package
6554+ $extractRoot = "${{ github.workspace }}\BuildRoot\Library\Developer\Python-$archKey-$version"
6555+ New-Item -ItemType Directory -Path $extractRoot -ErrorAction Ignore | Out-Null
6556+ Expand-Archive -Path $packagePath -DestinationPath $extractRoot -Force
6557+ Write-Host "Extracted Python $version for $archKey to $extractRoot"
6558+
6559+ # Export Python Location
6560+ echo "PYTHON_LOCATION=$extractRoot" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
6561+
6562+ - name : Setup context
6563+ id : setup-context
6564+ env :
6565+ INPUT_PYTHON_VERSION : ${{ inputs.python_version }}
6566+ run : |
6567+ $PythonVersion = $env:INPUT_PYTHON_VERSION
6568+ $PythonMajor = ([System.Version]$PythonVersion).Major
6569+ $PythonMinor = ([System.Version]$PythonVersion).Minor
6570+ if ( "${{ matrix.os }}" -eq "Windows" ) {
6571+ $CLANG_LOCATION = cygpath -m $(Split-Path (Get-Command swiftc).Source)
6572+ $SDKROOT = cygpath -m ${env:SDKROOT}
6573+ $LIBPYTHON_PATH = "${env:PYTHON_LOCATION}/tools/libs/python${PythonMajor}${PythonMinor}.lib"
6574+ $PYTHON_INCLUDE_DIR = "${env:PYTHON_LOCATION}/tools/include"
6575+ $PYTHON_BINARY="python.exe"
6576+ } elseif ( "${{ matrix.os }}" -eq "Darwin" ) {
6577+ $CLANG_LOCATION = "${env:HOME}/Library/Developer/Toolchains/swift-${{ env.PINNED_BOOTSTRAP_TOOLCHAIN_VERSION }}-RELEASE.xctoolchain/usr/bin"
6578+ $SDKROOT = xcrun --sdk macosx --show-sdk-path
6579+ $LIBPYTHON_PATH = "${env:pythonLocation}/lib/python${PythonMajor}.${PythonMinor}/config-${PythonMajor}.${PythonMinor}-darwin/libpython${PythonMajor}.${PythonMinor}.a"
6580+ $PYTHON_INCLUDE_DIR = "${env:pythonLocation}/include/python${PythonMajor}.${PythonMinor}"
6581+ $PYTHON_BINARY="python${PythonMajor}"
6582+ }
6583+
6584+ # Compute the number of parallel jobs to use for the build.
6585+ $RamBytes = if ($IsWindows) {
6586+ (Get-CimInstance -ClassName Win32_ComputerSystem).TotalPhysicalMemory
6587+ } elseif ($IsMacOS) {
6588+ [int64](sysctl -n hw.memsize)
6589+ } else {
6590+ throw "Unsupported OS"
6591+ }
6592+ $RamGB = [math]::Round($RamBytes / 1GB)
6593+
6594+ # Consider 24 GB per link job, to a minimum of 2 jobs.
6595+ $LinkJobs = [math]::Max(2, [math]::Floor($RamGB / 24))
6596+
6597+ # Output the context for the configure task.
6598+ $Context = @"
6599+ clang-location=${CLANG_LOCATION}
6600+ libpython-path=${LIBPYTHON_PATH}
6601+ python-include-dir=${PYTHON_INCLUDE_DIR}
6602+ python-binary=${PYTHON_BINARY}
6603+ python-executable=${PYTHON_EXECUTABLE}
6604+ sdkroot=${SDKROOT}
6605+ link-jobs=${LinkJobs}
6606+ "@
6607+ Write-Output $Context | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
6608+
6609+ # build.ps1: Test-Compilers, with Get-CompilersDefines with -Test TestSwift
6610+ - name : Configure Compilers for testing
6611+ uses : ./SourceCache/ci-build/.github/actions/configure-cmake-project
6612+ with :
6613+ project-name : Compilers
6614+ swift-version : ${{ inputs.swift_version }}
6615+ enable-caching : true
6616+ debug-info : ${{ inputs.debug_info }}
6617+ build-os : ${{ inputs.build_os }}
6618+ build-arch : ${{ inputs.build_arch }}
6619+ os : ${{ matrix.os }}
6620+ arch : ${{ matrix.arch }}
6621+ src-dir : ${{ github.workspace }}/SourceCache/llvm-project/llvm
6622+ bin-dir : ${{ github.workspace }}/BinaryCache/1
6623+ install-dir : ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr
6624+ swift-sdk-path : ${{ steps.setup-context.outputs.sdkroot }}
6625+ msvc-compilers : ${{ inputs.use_host_toolchain && '@("C", "CXX")' || '@()' }}
6626+ pinned-compilers : ${{ inputs.use_host_toolchain && '@("Swift")' || '@("C", "CXX", "Swift")' }}
6627+ cache-script : ${{ github.workspace }}/SourceCache/swift/cmake/caches/${{ matrix.os }}-${{ matrix.cpu }}.cmake
6628+ cmake-defines : |
6629+ @{
6630+ 'SWIFT_BUILD_DYNAMIC_SDK_OVERLAY' = "YES";
6631+ 'SWIFT_BUILD_DYNAMIC_STDLIB' = "YES";
6632+ 'SWIFT_BUILD_REMOTE_MIRROR' = "YES";
6633+ 'SWIFT_NATIVE_SWIFT_TOOLS_PATH' = "";
6634+ 'CLANG_TABLEGEN' = "${{ github.workspace }}/BinaryCache/0/bin/clang-tblgen${ExeSuffix}";
6635+ 'CLANG_TIDY_CONFUSABLE_CHARS_GEN' = "${{ github.workspace }}/BinaryCache/0/bin/clang-tidy-confusable-chars-gen${ExeSuffix}";
6636+ 'CMAKE_STATIC_LIBRARY_PREFIX_Swift' = "lib";
6637+ 'LibXml2_DIR' = "${{ github.workspace }}/BinaryCache/Library/libxml2-${{ inputs.libxml2_version }}/usr/lib/cmake/libxml2-${{ inputs.libxml2_version }}";
6638+ 'LLDB_LIBXML2_VERSION' = "${{ inputs.libxml2_version }}";
6639+ 'LLDB_PYTHON_EXE_RELATIVE_PATH' = "${{ steps.setup-context.outputs.python-binary }}";
6640+ 'LLDB_PYTHON_EXT_SUFFIX' = ".pyd";
6641+ 'LLDB_PYTHON_RELATIVE_PATH' = "lib/site-packages";
6642+ 'LLDB_TABLEGEN' = "${{ github.workspace }}/BinaryCache/0/bin/lldb-tblgen${ExeSuffix}";
6643+ 'LLVM_CONFIG_PATH' = "${{ github.workspace }}/BinaryCache/0/bin/llvm-config${ExeSuffix}";
6644+ 'LLVM_ENABLE_ASSERTIONS' = "YES";
6645+ 'LLVM_ENABLE_LLD' = "${{ inputs.use_host_toolchain && 'NO' || 'YES' }}";
6646+ 'LLVM_EXTERNAL_SWIFT_SOURCE_DIR' = "${{ github.workspace }}/SourceCache/swift";
6647+ 'LLVM_HOST_TRIPLE' = "${{ matrix.triple }}";
6648+ 'LLVM_NATIVE_TOOL_DIR' = "${{ github.workspace }}/BinaryCache/0/bin";
6649+ 'LLVM_TABLEGEN' = "${{ github.workspace }}/BinaryCache/0/bin/llvm-tblgen${ExeSuffix}";
6650+ 'LLVM_USE_HOST_TOOLS' = "NO";
6651+ 'Python3_EXECUTABLE' = "${{ steps.python.outputs.python-path }}";
6652+ 'Python3_INCLUDE_DIR' = "${{ steps.setup-context.outputs.python-include-dir }}";
6653+ 'Python3_LIBRARY' = "${{ steps.setup-context.outputs.libpython-path }}";
6654+ 'Python3_ROOT_DIR' = $env:pythonLocation;
6655+ 'SWIFT_TOOLCHAIN_VERSION' = "${{ inputs.swift_version}} ${{ inputs.swift_tag }}";
6656+ 'SWIFT_BUILD_SWIFT_SYNTAX' = "YES";
6657+ 'SWIFT_CLANG_LOCATION' = "${{ steps.setup-context.outputs.clang-location }}";
6658+ 'SWIFT_EARLY_SWIFT_DRIVER_BUILD' = "${{ github.workspace }}/BinaryCache/swift-driver/bin";
6659+ 'SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY' = "YES";
6660+ 'SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP' = "YES";
6661+ 'SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING' = "YES";
6662+ 'SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED' = "YES";
6663+ 'SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION' = "YES";
6664+ 'SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING' = "YES";
6665+ 'SWIFT_ENABLE_SYNCHRONIZATION' = "YES";
6666+ 'SWIFT_ENABLE_VOLATILE' = "YES";
6667+ 'SWIFT_PATH_TO_LIBDISPATCH_SOURCE' = "${{ github.workspace }}/SourceCache/swift-corelibs-libdispatch";
6668+ 'SWIFT_PATH_TO_STRING_PROCESSING_SOURCE' = "${{ github.workspace }}/SourceCache/swift-experimental-string-processing";
6669+ 'SWIFT_PATH_TO_SWIFT_SDK' = "${{ steps.setup-context.outputs.sdkroot }}";
6670+ 'SWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE' = "${{ github.workspace }}/SourceCache/swift-syntax";
6671+ 'SWIFT_STDLIB_ASSERTIONS' = "NO";
6672+ 'SWIFTSYNTAX_ENABLE_ASSERTIONS' = "NO";
6673+ 'cmark-gfm_DIR' = "${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake";
6674+
6675+ # GHA-specific options.
6676+ 'CLANG_VENDOR' = 'compnerd.org';
6677+ 'CLANG_VENDOR_UTI' = 'org.compnerd.dt';
6678+ 'LLVM_APPEND_VC_REV' = "NO";
6679+ 'LLVM_VERSION_SUFFIX' = "";
6680+ 'LLVM_PARALLEL_LINK_JOBS' = "${{ steps.setup-context.outputs.link-jobs }}";
6681+ 'SWIFT_PARALLEL_LINK_JOBS' = "${{ steps.setup-context.outputs.link-jobs }}";
6682+ 'CMAKE_C_FLAGS' = "${{ !inputs.use_host_toolchain && '-fuse-ld=lld' || '' }}";
6683+ 'CMAKE_CXX_FLAGS' = "${{ !inputs.use_host_toolchain && '-fuse-ld=lld' || '' }}";
6684+ 'CMAKE_Swift_FLAGS' = "${{ !inputs.use_host_toolchain && '-use-ld=lld' || '' }}";
6685+ }
6686+
6687+ - name : Test Compiler
6688+ run : |
6689+ $env:Path = "${{ github.workspace }}\BinaryCache\Library\cmark-gfm-${{ inputs.swift_cmark_version }}\usr\bin;${{ github.workspace }}\BinaryCache\1\tools\swift\libdispatch-windows-${{ matrix.cpu }}-prefix\bin;${{ github.workspace }}\BinaryCache\1\bin;$env:Path;$env:VSInstallRoot\DIA SDK\bin\${{ matrix.arch }}"
6690+ cmake --build ${{ github.workspace }}/BinaryCache/1 --target check-swift
0 commit comments