krz/hutch
an ios client for sourcehut
clone: git clone https://gitbay.org/krz/hutch.git
v3.11.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.
6# Prose only: the root docs (*.md, *.txt, README.nfo, LICENSE) and Docs/*.md.
7# The globs are single-star, so they match the repo root and Docs/ and nothing
8# deeper — a .md or .txt that ever lands inside a source directory still runs
9# the suite. A skip rule that is too broad is how a real change slips through
10# ungated. paths-ignore skips the run only when *all* changed files match, so a
11# doc edit alongside code still tests.
12#
13# pull_request only, by design. GitHub runs the suite against the merge result
14# (PR merged into main), so a green PR already validates exactly what lands on
15# main. Merges here are merge commits, not squash, so the merged main is the same
16# tree that was tested — re-running on push to main would only burn a macOS runner
17# to re-confirm a result we already have.
18#
19# The tradeoff: a non-docs change pushed straight to main (bypassing a PR) is not
20# tested. That is not how this repo works — only docs go direct to main, and those
21# are path-skipped anyway.
22#
23# Safe as pull_request-only because main has no required status checks: a run
24# skipped by a path filter never reports, so a required check would leave a
25# docs-only PR waiting forever.
26on:
27 pull_request:
28 paths-ignore: ['*.md', '*.txt', 'README.nfo', 'LICENSE', 'Docs/*.md']
29 workflow_dispatch:
30
31# Without this, GITHUB_TOKEN inherits the repository default, which is
32# read-write for anything created before February 2023. The job only reads code.
33permissions:
34 contents: read
35
36concurrency:
37 group: tests-${{ github.ref }}
38 cancel-in-progress: true
39
40jobs:
41 test:
42 name: xcodebuild test
43 # macos-latest still points at macOS 15, which lacks the iOS 26 SDK.
44 runs-on: macos-26
45
46 steps:
47 - uses: actions/checkout@v7
48
49 - name: Show toolchain
50 run: |
51 xcodebuild -version
52 swift --version
53
54 - name: Select simulator
55 id: sim
56 run: |
57 set -euo pipefail
58 udid=$(xcrun simctl list devices available --json \
59 | jq -r '[.devices[][] | select(.name | startswith("iPhone"))] | first | .udid')
60 if [ -z "$udid" ] || [ "$udid" = "null" ]; then
61 echo "No available iPhone simulator on this image" >&2
62 xcrun simctl list devices available >&2
63 exit 1
64 fi
65 echo "udid=$udid" >> "$GITHUB_OUTPUT"
66
67 - name: Test
68 run: |
69 set -o pipefail
70 xcodebuild test \
71 -project Hutch.xcodeproj \
72 -scheme Hutch \
73 -testPlan HutchTests \
74 -destination "id=${{ steps.sim.outputs.udid }}" \
75 -resultBundlePath TestResults.xcresult \
76 CODE_SIGNING_ALLOWED=NO
77
78 - name: Upload results
79 if: failure()
80 uses: actions/upload-artifact@v4
81 with:
82 name: test-results
83 path: TestResults.xcresult
84 retention-days: 7