fix(mobile): add @pierre/* packages as file dependencies for CI resol… #172
Workflow file for this run
This file contains hidden or 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
| # ABOUTME: CI workflow for Pierre Mobile app (React Native/Expo) | |
| # ABOUTME: Runs unit tests, type checking, and linting on push/PR | |
| name: Mobile Tests | |
| on: | |
| push: | |
| branches: [ "main", "debug/*", "feature/*", "claude/*" ] | |
| paths: | |
| - 'frontend-mobile/**' | |
| - 'packages/**' | |
| - 'src/routes/auth.rs' | |
| - 'src/routes/coaches.rs' | |
| - 'src/routes/chat.rs' | |
| - 'src/models/**' | |
| - '.github/workflows/mobile-tests.yml' | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'frontend-mobile/**' | |
| - 'packages/**' | |
| - 'src/routes/auth.rs' | |
| - 'src/routes/coaches.rs' | |
| - 'src/routes/chat.rs' | |
| - 'src/models/**' | |
| workflow_dispatch: # Allow manual triggering | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| # Security: Explicit permissions following principle of least privilege | |
| permissions: | |
| contents: read | |
| jobs: | |
| mobile-unit-tests: | |
| name: Mobile Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install mobile dependencies | |
| working-directory: frontend-mobile | |
| run: bun install | |
| - name: Type check | |
| working-directory: frontend-mobile | |
| run: bun run typecheck | |
| - name: Run unit tests | |
| working-directory: frontend-mobile | |
| run: bun run test -- --coverage | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: mobile-coverage | |
| path: frontend-mobile/coverage/ | |
| retention-days: 7 | |
| mobile-integration-tests: | |
| name: Mobile Integration Tests (Real Server) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@1.92.0 | |
| - name: Cache Rust dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-mobile-integration-1.92.0-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-mobile-integration-1.92.0- | |
| ${{ runner.os }}-cargo- | |
| - name: Build Pierre server (release for performance) | |
| run: cargo build --release | |
| env: | |
| CARGO_INCREMENTAL: 0 | |
| - name: Install mobile dependencies | |
| working-directory: frontend-mobile | |
| run: bun install | |
| - name: Create data directory | |
| run: mkdir -p data | |
| - name: Start Pierre server | |
| run: | | |
| ./target/release/pierre-mcp-server & | |
| echo "Waiting for server to start..." | |
| for i in {1..30}; do | |
| if curl -s http://localhost:8081/health > /dev/null; then | |
| echo "Server is healthy!" | |
| break | |
| fi | |
| echo "Attempt $i: Server not ready yet..." | |
| sleep 2 | |
| done | |
| env: | |
| DATABASE_URL: "sqlite:${{ github.workspace }}/data/mobile-integration-test.db" | |
| PIERRE_MASTER_ENCRYPTION_KEY: "rEFe91l6lqLahoyl9OSzum9dKa40VvV5RYj8bHGNTeo=" | |
| PIERRE_RSA_KEY_SIZE: "2048" | |
| HTTP_PORT: "8081" | |
| RUST_LOG: "warn" | |
| STRAVA_CLIENT_ID: "test_client_id_ci" | |
| STRAVA_CLIENT_SECRET: "test_client_secret_ci" | |
| STRAVA_REDIRECT_URI: "http://localhost:8081/auth/strava/callback" | |
| - name: Run mobile integration tests | |
| working-directory: frontend-mobile | |
| run: bun run e2e:integration | |
| env: | |
| CI: true | |
| BACKEND_URL: "http://localhost:8081" | |
| - name: Upload integration test results | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: mobile-integration-test-results | |
| path: frontend-mobile/integration/ | |
| retention-days: 7 | |
| mobile-e2e-tests: | |
| name: Mobile E2E Tests (Detox) | |
| runs-on: macos-latest | |
| continue-on-error: true # E2E tests may fail without backend server in CI | |
| # Run on main branch pushes or when explicitly triggered | |
| if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' | |
| defaults: | |
| run: | |
| working-directory: frontend-mobile | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Setup Expo | |
| run: bunx expo install | |
| - name: List available simulators | |
| run: xcrun simctl list devices available | |
| - name: Boot iOS Simulator | |
| run: | | |
| # Try iPhone 16 first, then fall back to any iPhone | |
| SIMULATOR_UDID=$(xcrun simctl list devices available | grep "iPhone 16 Pro (" | head -1 | grep -oE '[0-9A-Fa-f-]{36}') | |
| if [ -z "$SIMULATOR_UDID" ]; then | |
| echo "iPhone 16 Pro not found, trying iPhone 16..." | |
| SIMULATOR_UDID=$(xcrun simctl list devices available | grep "iPhone 16 (" | head -1 | grep -oE '[0-9A-Fa-f-]{36}') | |
| fi | |
| if [ -z "$SIMULATOR_UDID" ]; then | |
| echo "iPhone 16 not found, using any available iPhone..." | |
| SIMULATOR_UDID=$(xcrun simctl list devices available | grep "iPhone" | head -1 | grep -oE '[0-9A-Fa-f-]{36}') | |
| fi | |
| if [ -z "$SIMULATOR_UDID" ]; then | |
| echo "No iPhone simulator found!" | |
| exit 1 | |
| fi | |
| echo "Booting simulator: $SIMULATOR_UDID" | |
| xcrun simctl boot "$SIMULATOR_UDID" || echo "Simulator may already be booted" | |
| - name: Install applesimutils | |
| run: | | |
| brew tap wix/brew | |
| brew install applesimutils | |
| - name: Prebuild iOS | |
| run: bunx expo prebuild --platform ios --clean | |
| - name: Build Detox | |
| run: bunx detox build --configuration ios.sim.debug | |
| env: | |
| RCT_NO_LAUNCH_PACKAGER: 1 | |
| - name: Run Detox E2E tests | |
| run: bunx detox test --configuration ios.sim.debug --headless | |
| env: | |
| RCT_NO_LAUNCH_PACKAGER: 1 | |
| - name: Upload E2E test artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: detox-artifacts-ios | |
| path: frontend-mobile/artifacts/ | |
| retention-days: 7 | |
| mobile-e2e-tests-android: | |
| name: Mobile E2E Tests - Android (Detox) | |
| runs-on: ubuntu-latest | |
| continue-on-error: true # E2E tests may fail without backend server in CI | |
| # Run on main branch pushes or when explicitly triggered | |
| if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' | |
| defaults: | |
| run: | |
| working-directory: frontend-mobile | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Java 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Setup Expo | |
| run: bunx expo install | |
| - name: Prebuild Android | |
| run: bunx expo prebuild --platform android --clean | |
| - name: Enable KVM for Android emulator | |
| run: | | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| - name: Build Detox APK | |
| run: bunx detox build --configuration android.emu.debug | |
| env: | |
| RCT_NO_LAUNCH_PACKAGER: 1 | |
| - name: Run Android E2E tests | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: 33 | |
| target: google_apis | |
| arch: x86_64 | |
| profile: Pixel 6 | |
| avd-name: Pixel_6_API_33 | |
| force-avd-creation: true | |
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
| disable-animations: true | |
| script: | | |
| cd frontend-mobile | |
| bunx detox test --configuration android.emu.debug --headless | |
| - name: Upload Android E2E test artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: detox-artifacts-android | |
| path: frontend-mobile/artifacts/ | |
| retention-days: 7 |