add CI/CD setup #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: React Native iOS E2E Tests | |
on: | |
pull_request: | |
branches: [ main, develop ] | |
push: | |
branches: [ main, develop ] | |
workflow_dispatch: | |
jobs: | |
ios-e2e-tests: | |
name: iOS E2E Tests | |
runs-on: macos-13 | |
env: | |
DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.0' | |
bundler-cache: true | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: | | |
yarn install --frozen-lockfile | |
cd ios && bundle install | |
- name: Build iOS app | |
run: | | |
cd ios | |
bundle exec fastlane build_for_testing | |
cd .. | |
- name: Debug - List build directory | |
run: | | |
echo "Contents of ios/derived_data/Build/Products directory:" | |
ls -R ios/derived_data/Build/Products | |
- name: Install Maestro | |
run: | | |
curl -Ls "https://get.maestro.mobile.dev" | bash | |
echo "$HOME/.maestro/bin" >> $GITHUB_PATH | |
- name: Run Maestro tests | |
run: | | |
APP_PATH=$(find ios/derived_data/Build/Products/Debug-iphonesimulator -name "*.app" -type d | head -n 1) | |
if [ ! -d "$APP_PATH" ]; then | |
echo "Error: Could not find the built app" | |
exit 1 | |
fi | |
echo "Found app at: $APP_PATH" | |
# Ensure simulator is booted | |
xcrun simctl boot "iPhone 14" || true | |
# Install the app | |
xcrun simctl install booted "$APP_PATH" | |
# Launch the app | |
BUNDLE_ID=$(defaults read "$APP_PATH/Info" CFBundleIdentifier) | |
xcrun simctl launch booted $BUNDLE_ID | |
# Wait for the app to fully launch | |
sleep 30 | |
echo "Running Maestro tests..." | |
$HOME/.maestro/bin/maestro test e2e/main-flow-ios.yaml | |
- name: Upload Maestro logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: maestro-ios-logs | |
path: ~/.maestro/logs | |
- name: Upload build logs and app | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ios-build-logs-and-app | |
path: ios/derived_data/Build/Products |