Skip to content

Commit

Permalink
Add Swift 6.0 CI for building carton for macOS (#483)
Browse files Browse the repository at this point in the history
* add Swift 6 in CI with special hack

* revert meaningless indent diff
  • Loading branch information
omochi committed Jun 10, 2024
1 parent 1dc1649 commit 2f6de6c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions ci/mac/install-swift.bash
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2f6de6c

Please sign in to comment.