krz/hutch
an ios client for sourcehut
clone: git clone https://gitbay.org/krz/hutch.git
main: .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 # Runs on Linux because it only reads source. Accessibility labels cannot be
42 # checked from a build — the app compiles either way — and a UI test only sees
43 # screens it can reach. This sees every view file, in seconds, with no
44 # simulator and no credentials.
45 accessibility:
46 name: accessibility labels
47 runs-on: ubuntu-latest
48
49 steps:
50 - uses: actions/checkout@v7
51 - run: python3 scripts/check_accessibility.py
52
53 test:
54 name: xcodebuild test
55 # macos-latest still points at macOS 15, which lacks the iOS 26 SDK.
56 runs-on: macos-26
57
58 steps:
59 - uses: actions/checkout@v7
60
61 - name: Show toolchain
62 run: |
63 xcodebuild -version
64 swift --version
65
66 - name: Select simulator
67 id: sim
68 run: |
69 set -euo pipefail
70 udid=$(xcrun simctl list devices available --json \
71 | jq -r '[.devices[][] | select(.name | startswith("iPhone"))] | first | .udid')
72 if [ -z "$udid" ] || [ "$udid" = "null" ]; then
73 echo "No available iPhone simulator on this image" >&2
74 xcrun simctl list devices available >&2
75 exit 1
76 fi
77 echo "udid=$udid" >> "$GITHUB_OUTPUT"
78
79 - name: Test
80 run: |
81 set -o pipefail
82 xcodebuild test \
83 -project Hutch.xcodeproj \
84 -scheme Hutch \
85 -testPlan HutchTests \
86 -destination "id=${{ steps.sim.outputs.udid }}" \
87 -resultBundlePath TestResults.xcresult \
88 CODE_SIGNING_ALLOWED=NO
89
90 - name: Upload results
91 if: failure()
92 uses: actions/upload-artifact@v4
93 with:
94 name: test-results
95 path: TestResults.xcresult
96 retention-days: 7