Skip to content

Commit 064809d

Browse files
committed
Run the CMake smoke test on macOS as well
1 parent b3a3859 commit 064809d

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed
File renamed without changes.

.github/scripts/linux_pre_build.sh renamed to .github/scripts/prebuild.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,26 @@
1313

1414
set -e
1515

16-
if command -v apt-get >/dev/null 2>&1 ; then # bookworm, noble, jammy
16+
if [[ $(uname) == Darwin ]] ; then
17+
if [[ "$INSTALL_CMAKE" == "1" ]] ; then
18+
mkdir -p "$RUNNER_TOOL_CACHE"
19+
if ! command -v cmake >/dev/null 2>&1 ; then
20+
curl -fsSLO https://github.com/Kitware/CMake/releases/download/v4.1.2/cmake-4.1.2-macos-universal.tar.gz
21+
echo '3be85f5b999e327b1ac7d804cbc9acd767059e9f603c42ec2765f6ab68fbd367 cmake-4.1.2-macos-universal.tar.gz' > cmake-4.1.2-macos-universal.tar.gz.sha256
22+
sha256sum -c cmake-4.1.2-macos-universal.tar.gz.sha256
23+
tar -xf cmake-4.1.2-macos-universal.tar.gz
24+
ln -s "$PWD/cmake-4.1.2-macos-universal/CMake.app/Contents/bin/cmake" "$RUNNER_TOOL_CACHE/cmake"
25+
fi
26+
if ! command -v ninja >/dev/null 2>&1 ; then
27+
curl -fsSLO https://github.com/ninja-build/ninja/releases/download/v1.13.1/ninja-mac.zip
28+
echo 'da7797794153629aca5570ef7c813342d0be214ba84632af886856e8f0063dd9 ninja-mac.zip' > ninja-mac.zip.sha256
29+
sha256sum -c ninja-mac.zip.sha256
30+
unzip ninja-mac.zip
31+
rm -f ninja-mac.zip
32+
mv ninja "$RUNNER_TOOL_CACHE/ninja"
33+
fi
34+
fi
35+
elif command -v apt-get >/dev/null 2>&1 ; then # bookworm, noble, jammy
1736
export DEBIAN_FRONTEND=noninteractive
1837

1938
apt-get update -y

.github/workflows/pull_request.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@ jobs:
1414
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
1515
with:
1616
linux_os_versions: '["amazonlinux2", "bookworm", "noble", "jammy", "rhel-ubi9"]'
17-
linux_pre_build_command: ./.github/scripts/linux_pre_build.sh
17+
linux_pre_build_command: ./.github/scripts/prebuild.sh
1818
linux_build_command: 'swift test --no-parallel'
1919
linux_swift_versions: '["nightly-main", "nightly-6.2"]'
20-
windows_pre_build_command: 'Invoke-Program .\.github\scripts\windows_pre_build.ps1'
20+
windows_pre_build_command: 'Invoke-Program .\.github\scripts\prebuild.ps1'
2121
windows_swift_versions: '["nightly-main"]'
2222
windows_build_command: 'Invoke-Program swift test --no-parallel'
2323
enable_linux_static_sdk_build: true
2424
linux_static_sdk_build_command: SWIFTBUILD_STATIC_LINK=1 LLBUILD_STATIC_LINK=1 swift build
2525
enable_macos_checks: true
2626
macos_exclude_xcode_versions: "[{\"xcode_version\": \"16.3\"}, {\"xcode_version\": \"16.4\"}]"
27+
macos_pre_build_command: ./.github/scripts/prebuild.sh
2728
macos_build_command:
2829
swift test &&
2930
/usr/bin/xcrun xcodebuild -workspace . -scheme SwiftBuild-Package -destination generic/platform=iOS
@@ -32,10 +33,14 @@ jobs:
3233
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
3334
with:
3435
linux_os_versions: '["noble"]'
35-
linux_pre_build_command: SKIP_ANDROID=1 INSTALL_CMAKE=1 ./.github/scripts/linux_pre_build.sh
36+
linux_pre_build_command: SKIP_ANDROID=1 INSTALL_CMAKE=1 ./.github/scripts/prebuild.sh
3637
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`'
3738
linux_swift_versions: '["nightly-main"]'
38-
windows_pre_build_command: 'Invoke-Program .\.github\scripts\windows_pre_build.ps1 -SkipAndroid -InstallCMake'
39+
enable_macos_checks: true
40+
macos_xcode_versions: '["26.0"]'
41+
macos_pre_build_command: SKIP_ANDROID=1 INSTALL_CMAKE=1 ./.github/scripts/prebuild.sh
42+
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`'
43+
windows_pre_build_command: 'Invoke-Program .\.github\scripts\prebuild.ps1 -SkipAndroid -InstallCMake'
3944
windows_swift_versions: '["nightly-main"]'
4045
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"'
4146

0 commit comments

Comments
 (0)