Enable building with the Swift Linux SDK (#151) #334
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
name: CI | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
test: | |
timeout-minutes: 5 | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest] | |
swift-version: | |
- 6.0.3 | |
- 6.1.0 | |
runs-on: ${{ matrix.os }} | |
name: Test (${{ matrix.os }}, Swift ${{ matrix.swift-version }}) | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Swift on Linux | |
if: matrix.os == 'ubuntu-latest' | |
uses: vapor/[email protected] | |
with: | |
toolchain: ${{ matrix.swift-version }} | |
- name: Setup Swift on macOS | |
if: matrix.os == 'macos-latest' | |
uses: swift-actions/setup-swift@v2 | |
with: | |
swift-version: ${{ matrix.swift-version }} | |
- name: Build | |
run: swift build -v | |
- name: Run tests | |
run: swift test -v | |
static-linux-sdk-build: | |
name: Linux Static SDK Build (${{ matrix.swift-version }} - ${{ matrix.os }}) | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
swift-version: | |
- 6.1.2 | |
runs-on: ${{ matrix.os }} | |
container: swift:${{ matrix.swift-version }}-noble | |
timeout-minutes: 30 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install static SDK and build | |
env: | |
BUILD_FLAGS: "" | |
run: | | |
which curl || (apt -q update && apt -yq install curl) | |
curl -s --retry 3 https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/install-and-build-with-sdk.sh | \ | |
bash -s -- --static --flags="$BUILD_FLAGS" ${{ matrix.swift-version }} |