From 2f6de6cac34ef2b451728bf1466f6f9f097ebb5a Mon Sep 17 00:00:00 2001 From: omochimetaru Date: Mon, 10 Jun 2024 10:44:02 +0800 Subject: [PATCH] Add Swift 6.0 CI for building carton for macOS (#483) * add Swift 6 in CI with special hack * revert meaningless indent diff --- .github/workflows/swift.yml | 14 +++++++++++++- ci/mac/install-swift.bash | 25 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100755 ci/mac/install-swift.bash diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 695d8981..c83a0753 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -14,6 +14,12 @@ jobs: strategy: matrix: include: + - os: macos-14 + xcode: "15.4" + swift: "6.0" + swift-install: + dir: "swift-6.0-branch/xcode" + version: "swift-6.0-DEVELOPMENT-SNAPSHOT-2024-06-07-a" - os: macos-14 xcode: "15.4" swift: "5.10" @@ -28,6 +34,13 @@ jobs: - name: Select Xcode version run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer + - name: Install Swift ${{ matrix.swift }} + if: ${{ matrix.swift-install != null }} + run: bash ci/mac/install-swift.bash + env: + SWIFT_DIR: ${{ matrix.swift-install.dir }} + SWIFT_VERSION: ${{ matrix.swift-install.version }} + - name: Check Swift version run: swift --version @@ -55,7 +68,6 @@ jobs: - swift: dir: "swift-5.9.2-release/ubuntu2204" version: "swift-5.9.2-RELEASE" - steps: - name: Checkout the repository uses: actions/checkout@v4 diff --git a/ci/mac/install-swift.bash b/ci/mac/install-swift.bash new file mode 100755 index 00000000..8d859e1e --- /dev/null +++ b/ci/mac/install-swift.bash @@ -0,0 +1,25 @@ +#!/bin/bash +set -ue +cd "$(dirname "$0")/../.." + +mkdir -p install +cd install + +set -x +pwd +curl -fLO https://download.swift.org/${SWIFT_DIR}/${SWIFT_VERSION}/${SWIFT_VERSION}-osx.pkg +installer -target CurrentUserHomeDirectory -pkg ${SWIFT_VERSION}-osx.pkg + +toolchain=~/Library/Developer/Toolchains/${SWIFT_VERSION}.xctoolchain + +set +x +swift_id=$(plutil -extract CFBundleIdentifier raw ${toolchain}/Info.plist) + +set -x +echo "TOOLCHAINS=${swift_id}" >> $GITHUB_ENV + +# https://github.com/apple/swift/issues/73327#issuecomment-2120481479 +find ${toolchain}/usr/bin -type f | xargs -n 1 -I {} \ + sudo codesign --force --preserve-metadata=identifier,entitlements --sign - {} + +echo "DYLD_LIBRARY_PATH=${toolchain}/usr/lib/swift/macosx" >> $GITHUB_ENV