krz/hutch
an ios client for sourcehut
clone: git clone https://gitbay.org/krz/hutch.git
v3.6.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
12# Without this, GITHUB_TOKEN inherits the repository default, which is
13# read-write for anything created before February 2023. The job only reads code.
14permissions:
15 contents: read
16
17concurrency:
18 group: tests-${{ github.ref }}
19 cancel-in-progress: true
20
21jobs:
22 test:
23 name: xcodebuild test
24 # macos-latest still points at macOS 15, which lacks the iOS 26 SDK.
25 runs-on: macos-26
26
27 steps:
28 - uses: actions/checkout@v7
29
30 - name: Show toolchain
31 run: |
32 xcodebuild -version
33 swift --version
34
35 - name: Select simulator
36 id: sim
37 run: |
38 set -euo pipefail
39 udid=$(xcrun simctl list devices available --json \
40 | jq -r '[.devices[][] | select(.name | startswith("iPhone"))] | first | .udid')
41 if [ -z "$udid" ] || [ "$udid" = "null" ]; then
42 echo "No available iPhone simulator on this image" >&2
43 xcrun simctl list devices available >&2
44 exit 1
45 fi
46 echo "udid=$udid" >> "$GITHUB_OUTPUT"
47
48 - name: Test
49 run: |
50 set -o pipefail
51 xcodebuild test \
52 -project Hutch.xcodeproj \
53 -scheme Hutch \
54 -testPlan HutchTests \
55 -destination "id=${{ steps.sim.outputs.udid }}" \
56 -resultBundlePath TestResults.xcresult \
57 CODE_SIGNING_ALLOWED=NO
58
59 - name: Upload results
60 if: failure()
61 uses: actions/upload-artifact@v4
62 with:
63 name: test-results
64 path: TestResults.xcresult
65 retention-days: 7