https://github.com/sushichop/gha-swift-env
A GitHub Action that sets up a Swift environment for cross-platform
https://github.com/sushichop/gha-swift-env
actions cmake cross-platform env github-actions ninja swift
Last synced: about 2 months ago
JSON representation
A GitHub Action that sets up a Swift environment for cross-platform
- Host: GitHub
- URL: https://github.com/sushichop/gha-swift-env
- Owner: sushichop
- License: mit
- Created: 2022-02-12T09:11:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-28T22:52:38.000Z (4 months ago)
- Last Synced: 2025-02-20T16:49:41.556Z (3 months ago)
- Topics: actions, cmake, cross-platform, env, github-actions, ninja, swift
- Language: Shell
- Homepage:
- Size: 43 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gha-swift-env
[](https://github.com/marketplace/actions/swift-env)
[](https://github.com/sushichop/gha-swift-env/releases)

[](https://github.com/sushichop/gha-swift-env/blob/main/LICENSE)`gha-swift-env` is a GitHub Action that sets up Swift environment for **cross-platform(macOS, Ubuntu Linux, and Windows)**.
## Usage
You can set the release version of Swift.
```yaml
- uses: sushichop/gha-swift-env@v1
with:
swift-version: '6.0.3'
- name: Show Swift version and build Swift package
run: |
swift --version
swift build -v -c release
```You can also set the snapshot version of Swift.
```yaml
- uses: sushichop/gha-swift-env@v1
with:
swift-version: '2025-01-10-a'
- name: Show Swift version and build Swift package
run: |
swift --version
swift build -v -c release
```## Example
You can build and test Swift package for cross-platform(macOS, Ubuntu Linux, and Windows).
```yaml
on
pull_request:jobs:
swiftpm:
name: SwiftPM - Swift ${{ matrix.swift-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['macos-14', 'ubuntu-22.04', 'windows-2022']
swift-version: ['6.0.3', '5.10', '2025-01-10-a']
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: sushichop/gha-swift-env@V1
with:
swift-version: ${{ matrix.swift-version }}
- name: Build and test a Swift package
run: |
swift build -v -c release
swift test -v -Xswiftc -warnings-as-errors
```## Inputs
- `swift-version` – (required) Swift version to use
- Specify release or snapshot version
- `'5.10'`, `'6.0.3'`, `'2025-01-10-a'`, ...
- Default
- `'6.0.3'`- `winsdk-version` – (optional) WinSDK to use on Windows
- Specify Windows 10 SDK version
- `''`, `'10.0.26100.0'`, ...
- Default:
- `''`
- This value(an empty string) sets the default Windows 10 SDK version## License
`gha-swift-env` is available under the [MIT license](http://www.opensource.org/licenses/mit-license). See the LICENSE file for details.