krz/hutch

an ios client for sourcehut

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

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