If you develop a bunch swift packages it may be tricky to keep CI clean and updated for all of them, but a dedicated action can reduce code duplication and simplify CI support. This repository was inspired by CI setup of The Composable Architecture.
You can include the action in your workflow to trigger on any event that GitHub actions supports.
The with portion of the workflow must be configured for the action.
The name of MAKE workflow. For additional details check out Makefile
Type:
requiredoptionalif you just want to cache derived data
Supported values:
print-destinationwarm-simulatorxcodebuildxcodebuild-testxcodebuild-rawxcodebuild-test-rawbuild-for-library-evolutionbenchmark- [
unchecked,experimental], please submit an issue if you face any
- [
test-docs- [
unchecked,experimental], please submit an issue if you face any
- [
Note
Commands with unchecked and experimental tags are in "todo" for verification. These flags mean that at some point these commands were used locally, but their use on CI was not validated. Currently we're in the process of migrating our repos to this action, but not every package uses these commands. However any potential issues for those commands should be fixed soon.
Xcode version
Type: optional
Default value: 26.2
Note
To skip Select Xcode step you can explicitly set value to __unspecified__
Argument that specifies if action should cache DerivedData, if you only want to cache derived data use with.command: cache-derived-data or a dedicated subaction swift-package-action/cache/derived-data
Type: optional
Default value: false
Supported values:
falsetrue
Note
Cache location is calculated based on
with.xcodewith.platformwith.subcommand- hash of the following files if ⌘
with.cache-derived-data-suffixis not provided**/Sources/**/*.swift**/Tests/**/*.swift
You can also specify:
- ⌘
with.cache-derived-data-pathwhich is~/.derivedDataby default - ⌘
with.cache-derived-data-prefixwhich is__unspecified__aka""by default - ⌘
with.cache-derived-data-suffixwhich is__unspecified__aka""by default
Path to xcworkspace. It is recommended to create a workspace at the root of the package and ensure that all required schemes are present.
Type: optional
Default value: .swiftpm/xcode/package.xcworkspace
Scheme/PackageTarget for the action.
<package-name>-packageusually suits for building and for testing
Type:
required
Target platform for the action
Type:
optionalrequiredfor the following commandsxcodebuildxcodebuild-testxcodebuild-rawxcodebuild-test-rawtest-docs
Supported values:
-
iOS -
macOS -
macCatalyst -
watchOS -
tvOS -
visionOS[!WARNING]
This value will trigger
Install visionOS runtimestep. It will increase CI workflow duration and network usage
Default value: __unspecified__
Build configuration for the action.
Type: optional
Default value: Debug
Specifies if xcodebuild output should be beautified. Uses xcbeautify
Type: optional
Default value: quiet
Supported values:
quiettruefalse
Relative path to target directory
Type: optional
Default value: '.'
- name: Test CoolStuff
uses: capturecontext/swift-package-action/build@3.0-beta.13
with:
xcode: 26.2
workspace: Package.xcworkspace # custom workspace at the root of a repo
cache-derived-data: true
action: xcodebuild-test
scheme: cool-stuff-package # likely to be a name of the package
platform: iOS
config: Debug
beautify: true
working-directory: '.'- name: Test CoolStuff
uses: capturecontext/swift-package-action/build@3.0-beta.13
with:
workspace: Package.xcworkspace
cache-derived-data: true
action: xcodebuild-test
scheme: cool-stuff-package
platform: iOS- name: Cache derived data
uses: capturecontext/swift-package-action/cache/derived-data@3.0-beta.13capturecontext/cocoa-aliasescapturecontext/swift-equatedcapturecontext/swift-hashedcapturecontext/swift-marker-protocolscapturecontext/swift-keypaths-extensionscapturecontext/swift-interceptioncapturecontext/combine-interceptioncapturecontext/combine-cocoacapturecontext/swift-declarative-configurationcapturecontext/swift-associated-objectscapturecontext/swift-foundation-extensions
swift-existential-containerswift-composable-architecture
