name: Tests # builds.sr.ht is the canonical CI for this project, but it has no macOS images # and will not add them, so xcodebuild cannot run there. This job exists to run # the test plan on the GitHub mirror; see builds/swift-ci.yml for the rest. # Prose only: the root docs (*.md, *.txt, README.nfo, LICENSE) and Docs/*.md. # The globs are single-star, so they match the repo root and Docs/ and nothing # deeper — a .md or .txt that ever lands inside a source directory still runs # the suite. A skip rule that is too broad is how a real change slips through # ungated. paths-ignore skips the run only when *all* changed files match, so a # doc edit alongside code still tests. # # pull_request only, by design. GitHub runs the suite against the merge result # (PR merged into main), so a green PR already validates exactly what lands on # main. Merges here are merge commits, not squash, so the merged main is the same # tree that was tested — re-running on push to main would only burn a macOS runner # to re-confirm a result we already have. # # The tradeoff: a non-docs change pushed straight to main (bypassing a PR) is not # tested. That is not how this repo works — only docs go direct to main, and those # are path-skipped anyway. # # Safe as pull_request-only because main has no required status checks: a run # skipped by a path filter never reports, so a required check would leave a # docs-only PR waiting forever. on: pull_request: paths-ignore: ['*.md', '*.txt', 'README.nfo', 'LICENSE', 'Docs/*.md'] workflow_dispatch: # Without this, GITHUB_TOKEN inherits the repository default, which is # read-write for anything created before February 2023. The job only reads code. permissions: contents: read concurrency: group: tests-${{ github.ref }} cancel-in-progress: true jobs: test: name: xcodebuild test # macos-latest still points at macOS 15, which lacks the iOS 26 SDK. runs-on: macos-26 steps: - uses: actions/checkout@v7 - name: Show toolchain run: | xcodebuild -version swift --version - name: Select simulator id: sim run: | set -euo pipefail udid=$(xcrun simctl list devices available --json \ | jq -r '[.devices[][] | select(.name | startswith("iPhone"))] | first | .udid') if [ -z "$udid" ] || [ "$udid" = "null" ]; then echo "No available iPhone simulator on this image" >&2 xcrun simctl list devices available >&2 exit 1 fi echo "udid=$udid" >> "$GITHUB_OUTPUT" - name: Test run: | set -o pipefail xcodebuild test \ -project Hutch.xcodeproj \ -scheme Hutch \ -testPlan HutchTests \ -destination "id=${{ steps.sim.outputs.udid }}" \ -resultBundlePath TestResults.xcresult \ CODE_SIGNING_ALLOWED=NO - name: Upload results if: failure() uses: actions/upload-artifact@v4 with: name: test-results path: TestResults.xcresult retention-days: 7