hassila / install-swift

GitHub Action to install a version of Swift 🏎

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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, or a development snapshot like swift-DEVELOPMENT-SNAPSHOT-2021-11-12-a.

Example

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

- 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 to spawn multiple instances of the same job:

jobs:
  test:
    name: Run Tests
    strategy:
      matrix:
        swift: [5.5, swift-DEVELOPMENT-SNAPSHOT-2021-11-12-a]
        ubuntu: [ubuntu-18.04, ubuntu-20.04]
        fail-fast: false
    runs-on: ${{ matrix.ubuntu }}
    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 and the detected Ubuntu version.

About

GitHub Action to install a version of Swift 🏎


Languages

Language:Shell 100.0%