Skip to content

Commit 86f895e

Browse files
committed
CU-868cu9311 working on github actions and minor fix.
1 parent d0ec4fe commit 86f895e

File tree

5 files changed

+301
-25
lines changed

5 files changed

+301
-25
lines changed

.expo/devices.json

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,32 @@
11
{
22
"devices": [
3+
{
4+
"installationId": "4af035d0-07a6-423e-b6bc-17e75e219cfe",
5+
"lastUsed": 1749391119998
6+
},
7+
{
8+
"installationId": "aa1e01fe-0cc5-418d-93e4-df49f96c1e43",
9+
"lastUsed": 1749388195311
10+
},
11+
{
12+
"installationId": "2964cc85-ebf5-4eb5-8de9-b46a30fa64bc",
13+
"lastUsed": 1749385761171
14+
},
15+
{
16+
"installationId": "6142ad22-0704-42f4-9826-1999a4b19d0a",
17+
"lastUsed": 1749385369955
18+
},
19+
{
20+
"installationId": "ccb3c274-d545-46a7-8b80-3d3d181c8464",
21+
"lastUsed": 1749302782562
22+
},
23+
{
24+
"installationId": "b63e4dc1-263c-47f2-afe6-99e9c06d5b90",
25+
"lastUsed": 1749265905063
26+
},
327
{
428
"installationId": "ef2f0ec1-1637-48ae-a465-b6044dbaf625",
5-
"lastUsed": 1749254257540
29+
"lastUsed": 1749262351089
630
},
731
{
832
"installationId": "121adcd6-201e-4de8-adbe-deceab35ee92",
@@ -15,14 +39,6 @@
1539
{
1640
"installationId": "a66b5af2-bed7-4b5d-aff0-94e99e751b90",
1741
"lastUsed": 1749220817812
18-
},
19-
{
20-
"installationId": "156ab25a-f4f1-4407-a003-39cc7af21924",
21-
"lastUsed": 1746944077967
22-
},
23-
{
24-
"installationId": "97dd0ee0-1583-4737-a03e-2f9940824d23",
25-
"lastUsed": 1746889728991
2642
}
2743
]
2844
}
Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
name: React Native CI/CD
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
paths-ignore:
7+
- "**.md"
8+
- "LICENSE"
9+
- "docs/**"
10+
pull_request:
11+
branches: [main, master]
12+
workflow_dispatch:
13+
inputs:
14+
buildType:
15+
type: choice
16+
description: "Build type to run"
17+
options:
18+
- dev
19+
- prod-apk
20+
- prod-aab
21+
- ios-dev
22+
- ios-prod
23+
- all
24+
platform:
25+
type: choice
26+
description: "Platform to build"
27+
default: "all"
28+
options:
29+
- android
30+
- ios
31+
- all
32+
33+
env:
34+
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
35+
EXPO_APPLE_ID: ${{ secrets.EXPO_APPLE_ID }}
36+
EXPO_APPLE_PASSWORD: ${{ secrets.EXPO_APPLE_PASSWORD }}
37+
EXPO_TEAM_ID: ${{ secrets.EXPO_TEAM_ID }}
38+
NODE_OPTIONS: --openssl-legacy-provider
39+
40+
jobs:
41+
check-skip:
42+
runs-on: ubuntu-latest
43+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
44+
steps:
45+
- name: Skip CI check
46+
run: echo "Proceeding with workflow"
47+
48+
test:
49+
needs: check-skip
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: 🏗 Checkout repository
53+
uses: actions/checkout@v4
54+
55+
- name: 🏗 Setup Node.js
56+
uses: actions/setup-node@v4
57+
with:
58+
node-version: "20"
59+
cache: "yarn"
60+
61+
- name: 📦 Get yarn cache directory path
62+
id: yarn-cache-dir-path
63+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
64+
65+
- name: 📦 Setup yarn cache
66+
uses: actions/cache@v3
67+
with:
68+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
69+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
70+
restore-keys: |
71+
${{ runner.os }}-yarn-
72+
73+
- name: 📦 Install dependencies
74+
run: yarn install
75+
76+
- name: 🧪 Run TypeScript check
77+
run: yarn tsc
78+
79+
- name: 🧹 Run ESLint
80+
run: yarn lint
81+
82+
- name: 🎨 Run Prettier check
83+
run: yarn format:check
84+
85+
- name: 🧪 Run Jest Tests
86+
run: yarn test
87+
88+
- name: 🧪 Run React Native Testing Library Tests
89+
run: yarn test:rntl
90+
91+
build-and-deploy:
92+
needs: test
93+
if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')) || github.event_name == 'workflow_dispatch'
94+
strategy:
95+
matrix:
96+
platform: [android]
97+
include:
98+
- platform: ios
99+
runs-on: macos-latest
100+
runs-on: ${{ matrix.platform == 'ios' && 'macos-latest' || 'ubuntu-latest' }}
101+
steps:
102+
- name: 🏗 Checkout repository
103+
uses: actions/checkout@v4
104+
105+
- name: 🏗 Setup Node.js
106+
uses: actions/setup-node@v4
107+
with:
108+
node-version: "20"
109+
cache: "yarn"
110+
111+
- name: 📦 Get yarn cache directory path
112+
id: yarn-cache-dir-path
113+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
114+
115+
- name: 📦 Setup yarn cache
116+
uses: actions/cache@v3
117+
with:
118+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
119+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
120+
restore-keys: |
121+
${{ runner.os }}-yarn-
122+
123+
- name: 📦 Install dependencies
124+
run: |
125+
yarn install
126+
yarn global add eas-cli@latest
127+
128+
- name: 📱 Setup EAS build cache
129+
uses: actions/cache@v3
130+
with:
131+
path: ~/.eas-build-local
132+
key: ${{ runner.os }}-eas-build-local-${{ hashFiles('**/package.json') }}
133+
restore-keys: |
134+
${{ runner.os }}-eas-build-local-
135+
136+
- name: 🔄 Verify EAS CLI installation
137+
run: |
138+
echo "EAS CLI version:"
139+
eas --version
140+
141+
- name: 📋 Fix package.json main entry
142+
run: |
143+
# Check if jq is installed, if not install it
144+
if ! command -v jq &> /dev/null; then
145+
echo "Installing jq..."
146+
sudo apt-get update && sudo apt-get install -y jq
147+
fi
148+
149+
# Fix the main entry in package.json
150+
if [ -f ./package.json ]; then
151+
# Create a backup
152+
cp package.json package.json.bak
153+
# Update the package.json
154+
jq '.main = "node_modules/expo/AppEntry.js"' package.json > package.json.tmp && mv package.json.tmp package.json
155+
echo "Updated package.json main entry"
156+
cat package.json | grep "main"
157+
else
158+
echo "package.json not found"
159+
exit 1
160+
fi
161+
162+
- name: 📋 Update metro.config.js for SVG support
163+
run: |
164+
if [ -f ./metro.config.js ]; then
165+
echo "Creating backup of metro.config.js"
166+
cp ./metro.config.js ./metro.config.js.backup
167+
echo "Updating metro.config.js to CommonJS format"
168+
cat > ./metro.config.js << 'EOFMARKER'
169+
/* eslint-disable @typescript-eslint/no-var-requires */
170+
const { getDefaultConfig } = require('expo/metro-config');
171+
172+
const config = getDefaultConfig(__dirname);
173+
174+
const { transformer, resolver } = config;
175+
176+
config.transformer = {
177+
...transformer,
178+
babelTransformerPath: require.resolve('react-native-svg-transformer/expo'),
179+
};
180+
181+
config.resolver = {
182+
...resolver,
183+
assetExts: resolver.assetExts.filter(ext => ext !== 'svg'),
184+
sourceExts: [...resolver.sourceExts, 'svg'],
185+
};
186+
187+
module.exports = config;
188+
EOFMARKER
189+
echo "metro.config.js updated to CommonJS format"
190+
else
191+
echo "metro.config.js not found"
192+
fi
193+
194+
- name: 📱 Build Development APK
195+
if: github.event.inputs.buildType == 'all' || github.event.inputs.buildType == 'dev' || github.event_name == 'push' && (matrix.platform == 'android' || github.event.inputs.platform == 'all' || github.event.inputs.platform == 'android')
196+
run: |
197+
# Build with increased memory limit
198+
export NODE_OPTIONS="--openssl-legacy-provider --max_old_space_size=4096"
199+
eas build --platform android --profile development --local --non-interactive --output=./app-dev.apk
200+
env:
201+
NODE_ENV: development
202+
203+
- name: 📱 Build Production APK
204+
if: github.event.inputs.buildType == 'all' || github.event.inputs.buildType == 'prod-apk' || github.event_name == 'push' && (matrix.platform == 'android' || github.event.inputs.platform == 'all' || github.event.inputs.platform == 'android')
205+
run: |
206+
export NODE_OPTIONS="--openssl-legacy-provider --max_old_space_size=4096"
207+
eas build --platform android --profile production-apk --local --non-interactive --output=./app-prod.apk
208+
env:
209+
NODE_ENV: production
210+
211+
- name: 📱 Build Production AAB
212+
if: github.event.inputs.buildType == 'all' || github.event.inputs.buildType == 'prod-aab' || github.event_name == 'push' && (matrix.platform == 'android' || github.event.inputs.platform == 'all' || github.event.inputs.platform == 'android')
213+
run: |
214+
export NODE_OPTIONS="--openssl-legacy-provider --max_old_space_size=4096"
215+
eas build --platform android --profile production --local --non-interactive --output=./app-prod.aab
216+
env:
217+
NODE_ENV: production
218+
219+
- name: 📱 Build iOS Development
220+
if: (github.event.inputs.buildType == 'all' || github.event.inputs.buildType == 'ios-dev') && (matrix.platform == 'ios' || github.event.inputs.platform == 'all' || github.event.inputs.platform == 'ios')
221+
run: |
222+
export NODE_OPTIONS="--openssl-legacy-provider --max_old_space_size=4096"
223+
eas build --platform ios --profile development --local --non-interactive --output=./app-ios-dev.app
224+
env:
225+
NODE_ENV: development
226+
227+
- name: 📱 Build iOS Production
228+
if: (github.event.inputs.buildType == 'all' || github.event.inputs.buildType == 'ios-prod') && (matrix.platform == 'ios' || github.event.inputs.platform == 'all' || github.event.inputs.platform == 'ios')
229+
run: |
230+
export NODE_OPTIONS="--openssl-legacy-provider --max_old_space_size=4096"
231+
eas build --platform ios --profile production --local --non-interactive --output=./app-ios-prod.ipa
232+
env:
233+
NODE_ENV: production
234+
235+
- name: 📦 Upload build artifacts to GitHub
236+
uses: actions/upload-artifact@v4
237+
with:
238+
name: app-builds
239+
path: |
240+
./app-dev.apk
241+
./app-prod.apk
242+
./app-prod.aab
243+
./app-ios-dev.app
244+
./app-ios-prod.ipa
245+
retention-days: 7

src/app/(app)/_layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { securityStore } from '@/stores/security/store';
2626

2727
export default function TabLayout() {
2828
const { t } = useTranslation();
29-
const { status, setIsOnboarding } = useAuthStore();
29+
const { status } = useAuthStore();
3030
const [isFirstTime, _setIsFirstTime] = useIsFirstTime();
3131
const [isOpen, setIsOpen] = React.useState(false);
3232
const [isNotificationsOpen, setIsNotificationsOpen] = React.useState(false);
@@ -69,7 +69,7 @@ export default function TabLayout() {
6969
const rights = securityStore((state) => state.rights);
7070

7171
if (isFirstTime) {
72-
setIsOnboarding();
72+
//setIsOnboarding();
7373
return <Redirect href="/onboarding" />;
7474
}
7575
if (status === 'signedOut') {

src/app/_layout.tsx

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,32 @@ function RootLayout() {
110110

111111
function Providers({ children }: { children: React.ReactNode }) {
112112
const colorScheme = useColorScheme();
113+
114+
const renderContent = () => (
115+
<APIProvider>
116+
<GluestackUIProvider mode={(colorScheme ?? 'light') as 'light' | 'dark'}>
117+
<ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
118+
<BottomSheetModalProvider>
119+
{children}
120+
<LiveKitBottomSheet />
121+
<FlashMessage position="top" />
122+
</BottomSheetModalProvider>
123+
</ThemeProvider>
124+
</GluestackUIProvider>
125+
</APIProvider>
126+
);
127+
113128
return (
114129
<SafeAreaProvider>
115130
<GestureHandlerRootView>
116131
<KeyboardProvider>
117-
<PostHogProvider apiKey={Env.POSTHOG_API_KEY} options={{ host: Env.POSTHOG_HOST }}>
118-
<APIProvider>
119-
<GluestackUIProvider mode={(colorScheme ?? 'light') as 'light' | 'dark'}>
120-
<ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
121-
<BottomSheetModalProvider>
122-
{children}
123-
<LiveKitBottomSheet />
124-
<FlashMessage position="top" />
125-
</BottomSheetModalProvider>
126-
</ThemeProvider>
127-
</GluestackUIProvider>
128-
</APIProvider>
129-
</PostHogProvider>
132+
{Env.POSTHOG_API_KEY ? (
133+
<PostHogProvider apiKey={Env.POSTHOG_API_KEY} options={{ host: Env.POSTHOG_HOST }}>
134+
{renderContent()}
135+
</PostHogProvider>
136+
) : (
137+
renderContent()
138+
)}
130139
</KeyboardProvider>
131140
</GestureHandlerRootView>
132141
</SafeAreaProvider>

src/app/onboarding.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useRouter } from 'expo-router';
22
import { Bell, ChevronRight, MapPin, Users } from 'lucide-react-native';
33
import { useColorScheme } from 'nativewind';
4-
import React, { useRef, useState } from 'react';
4+
import React, { useEffect, useRef, useState } from 'react';
55
import { Dimensions, FlatList, Image } from 'react-native';
66
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
77

@@ -10,6 +10,7 @@ import { Button, ButtonText } from '@/components/ui/button';
1010
import { Pressable } from '@/components/ui/pressable';
1111
import { Text } from '@/components/ui/text';
1212
import { useIsFirstTime } from '@/lib/storage';
13+
import { useAuthStore } from '@/lib/auth';
1314

1415
const { width } = Dimensions.get('window');
1516

@@ -59,12 +60,17 @@ const Pagination: React.FC<{ currentIndex: number; length: number }> = ({ curren
5960

6061
export default function Onboarding() {
6162
const [_, setIsFirstTime] = useIsFirstTime();
63+
const { status, setIsOnboarding } = useAuthStore();
6264
const router = useRouter();
6365
const [currentIndex, setCurrentIndex] = useState(0);
6466
const flatListRef = useRef<FlatList>(null);
6567
const buttonOpacity = useSharedValue(0);
6668
const { colorScheme } = useColorScheme();
6769

70+
useEffect(() => {
71+
setIsOnboarding();
72+
}, []);
73+
6874
const handleScroll = (event: { nativeEvent: { contentOffset: { x: number } } }) => {
6975
const index = Math.round(event.nativeEvent.contentOffset.x / width);
7076
setCurrentIndex(index);

0 commit comments

Comments
 (0)