https://github.com/slashmo/install-swift
GitHub Action to install a version of Swift 🏎
https://github.com/slashmo/install-swift
ci github-actions install-swift swift
Last synced: about 1 year ago
JSON representation
GitHub Action to install a version of Swift 🏎
- Host: GitHub
- URL: https://github.com/slashmo/install-swift
- Owner: slashmo
- Created: 2021-11-16T19:46:28.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-26T11:35:56.000Z (almost 2 years ago)
- Last Synced: 2025-04-13T02:07:30.501Z (about 1 year ago)
- Topics: ci, github-actions, install-swift, swift
- Language: Shell
- Homepage:
- Size: 21.5 KB
- Stars: 25
- Watchers: 2
- Forks: 7
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# install-swift
This action allows installing Swift toolchains, with support for both release and development versions.
## Usage
### Inputs
- `version` - The Swift version you want to install. This may either be a release version like `5.5`, a trunk
development snapshot like `swift-DEVELOPMENT-SNAPSHOT-2021-11-12-a`, or a snapshot of the upcoming release, e.g.
`swift-5.6-DEVELOPMENT-SNAPSHOT-2022-01-09-a`.
### Example
```yaml
- name: Install Swift
uses: slashmo/install-swift@v0.1.0
with:
version: 5.5
```
After adding this step, all following steps in this job will automatically use the newly installed Swift version:
```yaml
- name: Run Tests
run: swift test # <-- uses Swift 5.5
```
### Multiple Swift Versions
In case you want to run your GitHub Actions workflow using different versions of Swift, define a
[GitHub Action's matrix](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix)
to spawn multiple instances of the same job:
```yaml
jobs:
test:
name: Run Tests
strategy:
matrix:
swift: [5.5, swift-DEVELOPMENT-SNAPSHOT-2021-11-12-a, swift-5.6-DEVELOPMENT-SNAPSHOT-2022-01-09-a]
os: [ubuntu-18.04, ubuntu-20.04, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Install Swift
uses: slashmo/install-swift@v0.1.0
with:
version: ${{ matrix.swift }}
- name: Checkout
uses: actions/checkout@v2
- name: Run Tests
run: swift test
```
The action will automatically detect the Ubuntu version and install the correct toolchain.
### Caching
`install-swift` automatically caches toolchains based on the [version input](#inputs) and the detected Ubuntu version.