Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare package for Swift 6.0 #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/package.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,37 @@
{
"identity" : "swift-macro-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-macro-testing.git",
"location" : "https://github.com/pointfreeco/swift-macro-testing",
"state" : {
"revision" : "10dcef36314ddfea6f60442169b0b320204cbd35",
"version" : "0.2.2"
"revision" : "20c1a8f3b624fb5d1503eadcaa84743050c350f4",
"version" : "0.5.2"
}
},
{
"identity" : "swift-macro-toolkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/stackotter/swift-macro-toolkit.git",
"state" : {
"revision" : "106daeb38eb3f52b1540aed981fc63fa22274576",
"version" : "0.3.1"
"revision" : "2eded9c9a98cba42d70fb179d516231fffcff1e4",
"version" : "0.5.0"
}
},
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"state" : {
"revision" : "8e68404f641300bfd0e37d478683bb275926760c",
"version" : "1.15.2"
"revision" : "7b0bbbae90c41f848f90ac7b4df6c4f50068256d",
"version" : "1.17.5"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"location" : "https://github.com/swiftlang/swift-syntax",
"state" : {
"revision" : "74203046135342e4a4a627476dd6caf8b28fe11b",
"version" : "509.0.0"
"revision" : "2bc86522d115234d1f588efe2bcb4ce4be8f8b82",
"version" : "510.0.3"
}
}
],
Expand Down
96 changes: 84 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,100 @@ on:
pull_request:
branches:
- '*'
workflow_dispatch:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
library-swift-latest:
name: Library
test-library:
name: test-library
if: |
!contains(github.event.head_commit.message, '[ci skip]') &&
!contains(github.event.head_commit.message, '[ci skip test]') &&
!contains(github.event.head_commit.message, '[ci skip library-swift-latest]')
runs-on: macos-13
timeout-minutes: 30
runs-on: macos-14
strategy:
matrix:
config:
- debug
- release
scheme: [Interception]
command: [test]
platform: [iOS, macOS, tvOS, watchOS, macCatalyst]
xcode: [15.4, '16.0']
config: [Debug, Release]
steps:
- uses: actions/checkout@v4
- name: Select Xcode 15.2
run: sudo xcode-select -s /Applications/Xcode_15.2.app
- name: Run test
run: make test
- uses: actions/checkout@v4
with:
submodules: true
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Cache derived data
uses: actions/cache@v3
with:
path: |
~/.derivedData
key: |
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift') }}
restore-keys: |
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-
- name: Set IgnoreFileSystemDeviceInodeChanges flag
run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
- name: Update mtime for incremental builds
uses: chetan/git-restore-mtime-action@v2
- name: test-library (${{ matrix.config }})
uses: capturecontext/swift-package-action@1.0
with:
command: xcodebuild
subcommand: ${{ matrix.command }}
platform: ${{ matrix.platform }}
scheme: ${{ matrix.scheme }}
config: ${{ matrix.config }}
- name: test-library-macros (${{ matrix.config }})
uses: capturecontext/swift-package-action@1.0
with:
command: xcodebuild-macros
subcommand: ${{ matrix.command }}
platform: ${{ matrix.platform }}
scheme: ${{ matrix.scheme }}
config: ${{ matrix.config }}
test-library-macros-plugin:
name: test-library-macros-plugin
if: |
!contains(github.event.head_commit.message, '[ci skip]') &&
!contains(github.event.head_commit.message, '[ci skip test]') &&
!contains(github.event.head_commit.message, '[ci skip library-swift-latest]')
runs-on: macos-14
strategy:
matrix:
scheme: [Interception]
command: [test]
platform: [macOS]
xcode: ['16.0']
config: [Debug]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Cache derived data
uses: actions/cache@v3
with:
path: |
~/.derivedData
key: |
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift') }}
restore-keys: |
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-
- name: Set IgnoreFileSystemDeviceInodeChanges flag
run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
- name: Update mtime for incremental builds
uses: chetan/git-restore-mtime-action@v2
- name: test-library-macros-plugin (${{ matrix.config }})
uses: capturecontext/swift-package-action@1.0
with:
command: xcodebuild-macros-plugin
subcommand: ${{ matrix.command }}
platform: ${{ matrix.platform }}
scheme: ${{ matrix.scheme }}
config: ${{ matrix.config }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
Package.resolved
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "swift-package-action"]
path = swift-package-action
url = git@github.com:capturecontext/swift-package-action.git
2 changes: 1 addition & 1 deletion .spi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ version: 1
builder:
configs:
- documentation_targets: [Interception]
swift_version: 5.9
swift_version: 5.10
150 changes: 92 additions & 58 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,71 +1,105 @@
CONFIG = debug
PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iOS 17.2,iPhone \d\+ Pro [^M])
PLATFORM_MACOS = macOS
PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst
PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,tvOS 17,TV)
PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,watchOS 10,Watch)
default:
$(error Missing command)
@exit 1

default: test-all
%:
$(error Unknown command: $@)
@exit 1

TEST_RUNNER_CI ?= $(CI)
MAKEFILE_PATH ?= "./swift-package-action/Makefile"

SCHEME ?= Interception
PLATFORM ?= iOS
CONFIG ?= Debug

DERIVED_DATA="./DerivedData"

BOLD=\033[1m
RESET=\033[0m

test-all:
$(MAKE) test
$(MAKE) test-library
$(MAKE) test-library-macros
$(MAKE) test-docs

test:
$(MAKE) CONFIG=debug test-library
$(MAKE) CONFIG=debug test-library-macros
$(MAKE) test-macros

test-library:
for platform in "$(PLATFORM_IOS)" "$(PLATFORM_MACOS)" "$(PLATFORM_MAC_CATALYST)" "$(PLATFORM_TVOS)" "$(PLATFORM_WATCHOS)"; do \
echo "\nTesting library on $$platform\n" && \
(xcodebuild test \
-skipMacroValidation \
-configuration $(CONFIG) \
-workspace .github/package.xcworkspace \
-scheme InterceptionTests \
-destination platform="$$platform" | xcpretty && exit 0 \
) \
|| exit 1; \
done;
@make loop-platforms \
-f $(MAKEFILE_PATH) \
PLATFORMS="iOS,macOS,macCatalyst,watchOS,tvOS" \
GOAL="xcodebuild" \
COMMAND=test \
SCHEME=$(SCHEME) \
CONFIG=$(CONFIG) \
DERIVED_DATA=$(DERIVED_DATA)

test-library-macros:
for platform in "$(PLATFORM_IOS)" "$(PLATFORM_MACOS)" "$(PLATFORM_MAC_CATALYST)" "$(PLATFORM_TVOS)" "$(PLATFORM_WATCHOS)"; do \
echo "\nTesting library-macros on $$platform\n" && \
(xcodebuild test \
-skipMacroValidation \
-configuration $(CONFIG) \
-workspace .github/package.xcworkspace \
-scheme InterceptionMacrosTests \
-destination platform="$$platform" | xcpretty && exit 0 \
@for platform in "iOS" "macOS" "macCatalyst" "watchOS" "tvOS"; do \
echo "\n$(BOLD)Testing library macros on $$platform$(RESET)\n" && \
( \
make xcodebuild-macros \
COMMAND=test \
DERIVED_DATA=$(DERIVED_DATA) \
CONFIG=$(CONFIG) \
SCHEME="(SCHEME) \
PLATFORM="$$platform" \
) \
|| exit 1; \
done;
$(MAKE) xcodebuild-macros-plugin COMMAND=test PLATFORM=macOS

xcodebuild:
@make xcodebuild \
-f $(MAKEFILE_PATH) \
COMMAND=$(COMMAND) \
DERIVED_DATA=$(DERIVED_DATA) \
CONFIG=$(CONFIG) \
SCHEME=$(SCHEME) \
PLATFORM=$(PLATFORM)

xcodebuild-macros:
@make xcodebuild-macros \
-f $(MAKEFILE_PATH) \
COMMAND=$(COMMAND) \
DERIVED_DATA=$(DERIVED_DATA) \
CONFIG=$(CONFIG) \
SCHEME="$(SCHEME)" \
PLATFORM=$(PLATFORM)

xcodebuild-macros-plugin:
@make xcodebuild-macros-plugin \
-f $(MAKEFILE_PATH) \
COMMAND=$(COMMAND) \
DERIVED_DATA=$(DERIVED_DATA) \
CONFIG=$(CONFIG) \
SCHEME="$(SCHEME)" \
PLATFORM=$(PLATFORM)

build-for-library-evolution:
@make build-for-library-evolution \
-f $(MAKEFILE_PATH) \
SCHEME="$(SCHEME)"

test-macros:
echo "\nTesting macros\n" && \
(xcodebuild test \
-skipMacroValidation \
-configuration $(CONFIG) \
-workspace .github/package.xcworkspace \
-scheme InterceptionMacrosPluginTests \
-destination platform=macOS | xcpretty && exit 0 \
) \
|| exit 1;

DOC_WARNINGS = $(shell xcodebuild clean docbuild \
-scheme Interception \
-destination platform="$(PLATFORM_IOS)" \
-quiet \
2>&1 \
| grep "couldn't be resolved to known documentation" \
| sed 's|$(PWD)|.|g' \
| tr '\n' '\1')
test-docs:
@test "$(DOC_WARNINGS)" = "" \
|| (echo "xcodebuild docbuild failed:\n\n$(DOC_WARNINGS)" | tr '\1' '\n' \
&& exit 1)
@make test-docs \
-f $(MAKEFILE_PATH) \
SCHEME="$(SCHEME)" \
PLATFORM=$(PLATFORM)

test-example:
@make test-example \
-f $(MAKEFILE_PATH) \
DERIVED_DATA=$(DERIVED_DATA) \
SCHEME="$(SCHEME)" \
PLATFORM=$(PLATFORM)

test-integration:
@make test-integration \
-f $(MAKEFILE_PATH) \
SCHEME="Integration" \
PLATFORM=$(PLATFORM)

benchmark:
@make benchmark -f $(MAKEFILE_PATH)

define udid_for
$(shell xcrun simctl list devices available '$(1)' | grep '$(2)' | sort -r | head -1 | awk -F '[()]' '{ print $$(NF-3) }')
endef
format:
@make format -f $(MAKEFILE_PATH)
18 changes: 9 additions & 9 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,35 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-macro-testing.git",
"state" : {
"revision" : "10dcef36314ddfea6f60442169b0b320204cbd35",
"version" : "0.2.2"
"revision" : "20c1a8f3b624fb5d1503eadcaa84743050c350f4",
"version" : "0.5.2"
}
},
{
"identity" : "swift-macro-toolkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/stackotter/swift-macro-toolkit.git",
"state" : {
"revision" : "106daeb38eb3f52b1540aed981fc63fa22274576",
"version" : "0.3.1"
"revision" : "2eded9c9a98cba42d70fb179d516231fffcff1e4",
"version" : "0.5.0"
}
},
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"state" : {
"revision" : "8e68404f641300bfd0e37d478683bb275926760c",
"version" : "1.15.2"
"revision" : "7b0bbbae90c41f848f90ac7b4df6c4f50068256d",
"version" : "1.17.5"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"location" : "https://github.com/swiftlang/swift-syntax",
"state" : {
"revision" : "74203046135342e4a4a627476dd6caf8b28fe11b",
"version" : "509.0.0"
"revision" : "2bc86522d115234d1f588efe2bcb4ce4be8f8b82",
"version" : "510.0.3"
}
}
],
Expand Down
Loading
Loading