99 # Path configuration
1010 WORKSPACE : ${{ github.workspace }}
1111 APP_PATH : ${{ github.workspace }}/app
12+ # Cache versions
13+ GH_CACHE_VERSION : v1 # Global cache version
14+ GH_GEMS_CACHE_VERSION : v1 # Ruby gems cache version
15+ # Performance optimizations
16+ GRADLE_OPTS : -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=4 -Dorg.gradle.parallel=true -Dorg.gradle.configureondemand=true -Dorg.gradle.caching=true
17+ CI : true
1218on :
1319 push :
1420 paths :
@@ -103,6 +109,10 @@ jobs:
103109 working-directory : ./app
104110 build :
105111 runs-on : macos-latest
112+ env :
113+ # iOS project configuration - hardcoded for CI stability
114+ IOS_PROJECT_NAME : " Self"
115+ IOS_PROJECT_SCHEME : " OpenPassport"
106116 steps :
107117 - uses : actions/checkout@v4
108118 - name : Read and sanitize Node.js version
@@ -147,50 +157,44 @@ jobs:
147157 bundler-cache : false
148158 working-directory : ./app
149159
150- - uses : actions/checkout@v4
151- - name : Cache Node Modules
160+ - name : Cache Node modules
152161 uses : actions/cache@v4
153162 with :
154- path : |
155- .yarn/cache
156- node_modules
157- app/node_modules
158- key : ${{ runner.os }}-node-${{ env.NODE_VERSION_SANITIZED }}-yarn-${{ hashFiles('yarn.lock') }}
163+ path : app/node_modules
164+ key : ${{ runner.os }}-node-${{ env.NODE_VERSION_SANITIZED }}-${{ hashFiles('app/yarn.lock') }}
159165 restore-keys : |
160- ${{ runner.os }}-node-${{ env.NODE_VERSION_SANITIZED }}-yarn-
161- - name : Cache Ruby Bundler
162- uses : actions/cache@v4
166+ ${{ runner.os }}-node-${{ env.NODE_VERSION_SANITIZED }}-
167+ - name : Cache Ruby gems
168+ uses : ./.github/ actions/cache-bundler
163169 with :
164170 path : app/vendor/bundle
165- key : ${{ runner.os }}-ruby${{ env.RUBY_VERSION }}-gems-${{ hashFiles('app/Gemfile.lock') }}
171+ lock-file : app/Gemfile.lock
172+ cache-version : ${{ env.GH_CACHE_VERSION }}-${{ env.GH_GEMS_CACHE_VERSION }}-ruby${{ env.RUBY_VERSION }}
173+ - name : Cache Pods
174+ uses : ./.github/actions/cache-pods
175+ with :
176+ path : |
177+ app/ios/Pods
178+ ~/Library/Caches/CocoaPods
179+ lock-file : app/ios/Podfile.lock
180+ - name : Cache Xcode build
181+ uses : actions/cache@v4
182+ with :
183+ path : |
184+ app/ios/build
185+ ~/Library/Developer/Xcode/DerivedData
186+ ~/Library/Caches/com.apple.dt.Xcode
187+ key : ${{ runner.os }}-xcode-${{ hashFiles('app/ios/Podfile.lock') }}-${{ hashFiles('app/ios/${{ env.IOS_PROJECT_NAME }}.xcworkspace/contents.xcworkspacedata') }}
166188 restore-keys : |
167- ${{ runner.os }}-ruby${{ env.RUBY_VERSION }}-gems-
168- - name : Cache CocoaPods
189+ ${{ runner.os }}-xcode-${{ hashFiles('app/ios/Podfile.lock') }}-
190+ ${{ runner.os }}-xcode-
191+ - name : Cache Xcode Index
169192 uses : actions/cache@v4
170193 with :
171- path : app/ios/Pods
172- key : ${{ runner.os }}-pods -${{ hashFiles('app/ios/Podfile.lock') }}
194+ path : app/ios/build/Index.noindex
195+ key : ${{ runner.os }}-xcode-index -${{ hashFiles('app/ios/Podfile.lock') }}
173196 restore-keys : |
174- ${{ runner.os }}-pods-
175- - name : Verify CocoaPods Cache
176- run : |
177- echo "Checking CocoaPods cache status..."
178- if [ -d "app/ios/Pods" ] && [ "$(ls -A app/ios/Pods)" ]; then
179- echo "✅ CocoaPods cache restored successfully"
180- ls -la app/ios/Pods/ | head -10
181-
182- # Check if key files exist
183- if [ ! -f "app/ios/Podfile.lock" ]; then
184- echo "⚠️ Podfile.lock is missing - pods cache may be stale"
185- fi
186- # If Pods directory exists but is incomplete, clear only Pods; keep Podfile.lock
187- if [ ! -d "app/ios/Pods" ] || [ -z "$(ls -A app/ios/Pods 2>/dev/null)" ]; then
188- echo "⚠️ Pods directory incomplete - clearing Pods (preserving Podfile.lock)"
189- rm -rf app/ios/Pods
190- fi
191- else
192- echo "⚠️ CocoaPods cache is empty or missing - will install fresh"
193- fi
197+ ${{ runner.os }}-xcode-index-
194198 - name : Cache Gradle
195199 uses : actions/cache@v4
196200 with :
@@ -219,7 +223,10 @@ jobs:
219223 - name : Install Mobile Dependencies
220224 uses : ./.github/actions/yarn-install
221225 - name : Build Dependencies
222- run : yarn build:deps
226+ run : |
227+ echo "Building dependencies..."
228+ yarn workspace @selfxyz/mobile-app run build:deps --silent || { echo "❌ Dependency build failed"; exit 1; }
229+ echo "✅ Dependencies built successfully"
223230 working-directory : ./app
224231 - name : Install Ruby Dependencies
225232 run : |
@@ -230,40 +237,18 @@ jobs:
230237 - name : Install iOS Dependencies
231238 run : |
232239 echo "Installing iOS dependencies..."
233-
234- # Clean Pods directory if it's corrupted or empty
235- if [ ! -d "Pods" ] || [ -z "$(ls -A Pods 2>/dev/null)" ]; then
236- echo "Cleaning empty/corrupted Pods directory..."
237- rm -rf Pods Podfile.lock
238- fi
239-
240- # Install pods
241- bundle exec pod install --silent || { echo "❌ Pod install failed"; exit 1; }
240+ (cd app/ios && pod install --silent) || { echo "❌ Pod install failed"; exit 1; }
242241 echo "✅ Pods installed successfully"
243-
244- # Verify installation
245- if [ ! -d "Pods" ] || [ -z "$(ls -A Pods 2>/dev/null)" ]; then
246- echo "❌ Pods directory is still empty after installation"
247- exit 1
248- fi
249-
250- echo "Pods directory contents:"
251- ls -la Pods/ | head -10
252-
253- # Verify key files exist
254- if [ ! -f "Pods/Target Support Files/Pods-Self/Pods-Self.debug.xcconfig" ]; then
255- echo "❌ Key CocoaPods configuration file missing"
256- exit 1
257- fi
258-
259- echo "✅ iOS dependencies installed successfully"
260242 working-directory : ./app/ios
261243 - name : Verify iOS Workspace
262244 run : |
263245 echo "Verifying iOS workspace setup..."
264246
265- if [ ! -f "OpenPassport.xcworkspace/contents.xcworkspacedata" ]; then
266- echo "❌ OpenPassport.xcworkspace is missing or corrupted"
247+ WORKSPACE_PATH="app/ios/${{ env.IOS_PROJECT_NAME }}.xcworkspace"
248+ if [ ! -d "$WORKSPACE_PATH" ]; then
249+ echo "❌ Workspace not found at: $WORKSPACE_PATH"
250+ echo "Available workspaces:"
251+ find app/ios -name "*.xcworkspace" -type d
267252 exit 1
268253 fi
269254
@@ -272,10 +257,39 @@ jobs:
272257 exit 1
273258 fi
274259
260+ # Verify scheme exists by listing available schemes
261+ echo "Verifying scheme availability..."
262+ AVAILABLE_SCHEMES=$(xcodebuild -list -workspace "$WORKSPACE_PATH" 2>/dev/null | grep -A 200 "Schemes:" | grep -v "Schemes:" | xargs)
263+ echo "Available schemes (first 20): $(echo $AVAILABLE_SCHEMES | cut -d' ' -f1-20)..."
264+
265+ if [[ ! "$AVAILABLE_SCHEMES" =~ ${{ env.IOS_PROJECT_SCHEME }} ]]; then
266+ echo "❌ Scheme '${{ env.IOS_PROJECT_SCHEME }}' not found"
267+ echo "Full scheme list:"
268+ xcodebuild -list -workspace "$WORKSPACE_PATH" 2>/dev/null | grep -A 200 "Schemes:" | grep -v "Schemes:" | head -50
269+ exit 1
270+ fi
271+
275272 echo "✅ iOS workspace is properly configured"
273+ echo "✅ Using workspace: $WORKSPACE_PATH"
274+ echo "✅ Using scheme: ${{ env.IOS_PROJECT_SCHEME }}"
276275 working-directory : ./app/ios
277276 - name : Build iOS
278- run : yarn ios
277+ run : |
278+ echo "Building iOS app..."
279+ echo "Project: ${{ env.IOS_PROJECT_NAME }}, Scheme: ${{ env.IOS_PROJECT_SCHEME }}"
280+
281+ WORKSPACE_PATH="app/ios/${{ env.IOS_PROJECT_NAME }}.xcworkspace"
282+
283+ # Use cached derived data and enable parallel builds for faster compilation
284+ xcodebuild -workspace "$WORKSPACE_PATH" \
285+ -scheme ${{ env.IOS_PROJECT_SCHEME }} \
286+ -configuration Release \
287+ -destination "generic/platform=iOS" \
288+ -derivedDataPath app/ios/build \
289+ -jobs "$(sysctl -n hw.ncpu)" \
290+ -parallelizeTargets \
291+ -quiet || { echo "❌ iOS build failed"; exit 1; }
292+ echo "✅ iOS build succeeded"
279293 working-directory : ./app
280294 - name : Build Android
281295 run : yarn android
0 commit comments