Skip to content

Commit 06d1e15

Browse files
committed
ci(mobile-e2e): support clerk-android snapshot input + auto-run on Renovate android-pin PRs
- Adds optional clerk_android_ref / clerk_android_snapshot_suffix workflow_dispatch inputs. When set, the Android job checks out clerk-android at that ref, publishes a snapshot to mavenLocal, and patches packages/expo/android/build.gradle to consume it before running the Maestro suite. This is what clerk-android's manual-release.yml expo-compat gate dispatches against. - Adds a pull_request trigger scoped to packages/expo/android/build.gradle, gated to renovate[bot], so Renovate's clerkAndroid pin bumps get verified before merge. - Bumps JDK to 21 (required by clerk-android; Expo Android build works fine on 21). - iOS job restricted to workflow_dispatch (the new path filter doesn't apply to it).
1 parent 95f6c2f commit 06d1e15

1 file changed

Lines changed: 76 additions & 4 deletions

File tree

.github/workflows/mobile-e2e.yml

Lines changed: 76 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ on:
2323
description: "Maestro tags to exclude (comma-separated)"
2424
required: false
2525
default: "manual,skip"
26+
clerk_android_ref:
27+
description: "clerk-android git ref to publish as a mavenLocal snapshot and test @clerk/expo against. Leave empty to test the versions already pinned in packages/expo/android/build.gradle."
28+
required: false
29+
default: ""
30+
clerk_android_snapshot_suffix:
31+
description: "Suffix appended to the clerk-android version when clerk_android_ref is set (e.g. '-compat-12345678'). Required when clerk_android_ref is set."
32+
required: false
33+
default: ""
34+
# Auto-run on Renovate PRs that bump the clerkAndroid* pins. The dep bump is
35+
# already applied at the PR's merge ref, so we just need to build + Maestro
36+
# against it — no clerk-android checkout/snapshot publish is needed in this path.
37+
pull_request:
38+
paths:
39+
- "packages/expo/android/build.gradle"
2640

2741
env:
2842
EXPO_INSTANCE_NAME: clerkstage-with-native-components
@@ -34,6 +48,9 @@ concurrency:
3448
jobs:
3549
android:
3650
name: Android
51+
# Restrict pull_request runs to Renovate to avoid burning emulator time on
52+
# human PRs that touch the same path. Manual dispatches always run.
53+
if: github.event_name != 'pull_request' || github.event.pull_request.user.login == 'renovate[bot]'
3754
runs-on: 'blacksmith-8vcpu-ubuntu-2204'
3855
timeout-minutes: 45
3956
defaults:
@@ -47,9 +64,17 @@ jobs:
4764
uses: actions/checkout@v4
4865
with:
4966
repository: clerk/clerk-expo-quickstart
50-
ref: ${{ inputs.quickstart_ref }}
67+
ref: ${{ inputs.quickstart_ref || 'main' }}
5168
path: clerk-expo-quickstart
5269

70+
- name: Checkout clerk-android
71+
if: inputs.clerk_android_ref != ''
72+
uses: actions/checkout@v4
73+
with:
74+
repository: clerk/clerk-android
75+
ref: ${{ inputs.clerk_android_ref }}
76+
path: clerk-android
77+
5378
- uses: pnpm/action-setup@v4
5479
- uses: actions/setup-node@v4
5580
with:
@@ -94,11 +119,55 @@ jobs:
94119
echo "password=$password" >> "$GITHUB_OUTPUT"
95120
echo "user_id=$user_id" >> "$GITHUB_OUTPUT"
96121
97-
- name: Set up JDK 17
122+
- name: Set up JDK 21
98123
uses: actions/setup-java@v4
99124
with:
100125
distribution: temurin
101-
java-version: 17
126+
# 21 (not 17) because clerk-android requires it to build. Expo's
127+
# quickstart Android build works with 21 as well.
128+
java-version: 21
129+
130+
- name: Validate clerk-android snapshot inputs
131+
if: inputs.clerk_android_ref != '' && inputs.clerk_android_snapshot_suffix == ''
132+
run: |
133+
echo "::error::clerk_android_ref is set but clerk_android_snapshot_suffix is empty. Provide a suffix (e.g. '-compat-${{ github.run_id }}')."
134+
exit 1
135+
136+
- name: Compute clerk-android snapshot versions
137+
id: android_versions
138+
if: inputs.clerk_android_ref != ''
139+
working-directory: clerk-android
140+
run: |
141+
suffix="${{ inputs.clerk_android_snapshot_suffix }}"
142+
api="$(awk -F= '/^CLERK_API_VERSION=/{print $2}' gradle.properties | tr -d '[:space:]')${suffix}"
143+
ui="$(awk -F= '/^CLERK_UI_VERSION=/{print $2}' gradle.properties | tr -d '[:space:]')${suffix}"
144+
telemetry="$(awk -F= '/^CLERK_TELEMETRY_VERSION=/{print $2}' gradle.properties | tr -d '[:space:]')${suffix}"
145+
echo "api=$api" >> "$GITHUB_OUTPUT"
146+
echo "ui=$ui" >> "$GITHUB_OUTPUT"
147+
echo "telemetry=$telemetry" >> "$GITHUB_OUTPUT"
148+
149+
- name: Publish clerk-android snapshot to mavenLocal
150+
if: inputs.clerk_android_ref != ''
151+
working-directory: clerk-android
152+
run: |
153+
sed -i "s/^CLERK_API_VERSION=.*/CLERK_API_VERSION=${{ steps.android_versions.outputs.api }}/" gradle.properties
154+
sed -i "s/^CLERK_UI_VERSION=.*/CLERK_UI_VERSION=${{ steps.android_versions.outputs.ui }}/" gradle.properties
155+
sed -i "s/^CLERK_TELEMETRY_VERSION=.*/CLERK_TELEMETRY_VERSION=${{ steps.android_versions.outputs.telemetry }}/" gradle.properties
156+
chmod +x gradlew
157+
./gradlew :source:api:publishToMavenLocal :source:ui:publishToMavenLocal :source:telemetry:publishToMavenLocal -x signMavenPublication
158+
159+
- name: Patch @clerk/expo build.gradle to use snapshot
160+
if: inputs.clerk_android_ref != ''
161+
run: |
162+
sed -i "s/clerkAndroidApiVersion = \".*\"/clerkAndroidApiVersion = \"${{ steps.android_versions.outputs.api }}\"/" packages/expo/android/build.gradle
163+
sed -i "s/clerkAndroidUiVersion = \".*\"/clerkAndroidUiVersion = \"${{ steps.android_versions.outputs.ui }}\"/" packages/expo/android/build.gradle
164+
# Expo autolinks via the root project's repositories; adding mavenLocal()
165+
# to the expo module's build.gradle is sufficient for gradle resolution.
166+
if ! grep -q "mavenLocal()" packages/expo/android/build.gradle; then
167+
sed -i '/^repositories\s*{/a \ mavenLocal()' packages/expo/android/build.gradle || true
168+
fi
169+
echo "=== Patched @clerk/expo build.gradle ==="
170+
grep -A 2 -B 2 "clerkAndroid\|mavenLocal" packages/expo/android/build.gradle | head -20
102171
103172
- name: Install Maestro
104173
run: |
@@ -110,7 +179,8 @@ jobs:
110179
env:
111180
CLERK_TEST_EMAIL: ${{ steps.user.outputs.email }}
112181
CLERK_TEST_PASSWORD: ${{ steps.user.outputs.password }}
113-
EXCLUDE_TAGS: ${{ inputs.exclude_tags }}
182+
# inputs.exclude_tags is empty on pull_request triggers; fall back to the same default
183+
EXCLUDE_TAGS: ${{ inputs.exclude_tags || 'manual,skip' }}
114184
with:
115185
api-level: 34
116186
target: google_apis
@@ -142,6 +212,8 @@ jobs:
142212
143213
ios:
144214
name: iOS
215+
# iOS isn't affected by the Android pin bump path filter; only run on manual dispatch.
216+
if: github.event_name == 'workflow_dispatch'
145217
runs-on: macos-15
146218
timeout-minutes: 60
147219
steps:

0 commit comments

Comments
 (0)