|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + |
| 10 | +jobs: |
| 11 | + linux: |
| 12 | + name: Linux (Swift ${{ matrix.swift }}, ${{ matrix.configuration }}) |
| 13 | + runs-on: ubuntu-24.04 |
| 14 | + container: swift:${{ matrix.swift }}-noble |
| 15 | + timeout-minutes: 30 |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + # The oldest supported Swift (swift-tools-version 6.2) and the newest. |
| 20 | + swift: ["6.2", "6.4"] |
| 21 | + configuration: [debug, release] |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v7 |
| 24 | + |
| 25 | + - name: Install SQLite |
| 26 | + run: | |
| 27 | + apt-get update |
| 28 | + apt-get install -y --no-install-recommends pkg-config libsqlite3-dev |
| 29 | +
|
| 30 | + - name: Toolchain |
| 31 | + run: swift --version |
| 32 | + |
| 33 | + - name: Build (warnings are errors) |
| 34 | + run: | |
| 35 | + flags="-c ${{ matrix.configuration }} -Xswiftc -warnings-as-errors" |
| 36 | + # @testable imports need testing enabled in an optimized build. |
| 37 | + [ "${{ matrix.configuration }}" = release ] && flags="$flags -Xswiftc -enable-testing" |
| 38 | + echo "FLAGS=$flags" >> "$GITHUB_ENV" |
| 39 | + swift build --build-tests $flags |
| 40 | +
|
| 41 | + - name: Test |
| 42 | + run: swift test $FLAGS |
| 43 | + |
| 44 | + macos: |
| 45 | + name: macOS (Xcode ${{ matrix.xcode }}, ${{ matrix.configuration }}) |
| 46 | + runs-on: macos-26 |
| 47 | + timeout-minutes: 30 |
| 48 | + strategy: |
| 49 | + fail-fast: false |
| 50 | + matrix: |
| 51 | + # The oldest Xcode with Swift 6.2, and the runner's default. |
| 52 | + xcode: ["26.0.1", "26.6"] |
| 53 | + configuration: [debug, release] |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v7 |
| 56 | + |
| 57 | + - name: Select Xcode |
| 58 | + run: | |
| 59 | + sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app |
| 60 | + swift --version |
| 61 | +
|
| 62 | + - name: Build (warnings are errors) |
| 63 | + run: | |
| 64 | + flags="-c ${{ matrix.configuration }} -Xswiftc -warnings-as-errors" |
| 65 | + # @testable imports need testing enabled in an optimized build. |
| 66 | + [ "${{ matrix.configuration }}" = release ] && flags="$flags -Xswiftc -enable-testing" |
| 67 | + echo "FLAGS=$flags" >> "$GITHUB_ENV" |
| 68 | + swift build --build-tests $flags |
| 69 | +
|
| 70 | + - name: Test |
| 71 | + run: swift test $FLAGS |
| 72 | + |
| 73 | + ios: |
| 74 | + name: iOS Simulator |
| 75 | + runs-on: macos-26 |
| 76 | + timeout-minutes: 30 |
| 77 | + steps: |
| 78 | + - uses: actions/checkout@v7 |
| 79 | + |
| 80 | + - name: Select Xcode |
| 81 | + run: | |
| 82 | + sudo xcode-select -s /Applications/Xcode_26.6.app |
| 83 | + xcodebuild -version |
| 84 | +
|
| 85 | + # The test target builds at the package's iOS 15 deployment target, so this also |
| 86 | + # catches APIs that need a newer iOS. No SWIFT_TREAT_WARNINGS_AS_ERRORS: Xcode builds the |
| 87 | + # Perfect-CRUD dependency with warnings suppressed, and the two flags conflict. The macOS |
| 88 | + # and Linux jobs check warnings. |
| 89 | + - name: Test |
| 90 | + run: | |
| 91 | + xcodebuild test -scheme PerfectSQLite \ |
| 92 | + -destination 'platform=iOS Simulator,name=iPhone 17,OS=latest' |
0 commit comments