Skip to content

Commit 21ca70f

Browse files
mikepitreclaude
andcommitted
ci(repo): run the verify-clerk-expo device specs on pull requests
One job per platform runs the skill's own CLI with a device on the runner: up, run --all, down. Each job creates and deletes its own Clerk application. The jobs skip with a notice until the MOBILE_VERIFICATION_PLATFORM_API_KEY secret exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ab0ae97 commit 21ca70f

2 files changed

Lines changed: 214 additions & 0 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
name: Verify device specs
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
branches:
7+
- main
8+
paths:
9+
- '.claude/skills/verify-clerk-expo/**'
10+
- '!.claude/skills/verify-clerk-expo/**/*.md'
11+
- '.github/workflows/verify-device-specs.yml'
12+
- 'integration/templates/expo-native/**'
13+
- 'integration/tests/expo-native/boot-ios-simulators.sh'
14+
- 'packages/expo/**'
15+
- 'packages/expo-biometrics/**'
16+
- 'packages/expo-google-signin/**'
17+
workflow_dispatch:
18+
19+
permissions:
20+
contents: read
21+
22+
concurrency:
23+
group: verify-device-specs-${{ github.head_ref || github.ref }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
plan:
28+
if: ${{ github.head_ref != 'changeset-release/main' }}
29+
name: Plan device specs
30+
runs-on: ubuntu-latest
31+
timeout-minutes: 5
32+
outputs:
33+
run: ${{ steps.plan.outputs.run }}
34+
steps:
35+
- name: Decide whether the device specs can run
36+
id: plan
37+
env:
38+
HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
39+
HAS_PLATFORM_API_KEY: ${{ secrets.MOBILE_VERIFICATION_PLATFORM_API_KEY != '' }}
40+
run: |
41+
set -euo pipefail
42+
43+
skip_reason=""
44+
if [ "$HEAD_REPOSITORY" != "$GITHUB_REPOSITORY" ]; then
45+
skip_reason="The device specs did not run. They need a repository secret, and this pull request comes from a fork ($HEAD_REPOSITORY)."
46+
elif [ "$HAS_PLATFORM_API_KEY" != "true" ]; then
47+
skip_reason="The device specs did not run. The MOBILE_VERIFICATION_PLATFORM_API_KEY secret is not set for this repository."
48+
fi
49+
50+
if [ -n "$skip_reason" ]; then
51+
echo "::notice title=Device specs skipped::$skip_reason"
52+
echo "run=false" >> "$GITHUB_OUTPUT"
53+
else
54+
echo "run=true" >> "$GITHUB_OUTPUT"
55+
fi
56+
57+
device-specs:
58+
needs: plan
59+
if: needs.plan.outputs.run == 'true'
60+
name: Device specs (${{ matrix.platform }})
61+
runs-on: ${{ matrix.runner }}
62+
timeout-minutes: 45
63+
strategy:
64+
fail-fast: false
65+
matrix:
66+
include:
67+
- platform: ios
68+
runner: ${{ vars.VERIFY_CI_RUNNER_IOS || 'blacksmith-6vcpu-macos-26' }}
69+
- platform: android
70+
runner: ${{ vars.VERIFY_CI_RUNNER_ANDROID || 'blacksmith-8vcpu-ubuntu-2204' }}
71+
env:
72+
SKILL: .claude/skills/verify-clerk-expo
73+
CLI: .claude/skills/verify-clerk-expo/bin/control-clerk-expo
74+
PLATFORM: ${{ matrix.platform }}
75+
VERIFY_THROWAWAY_HOURS: '2'
76+
steps:
77+
- name: Checkout repo
78+
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
79+
with:
80+
persist-credentials: false
81+
82+
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
83+
84+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
85+
with:
86+
node-version: 24.15.0
87+
cache: pnpm
88+
89+
- name: Install monorepo dependencies
90+
run: pnpm install --frozen-lockfile
91+
92+
- name: Set up JDK 21
93+
if: matrix.platform == 'android'
94+
uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4
95+
with:
96+
distribution: temurin
97+
java-version: 21
98+
99+
- name: Set up Gradle cache
100+
if: matrix.platform == 'android'
101+
uses: gradle/actions/setup-gradle@4733eaac7c1b0da527e4206b7671e0061de1ce37 # v6.3.0
102+
with:
103+
cache-read-only: false
104+
add-job-summary: never
105+
106+
- name: Enable KVM
107+
if: matrix.platform == 'android'
108+
run: |
109+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
110+
sudo udevadm control --reload-rules
111+
sudo udevadm trigger --name-match=kvm
112+
113+
- name: Install the emulator and its system image
114+
if: matrix.platform == 'android'
115+
run: |
116+
set -euo pipefail
117+
IMAGE="system-images;android-36;google_apis;x86_64"
118+
"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --install "$IMAGE" emulator platform-tools < /dev/null > "$RUNNER_TEMP/sdkmanager.log" 2>&1 \
119+
|| { echo "::error::sdkmanager could not install $IMAGE"; tail -20 "$RUNNER_TEMP/sdkmanager.log"; exit 1; }
120+
echo "$ANDROID_HOME/platform-tools" >> "$GITHUB_PATH"
121+
122+
- name: Create the template simulator that the skill clones
123+
if: matrix.platform == 'ios'
124+
run: |
125+
set -euo pipefail
126+
created="$(GITHUB_ENV=/dev/null integration/tests/expo-native/boot-ios-simulators.sh boot 1)"
127+
echo "$created"
128+
udid="${created##*: }"
129+
CLERK_TEST_DEVICES="$udid" integration/tests/expo-native/boot-ios-simulators.sh wait
130+
xcrun simctl shutdown "$udid"
131+
xcrun simctl rename "$udid" "Clerk Verify Template iOS"
132+
133+
- name: Install the verify skill
134+
id: install
135+
run: npm ci --prefix "$SKILL" --no-audit --no-fund
136+
137+
- name: Build the fixture and boot a device
138+
env:
139+
CLERK_PLATFORM_API_KEY: ${{ secrets.MOBILE_VERIFICATION_PLATFORM_API_KEY }}
140+
run: |
141+
"$CLI" up --platform "$PLATFORM" --backend local
142+
143+
- name: Compile the XCTest runner before the first spec launches
144+
if: matrix.platform == 'ios'
145+
timeout-minutes: 20
146+
run: |
147+
set -euo pipefail
148+
udid="$(node -p 'JSON.parse(require("fs").readFileSync(process.argv[1], "utf8")).deviceId' "$SKILL/.verify/leases/ios.json")"
149+
AGENT_DEVICE_STATE_DIR="$GITHUB_WORKSPACE/$SKILL/.verify/agent-device" \
150+
"$SKILL/node_modules/.bin/agent-device" prepare ios-runner --platform ios --udid "$udid" --timeout 900000 \
151+
|| echo "::warning::prepare ios-runner failed; the first spec pays for it"
152+
153+
- name: Run the golden specs
154+
timeout-minutes: 20
155+
env:
156+
CLERK_PLATFORM_API_KEY: ${{ secrets.MOBILE_VERIFICATION_PLATFORM_API_KEY }}
157+
run: |
158+
"$CLI" run --all --platform "$PLATFORM" --backend local
159+
160+
- name: Release the device and delete the Clerk application
161+
if: always() && steps.install.outcome == 'success'
162+
env:
163+
CLERK_PLATFORM_API_KEY: ${{ secrets.MOBILE_VERIFICATION_PLATFORM_API_KEY }}
164+
run: |
165+
"$CLI" down
166+
167+
- name: Check that every run is sealed
168+
id: evidence
169+
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
170+
run: |
171+
node -e '
172+
const fs = require("fs");
173+
const path = require("path");
174+
const runs = path.join(process.env.SKILL, ".verify", "runs");
175+
const ids = fs.existsSync(runs) ? fs.readdirSync(runs) : [];
176+
let upload = ids.length > 0;
177+
for (const id of ids) {
178+
let record = null;
179+
try { record = JSON.parse(fs.readFileSync(path.join(runs, id, "run.json"), "utf8")); } catch {}
180+
if (record === null || record.sealed !== true || record.tainted.length > 0) {
181+
upload = false;
182+
console.log("::warning::Run " + id + " was not sealed, or a file in it holds a secret value. No evidence is uploaded.");
183+
}
184+
}
185+
fs.appendFileSync(process.env.GITHUB_OUTPUT, "upload=" + upload + "\n");
186+
'
187+
188+
- name: Summarize the run
189+
if: ${{ !cancelled() && steps.evidence.outputs.upload == 'true' }}
190+
run: |
191+
for summary in "$SKILL"/.verify/runs/*/e2e/summary.md "$SKILL"/.verify/runs/*/e2e-*/summary.md; do
192+
if [ -f "$summary" ]; then
193+
cat "$summary" >> "$GITHUB_STEP_SUMMARY"
194+
fi
195+
done
196+
197+
- name: Upload the evidence
198+
if: ${{ !cancelled() && steps.evidence.outputs.upload == 'true' }}
199+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
200+
with:
201+
name: verify-device-specs-${{ matrix.platform }}
202+
overwrite: true
203+
include-hidden-files: true
204+
path: |
205+
${{ env.SKILL }}/.verify/runs/*/run.json
206+
${{ env.SKILL }}/.verify/runs/*/video.mp4
207+
${{ env.SKILL }}/.verify/runs/*/screenshots
208+
${{ env.SKILL }}/.verify/runs/*/e2e*/summary.md
209+
${{ env.SKILL }}/.verify/runs/*/e2e*/failures
210+
${{ env.SKILL }}/.verify/runs/*/e2e*/artifacts
211+
retention-days: 3
212+
if-no-files-found: warn

0 commit comments

Comments
 (0)