krz/hutch

an ios client for sourcehut

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

v3.8.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 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# Safe on pull_request only because main has no required status checks: a run
12# skipped by a path filter never reports, so a required check would leave a
13# docs-only PR waiting forever.
14on:
15  push:
16    branches: [main]
17    paths-ignore: ['*.md', 'Docs/*.md']
18  pull_request:
19    paths-ignore: ['*.md', 'Docs/*.md']
20  workflow_dispatch:
21
22# Without this, GITHUB_TOKEN inherits the repository default, which is
23# read-write for anything created before February 2023. The job only reads code.
24permissions:
25  contents: read
26
27concurrency:
28  group: tests-${{ github.ref }}
29  cancel-in-progress: true
30
31jobs:
32  test:
33    name: xcodebuild test
34    # macos-latest still points at macOS 15, which lacks the iOS 26 SDK.
35    runs-on: macos-26
36
37    steps:
38      - uses: actions/checkout@v7
39
40      - name: Show toolchain
41        run: |
42          xcodebuild -version
43          swift --version
44
45      - name: Select simulator
46        id: sim
47        run: |
48          set -euo pipefail
49          udid=$(xcrun simctl list devices available --json \
50            | jq -r '[.devices[][] | select(.name | startswith("iPhone"))] | first | .udid')
51          if [ -z "$udid" ] || [ "$udid" = "null" ]; then
52            echo "No available iPhone simulator on this image" >&2
53            xcrun simctl list devices available >&2
54            exit 1
55          fi
56          echo "udid=$udid" >> "$GITHUB_OUTPUT"
57
58      - name: Test
59        run: |
60          set -o pipefail
61          xcodebuild test \
62            -project Hutch.xcodeproj \
63            -scheme Hutch \
64            -testPlan HutchTests \
65            -destination "id=${{ steps.sim.outputs.udid }}" \
66            -resultBundlePath TestResults.xcresult \
67            CODE_SIGNING_ALLOWED=NO
68
69      - name: Upload results
70        if: failure()
71        uses: actions/upload-artifact@v4
72        with:
73          name: test-results
74          path: TestResults.xcresult
75          retention-days: 7