Update CI #6
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: test | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| macos: | |
| name: macOS | |
| runs-on: macos-26 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Swift | |
| uses: swift-actions/setup-swift@v3 | |
| with: | |
| swift-version: "6.3" | |
| - name: Run tests | |
| run: swift test | |
| darwin: | |
| name: ${{ matrix.name }} | |
| runs-on: macos-26 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: iOS | |
| destination: platform=iOS Simulator,OS=latest,name=iPhone 16 Pro | |
| - name: tvOS | |
| destination: platform=tvOS Simulator,OS=latest,name=Apple TV 4K (3rd generation) | |
| - name: watchOS | |
| destination: platform=watchOS Simulator,OS=latest,name=Apple Watch Series 10 | |
| - name: visionOS | |
| destination: platform=visionOS Simulator,OS=latest,name=Apple Vision Pro | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Swift | |
| uses: swift-actions/setup-swift@v3 | |
| with: | |
| swift-version: "6.3" | |
| - name: Run tests | |
| run: | | |
| xcodebuild test \ | |
| -scheme compression \ | |
| -destination '${{ matrix.destination }}' | |
| linux: | |
| name: Linux (${{ matrix.name }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: "6.3" | |
| container: "swift:6.3" | |
| test-args: "-Xswiftc -warnings-as-errors | |
| --explicit-target-dependency-import-check error" | |
| - name: "nightly-main" | |
| container: "swiftlang/swift:nightly-main-jammy" | |
| test-args: "" | |
| runs-on: ubuntu-latest | |
| container: ${{ matrix.container }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Run tests | |
| run: swift test ${{ matrix.test-args }} | |
| linux-musl: | |
| runs-on: ubuntu-latest | |
| container: swift:6.3 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Install Swift SDK for Linux Musl | |
| run: | | |
| apt-get update -y -q && apt-get install -y -q curl jq | |
| version_num="$(swiftc --version | grep -oE '[0-9]+\.[0-9]+(\.[0-9]+)?' | head -1)" | |
| tag="swift-${version_num}-RELEASE" | |
| sdk_info="$(curl -s https://www.swift.org/api/v1/install/releases.json | jq -r --arg tag "$tag" '.[] | select(.tag == $tag).platforms[] | select(.platform == "static-sdk") | [.version, .checksum] | @tsv')" | |
| version="$(echo "$sdk_info" | cut -f1)" | |
| checksum="$(echo "$sdk_info" | cut -f2)" | |
| swift sdk install "https://download.swift.org/$(echo $tag | tr [A-Z] [a-z])/static-sdk/$tag/${tag}_static-linux-${version}.artifactbundle.tar.gz" --checksum "$checksum" | |
| - name: Build for Linux Musl | |
| run: swift build --swift-sdk x86_64-swift-linux-musl | |
| wasm: | |
| runs-on: ubuntu-latest | |
| container: swift:6.3 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Install WebAssembly SDK | |
| run: | | |
| apt-get update -y -q && apt-get install -y -q curl jq | |
| tag="$(swiftc --version | grep -Po '(?<=\().+(?=\))')" | |
| checksum="$(curl -s https://www.swift.org/api/v1/install/releases.json | \ | |
| jq -r --arg tag "$tag" '.[] | select(.tag == $tag).platforms[] | select(.platform == "wasm-sdk").checksum // empty')" | |
| swift sdk install https://download.swift.org/$(echo $tag | tr [A-Z] [a-z])/wasm-sdk/$tag/"$tag"_wasm.artifactbundle.tar.gz --checksum $checksum | |
| - name: Build for WebAssembly | |
| run: | | |
| tag="$(swiftc --version | grep -Po '(?<=\().+(?=\))')" | |
| swift build --swift-sdk "$tag"_wasm | |
| windows: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| swift-version: | |
| - 6.3 | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Swift for Windows | |
| uses: compnerd/gha-setup-swift@main | |
| with: | |
| branch: swift-${{ matrix.swift-version }}-release | |
| tag: ${{ matrix.swift-version }}-RELEASE | |
| - name: Build and test | |
| run: swift test | |
| android: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| swift-version: | |
| - 6.3 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Swift for Android | |
| uses: skiptools/swift-android-action@v2 | |
| with: | |
| swift-version: ${{ matrix.swift-version }} | |
| free-disk-space: true |