Skip to content

Commit f0b0773

Browse files
swolfandwobsoriano
andauthored
ci(expo): add native build smoke workflow (#8964)
Co-authored-by: Robert Soriano <sorianorobertc@gmail.com>
1 parent f23ac11 commit f0b0773

10 files changed

Lines changed: 273 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: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: 'Expo native build (@clerk/expo)'
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
branches:
7+
- main
8+
paths:
9+
- '.github/workflows/expo-native-build.yml'
10+
- 'integration/templates/expo-native/**'
11+
- 'packages/expo/**'
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
17+
concurrency:
18+
group: expo-native-build-${{ github.head_ref || github.ref }}
19+
cancel-in-progress: true
20+
21+
env:
22+
FIXTURE_DIR: integration/templates/expo-native
23+
FIXTURE_PUBLISHABLE_KEY: pk_test_ZHVtbXkuY2xlcmsuYWNjb3VudHMuZGV2JA
24+
SDK_PACK_DIR: /tmp/clerk-expo-pack
25+
26+
jobs:
27+
native-build:
28+
name: Expo ${{ matrix.expo-sdk }} / ${{ matrix.platform }}
29+
runs-on: ${{ matrix.runner }}
30+
timeout-minutes: 45
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
include:
35+
- expo-sdk: 54
36+
platform: android
37+
runner: blacksmith-8vcpu-ubuntu-2204
38+
- expo-sdk: 54
39+
platform: ios
40+
runner: blacksmith-6vcpu-macos-26
41+
- expo-sdk: 56
42+
platform: android
43+
runner: blacksmith-8vcpu-ubuntu-2204
44+
- expo-sdk: 56
45+
platform: ios
46+
runner: blacksmith-6vcpu-macos-26
47+
48+
steps:
49+
- name: Checkout repo
50+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
51+
with:
52+
persist-credentials: false
53+
54+
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
55+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
56+
with:
57+
node-version: 24.15.0
58+
cache: pnpm
59+
60+
- name: Install monorepo dependencies
61+
run: pnpm install --frozen-lockfile
62+
63+
- name: Build and pack @clerk/expo
64+
run: |
65+
pnpm --filter @clerk/expo... build
66+
mkdir -p "$SDK_PACK_DIR"
67+
pnpm --filter @clerk/expo pack --pack-destination "$SDK_PACK_DIR"
68+
SDK_TARBALL="$(ls "$SDK_PACK_DIR"/clerk-expo-*.tgz)"
69+
if tar -tf "$SDK_TARBALL" | grep -q '^package/e2e/'; then
70+
echo "Fixture files must not be packed into @clerk/expo"
71+
exit 1
72+
fi
73+
74+
- name: Install fixture dependencies
75+
working-directory: ${{ env.FIXTURE_DIR }}
76+
env:
77+
EXPO_SDK: ${{ matrix.expo-sdk }}
78+
run: |
79+
cp "package.sdk-$EXPO_SDK.json" package.json
80+
pnpm install --no-frozen-lockfile
81+
SDK_TARBALL="$(ls "$SDK_PACK_DIR"/clerk-expo-*.tgz)"
82+
pnpm add "$SDK_TARBALL" -w
83+
pnpm expo install expo-auth-session expo-constants expo-crypto expo-dev-client expo-secure-store expo-web-browser
84+
85+
- name: Write fixture .env
86+
working-directory: ${{ env.FIXTURE_DIR }}
87+
run: |
88+
echo "EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=$FIXTURE_PUBLISHABLE_KEY" > .env
89+
90+
- name: Set up JDK 17
91+
if: ${{ matrix.platform == 'android' }}
92+
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
93+
with:
94+
distribution: temurin
95+
java-version: 17
96+
97+
- name: Prebuild Android fixture
98+
if: ${{ matrix.platform == 'android' }}
99+
working-directory: ${{ env.FIXTURE_DIR }}
100+
run: pnpm expo prebuild --clean --platform android
101+
102+
- name: Build Android fixture
103+
if: ${{ matrix.platform == 'android' }}
104+
working-directory: ${{ env.FIXTURE_DIR }}
105+
run: pnpm build:android
106+
107+
- name: Prebuild iOS fixture
108+
if: ${{ matrix.platform == 'ios' }}
109+
working-directory: ${{ env.FIXTURE_DIR }}
110+
run: pnpm expo prebuild --clean --platform ios
111+
112+
- name: Build iOS fixture
113+
if: ${{ matrix.platform == 'ios' }}
114+
working-directory: ${{ env.FIXTURE_DIR }}
115+
run: pnpm build:ios
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/.expo/
2+
/.env
3+
/android/
4+
/ios/
5+
/node_modules/
6+
/package.json
7+
/pnpm-lock.yaml
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import { ClerkProvider, useAuth, useUser } from '@clerk/expo';
2+
import { AuthView, UserButton } from '@clerk/expo/native';
3+
import { tokenCache } from '@clerk/expo/token-cache';
4+
import { useState } from 'react';
5+
import { Button, Modal, StyleSheet, Text, View } from 'react-native';
6+
7+
const publishableKey = process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY;
8+
9+
if (!publishableKey) {
10+
throw new Error('Missing EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY');
11+
}
12+
13+
function NativeBuildFixture() {
14+
const { isLoaded, isSignedIn } = useAuth({ treatPendingAsSignedOut: false });
15+
const { user } = useUser();
16+
const [isAuthOpen, setIsAuthOpen] = useState(false);
17+
18+
return (
19+
<View style={styles.container}>
20+
<View style={styles.header}>
21+
<Text style={styles.title}>Clerk Expo Native Fixture</Text>
22+
{isSignedIn && <UserButton />}
23+
</View>
24+
25+
<Text testID='auth-state'>{isLoaded ? `signed ${isSignedIn ? 'in' : 'out'}` : 'loading'}</Text>
26+
{user?.id && <Text testID='user-id'>{user.id}</Text>}
27+
<Button
28+
title='Open native AuthView'
29+
onPress={() => setIsAuthOpen(true)}
30+
/>
31+
32+
<Modal
33+
animationType='slide'
34+
visible={isAuthOpen}
35+
presentationStyle='pageSheet'
36+
onRequestClose={() => setIsAuthOpen(false)}
37+
>
38+
<AuthView onDismiss={() => setIsAuthOpen(false)} />
39+
</Modal>
40+
</View>
41+
);
42+
}
43+
44+
export default function App() {
45+
return (
46+
<ClerkProvider
47+
publishableKey={publishableKey}
48+
tokenCache={tokenCache}
49+
>
50+
<NativeBuildFixture />
51+
</ClerkProvider>
52+
);
53+
}
54+
55+
const styles = StyleSheet.create({
56+
container: {
57+
flex: 1,
58+
gap: 16,
59+
justifyContent: 'center',
60+
padding: 24,
61+
},
62+
header: {
63+
alignItems: 'center',
64+
flexDirection: 'row',
65+
gap: 12,
66+
justifyContent: 'space-between',
67+
},
68+
title: {
69+
flex: 1,
70+
fontSize: 20,
71+
fontWeight: '600',
72+
},
73+
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"expo": {
3+
"name": "Clerk Expo Native Build Fixture",
4+
"slug": "clerk-expo-native-build-fixture",
5+
"version": "1.0.0",
6+
"orientation": "portrait",
7+
"scheme": "clerkexponativebuildfixture",
8+
"ios": {
9+
"bundleIdentifier": "com.clerk.exponativebuildfixture",
10+
"supportsTablet": true
11+
},
12+
"android": {
13+
"package": "com.clerk.exponativebuildfixture"
14+
},
15+
"plugins": ["expo-secure-store", "@clerk/expo", "expo-web-browser"]
16+
}
17+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { registerRootComponent } from 'expo';
2+
3+
import App from './App';
4+
5+
registerRootComponent(App);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "clerk-expo-native-build-fixture",
3+
"version": "1.0.0",
4+
"private": true,
5+
"main": "index.js",
6+
"scripts": {
7+
"build:android": "cd android && ./gradlew assembleRelease",
8+
"build:ios": "xcodebuild -workspace ios/ClerkExpoNativeBuildFixture.xcworkspace -scheme ClerkExpoNativeBuildFixture -configuration Release -sdk iphonesimulator -derivedDataPath ios/build CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY=''",
9+
"prebuild:android": "expo prebuild --clean --platform android",
10+
"prebuild:ios": "expo prebuild --clean --platform ios"
11+
},
12+
"dependencies": {
13+
"expo": "~54.0.34",
14+
"react": "19.1.0",
15+
"react-native": "0.81.5"
16+
},
17+
"devDependencies": {
18+
"@babel/core": "^7.29.0",
19+
"@types/react": "~19.1.17",
20+
"typescript": "~5.9.3"
21+
},
22+
"packageManager": "pnpm@10.33.0+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319"
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "clerk-expo-native-build-fixture",
3+
"version": "1.0.0",
4+
"private": true,
5+
"main": "index.js",
6+
"scripts": {
7+
"build:android": "cd android && ./gradlew assembleRelease",
8+
"build:ios": "xcodebuild -workspace ios/ClerkExpoNativeBuildFixture.xcworkspace -scheme ClerkExpoNativeBuildFixture -configuration Release -sdk iphonesimulator -derivedDataPath ios/build CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY=''",
9+
"prebuild:android": "expo prebuild --clean --platform android",
10+
"prebuild:ios": "expo prebuild --clean --platform ios"
11+
},
12+
"dependencies": {
13+
"expo": "~56.0.12",
14+
"react": "19.2.3",
15+
"react-native": "0.85.3"
16+
},
17+
"devDependencies": {
18+
"@babel/core": "^7.29.0",
19+
"@types/react": "~19.1.17",
20+
"typescript": "~5.9.3"
21+
},
22+
"packageManager": "pnpm@10.33.0+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319"
23+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
packages:
2+
- '.'
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "expo/tsconfig.base",
3+
"compilerOptions": {
4+
"strict": true
5+
}
6+
}

0 commit comments

Comments
 (0)