diff --git a/.github/scripts/windows_pre_build.ps1 b/.github/scripts/prebuild.ps1 similarity index 100% rename from .github/scripts/windows_pre_build.ps1 rename to .github/scripts/prebuild.ps1 diff --git a/.github/scripts/linux_pre_build.sh b/.github/scripts/prebuild.sh similarity index 61% rename from .github/scripts/linux_pre_build.sh rename to .github/scripts/prebuild.sh index fcbf2099..1cd6d3cd 100755 --- a/.github/scripts/linux_pre_build.sh +++ b/.github/scripts/prebuild.sh @@ -13,7 +13,26 @@ set -e -if command -v apt-get >/dev/null 2>&1 ; then # bookworm, noble, jammy +if [[ $(uname) == Darwin ]] ; then + if [[ "$INSTALL_CMAKE" == "1" ]] ; then + mkdir -p "$RUNNER_TOOL_CACHE" + if ! command -v cmake >/dev/null 2>&1 ; then + curl -fsSLO https://github.com/Kitware/CMake/releases/download/v4.1.2/cmake-4.1.2-macos-universal.tar.gz + echo '3be85f5b999e327b1ac7d804cbc9acd767059e9f603c42ec2765f6ab68fbd367 cmake-4.1.2-macos-universal.tar.gz' > cmake-4.1.2-macos-universal.tar.gz.sha256 + sha256sum -c cmake-4.1.2-macos-universal.tar.gz.sha256 + tar -xf cmake-4.1.2-macos-universal.tar.gz + ln -s "$PWD/cmake-4.1.2-macos-universal/CMake.app/Contents/bin/cmake" "$RUNNER_TOOL_CACHE/cmake" + fi + if ! command -v ninja >/dev/null 2>&1 ; then + curl -fsSLO https://github.com/ninja-build/ninja/releases/download/v1.13.1/ninja-mac.zip + echo 'da7797794153629aca5570ef7c813342d0be214ba84632af886856e8f0063dd9 ninja-mac.zip' > ninja-mac.zip.sha256 + sha256sum -c ninja-mac.zip.sha256 + unzip ninja-mac.zip + rm -f ninja-mac.zip + mv ninja "$RUNNER_TOOL_CACHE/ninja" + fi + fi +elif command -v apt-get >/dev/null 2>&1 ; then # bookworm, noble, jammy export DEBIAN_FRONTEND=noninteractive apt-get update -y diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 6bbd2ac5..985ee238 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -14,16 +14,17 @@ jobs: uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main with: linux_os_versions: '["amazonlinux2", "bookworm", "noble", "jammy", "rhel-ubi9"]' - linux_pre_build_command: ./.github/scripts/linux_pre_build.sh + linux_pre_build_command: ./.github/scripts/prebuild.sh linux_build_command: 'swift test --no-parallel' linux_swift_versions: '["nightly-main", "nightly-6.2"]' - windows_pre_build_command: 'Invoke-Program .\.github\scripts\windows_pre_build.ps1' + windows_pre_build_command: 'Invoke-Program .\.github\scripts\prebuild.ps1' windows_swift_versions: '["nightly-main"]' windows_build_command: 'Invoke-Program swift test --no-parallel' enable_linux_static_sdk_build: true linux_static_sdk_build_command: SWIFTBUILD_STATIC_LINK=1 LLBUILD_STATIC_LINK=1 swift build enable_macos_checks: true macos_exclude_xcode_versions: "[{\"xcode_version\": \"16.3\"}, {\"xcode_version\": \"16.4\"}]" + macos_pre_build_command: ./.github/scripts/prebuild.sh macos_build_command: swift test && /usr/bin/xcrun xcodebuild -workspace . -scheme SwiftBuild-Package -destination generic/platform=iOS @@ -32,10 +33,14 @@ jobs: uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main with: linux_os_versions: '["noble"]' - linux_pre_build_command: SKIP_ANDROID=1 INSTALL_CMAKE=1 ./.github/scripts/linux_pre_build.sh + linux_pre_build_command: SKIP_ANDROID=1 INSTALL_CMAKE=1 ./.github/scripts/prebuild.sh linux_build_command: 'swift package -Xbuild-tools-swiftc -DUSE_PROCESS_SPAWNING_WORKAROUND cmake-smoke-test --disable-sandbox --cmake-path `which cmake` --ninja-path `which ninja` --extra-cmake-arg -DCMAKE_C_COMPILER=`which clang` --extra-cmake-arg -DCMAKE_CXX_COMPILER=`which clang++` --extra-cmake-arg -DCMAKE_Swift_COMPILER=`which swiftc`' linux_swift_versions: '["nightly-main"]' - windows_pre_build_command: 'Invoke-Program .\.github\scripts\windows_pre_build.ps1 -SkipAndroid -InstallCMake' + enable_macos_checks: true + macos_xcode_versions: '["26.0"]' + macos_pre_build_command: SKIP_ANDROID=1 INSTALL_CMAKE=1 ./.github/scripts/prebuild.sh + macos_build_command: 'export PATH=$PATH:$RUNNER_TOOL_CACHE && swift package cmake-smoke-test --disable-sandbox --cmake-path `which cmake` --ninja-path `which ninja` --extra-cmake-arg -DCMAKE_C_COMPILER=`which clang` --extra-cmake-arg -DCMAKE_CXX_COMPILER=`which clang++` --extra-cmake-arg -DCMAKE_Swift_COMPILER=`which swiftc`' + windows_pre_build_command: 'Invoke-Program .\.github\scripts\prebuild.ps1 -SkipAndroid -InstallCMake' windows_swift_versions: '["nightly-main"]' windows_build_command: 'Invoke-Program swift package cmake-smoke-test --disable-sandbox --cmake-path (Get-Command cmake).Path --ninja-path (Get-Command ninja).Path --extra-cmake-arg "-DCMAKE_C_COMPILER=$((Get-Command clang).Path)" --extra-cmake-arg "-DCMAKE_CXX_COMPILER=$((Get-Command clang).Path)" --extra-cmake-arg "-DCMAKE_Swift_COMPILER=$((Get-Command swiftc).Path)" --extra-cmake-arg "-DCMAKE_STATIC_LIBRARY_PREFIX_Swift=lib" --extra-cmake-arg "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL"'