|
| 1 | +# Manual mobile e2e for @clerk/expo native components. |
| 2 | +# Clones clerk-expo-quickstart, builds the NativeComponentQuickstart app, |
| 3 | +# and runs Maestro flows on iOS simulator and Android emulator. |
| 4 | +# |
| 5 | +# Secrets: |
| 6 | +# INTEGRATION_STAGING_INSTANCE_KEYS — JSON map of named staging test instances |
| 7 | +# ({ "<name>": { "pk": "pk_test_...", "sk": "sk_test_..." } }). |
| 8 | +# Same secret used by /integration (Playwright) staging jobs. We read the |
| 9 | +# entry named EXPO_INSTANCE_NAME (set in env: below). |
| 10 | +# |
| 11 | +# Test users are provisioned per-run via Clerk Backend API and deleted at |
| 12 | +# teardown — same pattern as /integration's createBapiUser. |
| 13 | +name: "Mobile e2e (@clerk/expo)" |
| 14 | + |
| 15 | +on: |
| 16 | + workflow_dispatch: |
| 17 | + inputs: |
| 18 | + quickstart_ref: |
| 19 | + description: "clerk-expo-quickstart git ref (branch, tag, or SHA)" |
| 20 | + required: false |
| 21 | + default: "main" |
| 22 | + exclude_tags: |
| 23 | + description: "Maestro tags to exclude (comma-separated)" |
| 24 | + required: false |
| 25 | + default: "manual,skip" |
| 26 | + |
| 27 | +env: |
| 28 | + EXPO_INSTANCE_NAME: clerkstage-with-native-components |
| 29 | + |
| 30 | +concurrency: |
| 31 | + group: mobile-e2e-${{ github.ref }} |
| 32 | + cancel-in-progress: true |
| 33 | + |
| 34 | +jobs: |
| 35 | + android: |
| 36 | + name: Android |
| 37 | + runs-on: 'blacksmith-8vcpu-ubuntu-2204' |
| 38 | + timeout-minutes: 45 |
| 39 | + defaults: |
| 40 | + run: |
| 41 | + working-directory: . |
| 42 | + steps: |
| 43 | + - name: Checkout @clerk/javascript |
| 44 | + uses: actions/checkout@v4 |
| 45 | + |
| 46 | + - name: Checkout clerk-expo-quickstart |
| 47 | + uses: actions/checkout@v4 |
| 48 | + with: |
| 49 | + repository: clerk/clerk-expo-quickstart |
| 50 | + ref: ${{ inputs.quickstart_ref }} |
| 51 | + path: clerk-expo-quickstart |
| 52 | + |
| 53 | + - uses: pnpm/action-setup@v4 |
| 54 | + - uses: actions/setup-node@v4 |
| 55 | + with: |
| 56 | + node-version: 20 |
| 57 | + cache: pnpm |
| 58 | + |
| 59 | + - name: Install monorepo deps |
| 60 | + run: pnpm install --frozen-lockfile |
| 61 | + |
| 62 | + - name: Build @clerk/expo |
| 63 | + run: pnpm turbo build --filter=@clerk/expo... |
| 64 | + |
| 65 | + - name: Install quickstart deps |
| 66 | + working-directory: clerk-expo-quickstart/NativeComponentQuickstart |
| 67 | + run: pnpm install |
| 68 | + |
| 69 | + - name: Resolve Clerk instance keys |
| 70 | + id: keys |
| 71 | + env: |
| 72 | + INTEGRATION_STAGING_INSTANCE_KEYS: ${{ secrets.INTEGRATION_STAGING_INSTANCE_KEYS }} |
| 73 | + run: node scripts/resolve-instance-keys.mjs INTEGRATION_STAGING_INSTANCE_KEYS "$EXPO_INSTANCE_NAME" |
| 74 | + |
| 75 | + - name: Write quickstart .env |
| 76 | + working-directory: clerk-expo-quickstart/NativeComponentQuickstart |
| 77 | + run: | |
| 78 | + echo "EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=${{ steps.keys.outputs.pk }}" > .env |
| 79 | +
|
| 80 | + - name: Provision test user via BAPI |
| 81 | + id: user |
| 82 | + env: |
| 83 | + CLERK_SECRET_KEY: ${{ steps.keys.outputs.sk }} |
| 84 | + run: | |
| 85 | + email="ci-${GITHUB_RUN_ID}-${RANDOM}+clerk_test@clerkcookie.com" |
| 86 | + password="ClerkCI!$(openssl rand -hex 8)Aa1" |
| 87 | + response=$(curl -fsS -X POST https://api.clerk.com/v1/users \ |
| 88 | + -H "Authorization: Bearer $CLERK_SECRET_KEY" \ |
| 89 | + -H "Content-Type: application/json" \ |
| 90 | + -d "{\"email_address\":[\"$email\"],\"password\":\"$password\"}") |
| 91 | + user_id=$(echo "$response" | jq -er '.id') |
| 92 | + echo "::add-mask::$password" |
| 93 | + echo "email=$email" >> "$GITHUB_OUTPUT" |
| 94 | + echo "password=$password" >> "$GITHUB_OUTPUT" |
| 95 | + echo "user_id=$user_id" >> "$GITHUB_OUTPUT" |
| 96 | +
|
| 97 | + - name: Set up JDK 17 |
| 98 | + uses: actions/setup-java@v4 |
| 99 | + with: |
| 100 | + distribution: temurin |
| 101 | + java-version: 17 |
| 102 | + |
| 103 | + - name: Install Maestro |
| 104 | + run: | |
| 105 | + curl -Ls "https://get.maestro.mobile.dev" | bash |
| 106 | + echo "$HOME/.maestro/bin" >> "$GITHUB_PATH" |
| 107 | +
|
| 108 | + - name: Run Android e2e |
| 109 | + uses: reactivecircus/android-emulator-runner@v2 |
| 110 | + env: |
| 111 | + CLERK_TEST_EMAIL: ${{ steps.user.outputs.email }} |
| 112 | + CLERK_TEST_PASSWORD: ${{ steps.user.outputs.password }} |
| 113 | + EXCLUDE_TAGS: ${{ inputs.exclude_tags }} |
| 114 | + with: |
| 115 | + api-level: 34 |
| 116 | + target: google_apis |
| 117 | + arch: x86_64 |
| 118 | + script: | |
| 119 | + cd clerk-expo-quickstart/NativeComponentQuickstart |
| 120 | + npx expo prebuild --clean |
| 121 | + npx expo run:android --variant release --no-bundler |
| 122 | + cd ../../integration-mobile |
| 123 | + # Maestro doesn't auto-recurse into subdirectories; pass each flow explicitly. |
| 124 | + find flows -type f -name "*.yaml" ! -path "*/common/*" -print0 | \ |
| 125 | + xargs -0 maestro test --exclude-tags "$EXCLUDE_TAGS" |
| 126 | +
|
| 127 | + - name: Upload Maestro artifacts on failure |
| 128 | + if: failure() |
| 129 | + uses: actions/upload-artifact@v4 |
| 130 | + with: |
| 131 | + name: maestro-android |
| 132 | + path: ~/.maestro/tests |
| 133 | + |
| 134 | + - name: Cleanup test user |
| 135 | + if: always() && steps.user.outputs.user_id != '' |
| 136 | + env: |
| 137 | + CLERK_SECRET_KEY: ${{ steps.keys.outputs.sk }} |
| 138 | + USER_ID: ${{ steps.user.outputs.user_id }} |
| 139 | + run: | |
| 140 | + curl -fsS -X DELETE "https://api.clerk.com/v1/users/$USER_ID" \ |
| 141 | + -H "Authorization: Bearer $CLERK_SECRET_KEY" || true |
| 142 | +
|
| 143 | + ios: |
| 144 | + name: iOS |
| 145 | + runs-on: macos-15 |
| 146 | + timeout-minutes: 60 |
| 147 | + steps: |
| 148 | + - name: Checkout @clerk/javascript |
| 149 | + uses: actions/checkout@v4 |
| 150 | + |
| 151 | + - name: Checkout clerk-expo-quickstart |
| 152 | + uses: actions/checkout@v4 |
| 153 | + with: |
| 154 | + repository: clerk/clerk-expo-quickstart |
| 155 | + ref: ${{ inputs.quickstart_ref }} |
| 156 | + path: clerk-expo-quickstart |
| 157 | + |
| 158 | + - uses: pnpm/action-setup@v4 |
| 159 | + - uses: actions/setup-node@v4 |
| 160 | + with: |
| 161 | + node-version: 20 |
| 162 | + cache: pnpm |
| 163 | + |
| 164 | + - name: Install monorepo deps |
| 165 | + run: pnpm install --frozen-lockfile |
| 166 | + |
| 167 | + - name: Build @clerk/expo |
| 168 | + run: pnpm turbo build --filter=@clerk/expo... |
| 169 | + |
| 170 | + - name: Install quickstart deps |
| 171 | + working-directory: clerk-expo-quickstart/NativeComponentQuickstart |
| 172 | + run: pnpm install |
| 173 | + |
| 174 | + - name: Resolve Clerk instance keys |
| 175 | + id: keys |
| 176 | + env: |
| 177 | + INTEGRATION_STAGING_INSTANCE_KEYS: ${{ secrets.INTEGRATION_STAGING_INSTANCE_KEYS }} |
| 178 | + run: node scripts/resolve-instance-keys.mjs INTEGRATION_STAGING_INSTANCE_KEYS "$EXPO_INSTANCE_NAME" |
| 179 | + |
| 180 | + - name: Write quickstart .env |
| 181 | + working-directory: clerk-expo-quickstart/NativeComponentQuickstart |
| 182 | + run: | |
| 183 | + echo "EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=${{ steps.keys.outputs.pk }}" > .env |
| 184 | +
|
| 185 | + - name: Provision test user via BAPI |
| 186 | + id: user |
| 187 | + env: |
| 188 | + CLERK_SECRET_KEY: ${{ steps.keys.outputs.sk }} |
| 189 | + run: | |
| 190 | + email="ci-${GITHUB_RUN_ID}-${RANDOM}+clerk_test@clerkcookie.com" |
| 191 | + password="ClerkCI!$(openssl rand -hex 8)Aa1" |
| 192 | + response=$(curl -fsS -X POST https://api.clerk.com/v1/users \ |
| 193 | + -H "Authorization: Bearer $CLERK_SECRET_KEY" \ |
| 194 | + -H "Content-Type: application/json" \ |
| 195 | + -d "{\"email_address\":[\"$email\"],\"password\":\"$password\"}") |
| 196 | + user_id=$(echo "$response" | jq -er '.id') |
| 197 | + echo "::add-mask::$password" |
| 198 | + echo "email=$email" >> "$GITHUB_OUTPUT" |
| 199 | + echo "password=$password" >> "$GITHUB_OUTPUT" |
| 200 | + echo "user_id=$user_id" >> "$GITHUB_OUTPUT" |
| 201 | +
|
| 202 | + - name: Cache SPM |
| 203 | + uses: actions/cache@v4 |
| 204 | + with: |
| 205 | + path: ~/Library/Developer/Xcode/DerivedData |
| 206 | + key: spm-${{ hashFiles('packages/expo/package.json') }} |
| 207 | + |
| 208 | + - name: Install Maestro |
| 209 | + run: | |
| 210 | + curl -Ls "https://get.maestro.mobile.dev" | bash |
| 211 | + echo "$HOME/.maestro/bin" >> "$GITHUB_PATH" |
| 212 | +
|
| 213 | + - name: Build and run iOS e2e |
| 214 | + env: |
| 215 | + CLERK_TEST_EMAIL: ${{ steps.user.outputs.email }} |
| 216 | + CLERK_TEST_PASSWORD: ${{ steps.user.outputs.password }} |
| 217 | + EXCLUDE_TAGS: ${{ inputs.exclude_tags }} |
| 218 | + run: | |
| 219 | + cd clerk-expo-quickstart/NativeComponentQuickstart |
| 220 | + npx expo prebuild --clean |
| 221 | + npx expo run:ios --configuration Release --no-bundler |
| 222 | + cd ../../integration-mobile |
| 223 | + # Maestro doesn't auto-recurse into subdirectories; pass each flow explicitly. |
| 224 | + find flows -type f -name "*.yaml" ! -path "*/common/*" -print0 | \ |
| 225 | + xargs -0 maestro test --exclude-tags "$EXCLUDE_TAGS,androidOnly" |
| 226 | +
|
| 227 | + - name: Upload Maestro artifacts on failure |
| 228 | + if: failure() |
| 229 | + uses: actions/upload-artifact@v4 |
| 230 | + with: |
| 231 | + name: maestro-ios |
| 232 | + path: ~/.maestro/tests |
| 233 | + |
| 234 | + - name: Cleanup test user |
| 235 | + if: always() && steps.user.outputs.user_id != '' |
| 236 | + env: |
| 237 | + CLERK_SECRET_KEY: ${{ steps.keys.outputs.sk }} |
| 238 | + USER_ID: ${{ steps.user.outputs.user_id }} |
| 239 | + run: | |
| 240 | + curl -fsS -X DELETE "https://api.clerk.com/v1/users/$USER_ID" \ |
| 241 | + -H "Authorization: Bearer $CLERK_SECRET_KEY" || true |
0 commit comments