krz/hutch

an ios client for sourcehut

clone: git clone https://gitbay.org/krz/hutch.git

v3.5.0: .github/workflows/test.yml · raw

 1name: Tests
 2
 3# builds.sr.ht is the canonical CI for this project, but it has no macOS images
 4# and will not add them, so xcodebuild cannot run there. This job exists to run
 5# the test plan on the GitHub mirror; see builds/swift-ci.yml for the rest.
 6on:
 7  push:
 8    branches: [main]
 9  pull_request:
10  workflow_dispatch:
11
12concurrency:
13  group: tests-${{ github.ref }}
14  cancel-in-progress: true
15
16jobs:
17  test:
18    name: xcodebuild test
19    # macos-latest still points at macOS 15, which lacks the iOS 26 SDK.
20    runs-on: macos-26
21
22    steps:
23      - uses: actions/checkout@v4
24
25      - name: Show toolchain
26        run: |
27          xcodebuild -version
28          swift --version
29
30      - name: Select simulator
31        id: sim
32        run: |
33          set -euo pipefail
34          udid=$(xcrun simctl list devices available --json \
35            | jq -r '[.devices[][] | select(.name | startswith("iPhone"))] | first | .udid')
36          if [ -z "$udid" ] || [ "$udid" = "null" ]; then
37            echo "No available iPhone simulator on this image" >&2
38            xcrun simctl list devices available >&2
39            exit 1
40          fi
41          echo "udid=$udid" >> "$GITHUB_OUTPUT"
42
43      - name: Test
44        run: |
45          set -o pipefail
46          xcodebuild test \
47            -project Hutch.xcodeproj \
48            -scheme Hutch \
49            -testPlan HutchTests \
50            -destination "id=${{ steps.sim.outputs.udid }}" \
51            -resultBundlePath TestResults.xcresult \
52            CODE_SIGNING_ALLOWED=NO
53
54      - name: Upload results
55        if: failure()
56        uses: actions/upload-artifact@v4
57        with:
58          name: test-results
59          path: TestResults.xcresult
60          retention-days: 7