Skip to content

Commit 54eb4ce

Browse files
ksroda-saclaude
andcommitted
chore(ci): add per-workflow aggregator jobs and iOS test workflow
Each existing test workflow (test-android, test-dotnet, test-java, test-js) now ends with an `<framework> tests passed` aggregator job that needs the matrix and runs with `if: always()`. This collapses the variable number of per-sample matrix entries into one stable check name, so branch protection or rulesets only need to track 5 names regardless of how many samples exist. Adds .github/workflows/test-ios.yml — same find-projects + matrix + aggregator shape as the others, runs on macos-latest. Discovers iOS samples via project.yml (the xcodegen input is the authoritative source). The xcodebuild test step picks an iPhone simulator at runtime via xcrun simctl rather than hard-coding a device name, so the workflow keeps working as GitHub-hosted runner images get updated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b8b0ce4 commit 54eb4ce

5 files changed

Lines changed: 141 additions & 0 deletions

File tree

.github/workflows/test-android.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,14 @@ jobs:
100100
- name: assembleDebug
101101
working-directory: ${{ matrix.android_dir }}
102102
run: ./gradlew assembleDebug --no-daemon
103+
104+
# Stable aggregator for branch protection.
105+
all-tests-passed:
106+
name: Android tests passed
107+
needs: build
108+
if: always()
109+
runs-on: ubuntu-latest
110+
steps:
111+
- name: Verify build matrix succeeded
112+
if: needs.build.result != 'success' && needs.build.result != 'skipped'
113+
run: exit 1

.github/workflows/test-dotnet.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,14 @@ jobs:
5050
- name: Test
5151
working-directory: ${{ matrix.project }}
5252
run: dotnet test --no-build --configuration Release
53+
54+
# Stable aggregator for branch protection.
55+
all-tests-passed:
56+
name: .NET tests passed
57+
needs: test
58+
if: always()
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: Verify test matrix succeeded
62+
if: needs.test.result != 'success' && needs.test.result != 'skipped'
63+
run: exit 1

.github/workflows/test-ios.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Test iOS Builds
2+
3+
on:
4+
push:
5+
paths:
6+
- "samples/ios/**"
7+
- ".github/workflows/test-ios.yml"
8+
pull_request:
9+
paths:
10+
- "samples/ios/**"
11+
- ".github/workflows/test-ios.yml"
12+
schedule:
13+
- cron: "0 10 * * 1"
14+
workflow_dispatch:
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
find-projects:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
matrix: ${{ steps.find.outputs.matrix }}
24+
steps:
25+
- uses: actions/checkout@v6
26+
- id: find
27+
# Each iOS sample is identified by its project.yml (xcodegen input). We use
28+
# that as the marker rather than the generated .xcodeproj because the
29+
# project.yml is the authoritative source — generated files come and go.
30+
run: |
31+
DIRS=$(find samples/ios -mindepth 2 -maxdepth 2 -name "project.yml" -exec dirname {} \; 2>/dev/null | sort | jq -R -s -c 'split("\n") | map(select(. != ""))')
32+
echo "matrix=$DIRS" >> "$GITHUB_OUTPUT"
33+
34+
test:
35+
needs: find-projects
36+
if: ${{ needs.find-projects.outputs.matrix != '[]' }}
37+
runs-on: macos-latest
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
project: ${{ fromJson(needs.find-projects.outputs.matrix) }}
42+
steps:
43+
- uses: actions/checkout@v6
44+
45+
# Config.xcconfig is gitignored — copy the example so build settings have
46+
# placeholder values. No real CIAM workspace is needed for build + unit tests
47+
# (network-touching paths only execute in the running app).
48+
- name: Provision example xcconfig
49+
working-directory: ${{ matrix.project }}
50+
run: cp Config.example.xcconfig Config.xcconfig
51+
52+
# Pre-fetch Swift Package Manager deps (AppAuth-iOS) so the test step doesn't
53+
# also pay the resolution cost — makes failures during dep resolution easier
54+
# to spot in logs.
55+
- name: Resolve SPM dependencies
56+
working-directory: ${{ matrix.project }}
57+
run: xcodebuild -resolvePackageDependencies -project Quickstart.xcodeproj -scheme Quickstart
58+
59+
# GitHub-hosted macOS runners ship multiple iPhone simulators. We pick the
60+
# first available one rather than hard-coding a name so the workflow keeps
61+
# working as Apple updates the runner image / device catalogue.
62+
- name: Pick iOS simulator
63+
id: sim
64+
run: |
65+
DEVICE=$(xcrun simctl list devices available --json | jq -r '
66+
.devices
67+
| to_entries[]
68+
| select(.key | test("com.apple.CoreSimulator.SimRuntime.iOS"))
69+
| .value[]
70+
| select(.name | startswith("iPhone"))
71+
| .name
72+
' | head -1)
73+
if [ -z "$DEVICE" ]; then
74+
echo "No iPhone simulator found"; exit 1
75+
fi
76+
echo "Selected: $DEVICE"
77+
echo "name=$DEVICE" >> "$GITHUB_OUTPUT"
78+
79+
- name: Build and test
80+
working-directory: ${{ matrix.project }}
81+
run: |
82+
xcodebuild test \
83+
-project Quickstart.xcodeproj \
84+
-scheme Quickstart \
85+
-destination "platform=iOS Simulator,name=${{ steps.sim.outputs.name }}" \
86+
CODE_SIGNING_ALLOWED=NO
87+
88+
# Stable aggregator for branch protection.
89+
all-tests-passed:
90+
name: iOS tests passed
91+
needs: test
92+
if: always()
93+
runs-on: ubuntu-latest
94+
steps:
95+
- name: Verify test matrix succeeded
96+
if: needs.test.result != 'success' && needs.test.result != 'skipped'
97+
run: exit 1

.github/workflows/test-java.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,14 @@ jobs:
4646
- name: Build and test
4747
working-directory: ${{ matrix.project }}
4848
run: mvn -B verify
49+
50+
# Stable aggregator for branch protection.
51+
all-tests-passed:
52+
name: Java tests passed
53+
needs: test
54+
if: always()
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Verify test matrix succeeded
58+
if: needs.test.result != 'success' && needs.test.result != 'skipped'
59+
run: exit 1

.github/workflows/test-js.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,14 @@ jobs:
7676
elif node -e "process.exit(require('./package.json').scripts?.test ? 0 : 1)"; then
7777
yarn test
7878
fi
79+
80+
# Stable aggregator for branch protection.
81+
all-tests-passed:
82+
name: JS tests passed
83+
needs: test
84+
if: always()
85+
runs-on: ubuntu-latest
86+
steps:
87+
- name: Verify test matrix succeeded
88+
if: needs.test.result != 'success' && needs.test.result != 'skipped'
89+
run: exit 1

0 commit comments

Comments
 (0)