Skip to content

Commit 7e3bf26

Browse files
committed
fix caching
1 parent 147070c commit 7e3bf26

File tree

1 file changed

+61
-73
lines changed

1 file changed

+61
-73
lines changed

.github/workflows/e2e-tests.yaml

+61-73
Original file line numberDiff line numberDiff line change
@@ -25,111 +25,99 @@ jobs:
2525
with:
2626
ruby-version: '3.0'
2727
bundler-cache: true
28-
28+
2929
- name: Setup Node.js
3030
uses: actions/setup-node@v4
3131
with:
3232
node-version: '18'
3333
cache: 'yarn'
3434

35-
# Cache CocoaPods
35+
- name: Install dependencies
36+
run: |
37+
yarn install
38+
cd mobile/ios && bundle install && cd ../..
39+
3640
- name: Cache CocoaPods
37-
id: cache-cocoapods
41+
id: pods-cache
3842
uses: actions/cache@v3
3943
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') }}
4248
restore-keys: |
4349
${{ runner.os }}-pods-
4450
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-
6851
- name: Install CocoaPods
69-
if: steps.cache-cocoapods.outputs.cache-hit != 'true'
52+
if: steps.pods-cache.outputs.cache-hit != 'true'
7053
run: |
71-
cd ios
54+
cd mobile/ios
7255
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 ../..
7464
7565
- name: Install Maestro CLI
7666
run: |
7767
curl -Ls "https://get.maestro.mobile.dev" | bash
7868
brew tap facebook/fb
7969
brew install facebook/fb/idb-companion
80-
81-
- name: Add Maestro to path
82-
run: |
8370
echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
84-
echo "Verifying Maestro installation..."
85-
$HOME/.maestro/bin/maestro --version
8671
87-
- name: List available simulators
88-
run: xcrun simctl list devices
89-
90-
- name: Build and Run iOS App
72+
- name: Build iOS App
9173
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
10087
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 ..
108105
109106
- name: Run Maestro tests
110107
run: |
111-
echo "Running Maestro tests..."
108+
cd mobile
112109
export MAESTRO_DRIVER_STARTUP_TIMEOUT=240000
113110
export MAESTRO_CLI_NO_ANALYTICS=1
114111
$HOME/.maestro/bin/maestro test e2e/main-flow-ios.yaml
112+
cd ..
115113
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
131115
if: always()
132116
uses: actions/upload-artifact@v4
133117
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

Comments
 (0)