Skip to content

Latest commit

 

History

History
247 lines (169 loc) · 6.62 KB

File metadata and controls

247 lines (169 loc) · 6.62 KB

swift-package-action logo

swift-package-action/build

Set of predefined commands for building multiplatform Swift packages.

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.

Getting started 🚀

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.


with.action

The name of MAKE workflow. For additional details check out Makefile

Type:

  • required
  • optional if you just want to cache derived data

Supported values:

  • print-destination
  • warm-simulator
  • xcodebuild
  • xcodebuild-test
  • xcodebuild-raw
  • xcodebuild-test-raw
  • build-for-library-evolution
  • benchmark
    • [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.


with.xcode

Xcode version

Type: optional

Default value: 26.2

Note

To skip Select Xcode step you can explicitly set value to __unspecified__


with.cache-derived-data

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:

  • false
  • true

Note

Cache location is calculated based on

  • with.xcode
  • with.platform
  • with.subcommand
  • hash of the following files if ⌘ with.cache-derived-data-suffix is not provided
    • **/Sources/**/*.swift
    • **/Tests/**/*.swift

You can also specify:

  • with.cache-derived-data-path which is ~/.derivedData by default
  • with.cache-derived-data-prefix which is __unspecified__ aka "" by default
  • with.cache-derived-data-suffix which is __unspecified__ aka "" by default

with.workspace

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


with.scheme

Scheme/PackageTarget for the action.

<package-name>-package usually suits for building and for testing

Type:

  • required

with.platform

Target platform for the action

Type:

  • optional
  • required for the following commands
    • xcodebuild
    • xcodebuild-test
    • xcodebuild-raw
    • xcodebuild-test-raw
    • test-docs

Supported values:

  • iOS

  • macOS

  • macCatalyst

  • watchOS

  • tvOS

  • visionOS

    [!WARNING]

    This value will trigger Install visionOS runtime step. It will increase CI workflow duration and network usage

Default value: __unspecified__


with.config

Build configuration for the action.

Type: optional

Default value: Debug


with.beautify

Specifies if xcodebuild output should be beautified. Uses xcbeautify

Type: optional

Default value: quiet

Supported values:

  • quiet
  • true
  • false

with.working-directory

Relative path to target directory

Type: optional

Default value: '.'


🧩 Step examples:

Full:

- 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: '.'

Short:

- 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

Just cache derived data

- name: Cache derived data
  uses: capturecontext/swift-package-action/cache/derived-data@3.0-beta.13

📚 Workflow examples

Outdated