-
Notifications
You must be signed in to change notification settings - Fork 0
Add GitHub Actions CI: macOS, iOS, Linux, Windows, Android #3
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| --- | ||
| name: Swift | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| env: | ||
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | ||
|
|
||
| jobs: | ||
|
|
||
| build-macos: | ||
| runs-on: macos-latest | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| # macos-latest currently ships Xcode 16 / Swift 6.1; ShellKit's | ||
| # swift-subprocess dep needs the 6.1 toolchain, but bumping to | ||
| # Xcode 26 keeps us aligned with the SwiftBash workflow and gets | ||
| # us Swift 6.2 (matching the toolchain SwiftPorts targets). | ||
| - name: Select Xcode 26.0 | ||
| uses: maxim-lobanov/setup-xcode@v1 | ||
| with: | ||
| xcode-version: "26.0" | ||
| - name: Verify Swift version | ||
| run: swift --version | ||
| - name: Build (macOS) | ||
| run: swift build --build-tests -v | ||
| - name: Test (macOS) | ||
| run: swift test -v --skip-build --no-parallel | ||
|
|
||
| build-ios: | ||
| # Compile-only check on `generic/platform=iOS`. swift-subprocess is | ||
| # platform-gated out on iOS / tvOS / watchOS / visionOS (kernel | ||
| # forbids posix_spawn / fork) — this job verifies the | ||
| # `#if canImport(Subprocess)` gates in `DefaultProcessLauncher` | ||
| # compile cleanly against the iOS SDK. | ||
| runs-on: macos-latest | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Select Xcode 26.0 | ||
| uses: maxim-lobanov/setup-xcode@v1 | ||
| with: | ||
| xcode-version: "26.0" | ||
| - name: Build (iOS — all package targets) | ||
| run: | | ||
| xcodebuild \ | ||
| -scheme ShellKit \ | ||
| -destination 'generic/platform=iOS' \ | ||
| build | ||
|
|
||
| build-linux: | ||
| # Linux: full build + test. ShellKit has no C-library deps | ||
| # (swift-argument-parser + swift-subprocess are pure Swift), so | ||
| # there's nothing to apt-get install — the swiftlang/swift base | ||
| # image's libc-dev is enough. | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Verify Swift version | ||
| run: swift --version | ||
| - name: Build (Linux) | ||
| run: swift build --build-tests -v | ||
| - name: Test (Linux) | ||
| run: swift test -v --skip-build --no-parallel | ||
|
|
||
| build-windows: | ||
| # Windows: full build + test. Again no C-library deps, so no vcpkg | ||
| # provisioning needed (unlike SwiftBash, which pulls in libgit2 / | ||
| # libbz2 / liblzma / libzstd / liblz4 transitively via SwiftPorts). | ||
| runs-on: windows-latest | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Setup Swift | ||
| uses: SwiftyLab/setup-swift@latest | ||
| with: | ||
| swift-version: "6.3.1" | ||
| - name: Verify Swift version | ||
| run: swift --version | ||
| - name: Build (Windows) | ||
| shell: pwsh | ||
| run: swift build --build-tests -v | ||
| - name: Test (Windows) | ||
| shell: pwsh | ||
| run: swift test -v --skip-build --no-parallel | ||
|
|
||
| # Uses skiptools/swift-android-action which wraps the swift.org Android | ||
| # SDK setup AND runs the SwiftPM tests on an x86_64 Android emulator. | ||
| # No `container:` here — the action provisions its own toolchain and | ||
| # the emulator setup needs nested KVM, which only works on the bare | ||
| # ubuntu-* runner image. | ||
| build-android: | ||
| runs-on: ubuntu-latest | ||
| # First cold run = ~25 min (SDK + NDK + emulator boot dominates); | ||
| # cached subsequent runs are ~5 min. 30 min covers both with a | ||
| # comfortable margin. | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Build & Test (Android emulator) | ||
| uses: skiptools/swift-android-action@v2 | ||
| with: | ||
| swift-version: "6.3" | ||
| # The default GitHub Linux runner has ~14 GiB free; the SDK, | ||
| # NDK, and emulator together push past that without cleanup. | ||
| free-disk-space: true | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setup-xcodeonly switches among Xcode versions that are already installed on the selected runner image, but this job requestsxcode-version: "26.0"while usingruns-on: macos-latest; whenmacos-latestpoints to an older image, both the macOS and iOS jobs fail before build/test starts. The GitHub runner docs explicitly note that-latestis not guaranteed to be the newest OS image, so this workflow is brittle unless you pinruns-onto a macOS 26 label (or relax to a version guaranteed onmacos-latest).Useful? React with 👍 / 👎.