Skip to content

Swift Env

Actions
A GitHub Action that sets up a Swift environment for cross-platform
v1.0.5
Latest
Star (2)

gha-swift-env

GitHub Marketplace release CI 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.

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

- 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).

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. See the LICENSE file for details.

Swift Env is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

A GitHub Action that sets up a Swift environment for cross-platform
v1.0.5
Latest

Swift Env is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.