@@ -25,111 +25,99 @@ jobs:
25
25
with :
26
26
ruby-version : ' 3.0'
27
27
bundler-cache : true
28
-
28
+
29
29
- name : Setup Node.js
30
30
uses : actions/setup-node@v4
31
31
with :
32
32
node-version : ' 18'
33
33
cache : ' yarn'
34
34
35
- # Cache CocoaPods
35
+ - name : Install dependencies
36
+ run : |
37
+ yarn install
38
+ cd mobile/ios && bundle install && cd ../..
39
+
36
40
- name : Cache CocoaPods
37
- id : cache-cocoapods
41
+ id : pods-cache
38
42
uses : actions/cache@v3
39
43
with :
40
- path : ios/Pods
41
- key : ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
44
+ path : |
45
+ mobile/ios/Pods
46
+ ~/Library/Caches/CocoaPods
47
+ key : ${{ runner.os }}-pods-${{ hashFiles('mobile/ios/Podfile.lock') }}
42
48
restore-keys : |
43
49
${{ runner.os }}-pods-
44
50
45
- # Cache Derived Data
46
- - name : Cache Derived Data
47
- uses : actions/cache@v3
48
- with :
49
- path : ~/Library/Developer/Xcode/DerivedData
50
- key : ${{ runner.os }}-derived-data-${{ hashFiles('ios/Podfile.lock') }}
51
- restore-keys : |
52
- ${{ runner.os }}-derived-data-
53
-
54
- # Cache iOS build
55
- - name : Cache iOS build
56
- uses : actions/cache@v3
57
- with :
58
- path : ios/build
59
- key : ${{ runner.os }}-ios-build-${{ github.sha }}
60
- restore-keys : |
61
- ${{ runner.os }}-ios-build-
62
-
63
- - name : Install dependencies
64
- run : |
65
- yarn install --frozen-lockfile
66
- cd ios && bundle install
67
-
68
51
- name : Install CocoaPods
69
- if : steps.cache-cocoapods .outputs.cache-hit != 'true'
52
+ if : steps.pods-cache .outputs.cache-hit != 'true'
70
53
run : |
71
- cd ios
54
+ cd mobile/ ios
72
55
pod install
73
- cd ..
56
+ cd ../..
57
+
58
+ - name : Clean Xcode caches
59
+ run : |
60
+ cd mobile/ios
61
+ rm -rf ~/Library/Developer/Xcode/ModuleCache.noindex/*
62
+ xcodebuild clean -workspace weatherApp.xcworkspace -scheme weatherApp
63
+ cd ../..
74
64
75
65
- name : Install Maestro CLI
76
66
run : |
77
67
curl -Ls "https://get.maestro.mobile.dev" | bash
78
68
brew tap facebook/fb
79
69
brew install facebook/fb/idb-companion
80
-
81
- - name : Add Maestro to path
82
- run : |
83
70
echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
84
- echo "Verifying Maestro installation..."
85
- $HOME/.maestro/bin/maestro --version
86
71
87
- - name : List available simulators
88
- run : xcrun simctl list devices
89
-
90
- - name : Build and Run iOS App
72
+ - name : Build iOS App
91
73
run : |
92
- export NODE_ENV=production
93
- npx react-native run-ios --mode=Release --simulator="iPhone 15"
94
- sleep 90 # Increased wait time to ensure app is fully launched
95
-
96
- - name : Check Simulator status
97
- run : xcrun simctl list devices | grep Booted
98
-
99
- - name : Check Environment Variables
74
+ cd mobile/ios
75
+ # First build to generate module maps
76
+ xcodebuild \
77
+ -workspace weatherApp.xcworkspace \
78
+ -scheme weatherApp \
79
+ -configuration Release \
80
+ -destination 'platform=iOS Simulator,name=iPhone 15' \
81
+ build \
82
+ COMPILER_INDEX_STORE_ENABLE=NO \
83
+ | xcpretty
84
+ cd ../..
85
+
86
+ - name : Start Metro and Run App
100
87
run : |
101
- echo "Checking environment setup..."
102
- echo "NODE_ENV: $NODE_ENV"
103
- echo "MAESTRO_ENVIRONMENT: $MAESTRO_ENVIRONMENT"
104
- echo "WEATHER_API_KEY is set: $([[ ! -z "${WEATHER_API_KEY}" ]] && echo 'true' || echo 'false')"
105
-
106
- - name : Check Maestro environment
107
- run : echo $MAESTRO_ENVIRONMENT
88
+ cd mobile
89
+ # Start metro in background
90
+ yarn start > metro.log 2>&1 &
91
+ METRO_PID=$!
92
+ echo "Waiting for Metro to be ready..."
93
+ while ! grep -q "Metro waiting on" metro.log; do
94
+ if ! kill -0 $METRO_PID 2>/dev/null; then
95
+ echo "Metro process died"
96
+ cat metro.log
97
+ exit 1
98
+ fi
99
+ sleep 1
100
+ done
101
+ # Run the app
102
+ npx react-native run-ios --mode=Release --simulator="iPhone 15" --verbose --no-packager
103
+ sleep 90
104
+ cd ..
108
105
109
106
- name : Run Maestro tests
110
107
run : |
111
- echo "Running Maestro tests..."
108
+ cd mobile
112
109
export MAESTRO_DRIVER_STARTUP_TIMEOUT=240000
113
110
export MAESTRO_CLI_NO_ANALYTICS=1
114
111
$HOME/.maestro/bin/maestro test e2e/main-flow-ios.yaml
112
+ cd ..
115
113
116
- - name : Upload Maestro logs
117
- if : always()
118
- uses : actions/upload-artifact@v4
119
- with :
120
- name : maestro-ios-logs
121
- path : ~/.maestro/logs
122
-
123
- - name : Upload Maestro artifacts
124
- uses : actions/upload-artifact@v4
125
- if : always()
126
- with :
127
- name : maestro-screenshots
128
- path : ~/.maestro/tests/**/*.png
129
-
130
- - name : Upload build logs and app
114
+ - name : Upload logs and artifacts
131
115
if : always()
132
116
uses : actions/upload-artifact@v4
133
117
with :
134
- name : ios-build-logs-and-app
135
- path : ios/build
118
+ name : test-artifacts
119
+ path : |
120
+ mobile/metro.log
121
+ mobile/.maestro/logs/**
122
+ mobile/.maestro/tests/**/*.png
123
+ mobile/ios/build
0 commit comments