[NT-2006] React Native Preview Panel #392
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
| name: Main Pipeline | |
| # This is a pre-NX workflow. Format, linting, type safety and unit tests are run for all | |
| # publishable packages. | |
| # | |
| # NX integration and/or other optimizations will happen separately. | |
| on: | |
| pull_request: | |
| jobs: | |
| setup: | |
| name: pnpm install 🛠️ | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'pnpm' | |
| - run: | | |
| echo "DOTENV_CONFIG_QUIET=true" >>.env | |
| echo "VITE_NINETAILED_CLIENT_ID=${{secrets.NINETAILED_CLIENT_ID}}" >>.env | |
| echo "VITE_NINETAILED_ENVIRONMENT=${{secrets.NINETAILED_ENVIRONMENT}}" >>.env | |
| echo "VITE_EXPERIENCE_API_BASE_URL=http://localhost:8000/experience/" >>.env | |
| echo "VITE_INSIGHTS_API_BASE_URL=http://localhost:8000/insights/" >>.env | |
| echo "VITE_CONTENTFUL_TOKEN=${{secrets.CONTENTFUL_TOKEN}}" >>.env | |
| echo "VITE_CONTENTFUL_PREVIEW_TOKEN=${{secrets.CONTENTFUL_PREVIEW_TOKEN}}" >>.env | |
| echo "VITE_CONTENTFUL_ENVIRONMENT=${{secrets.CONTENTFUL_ENVIRONMENT}}" >>.env | |
| echo "VITE_CONTENTFUL_SPACE_ID=${{secrets.CONTENTFUL_SPACE_ID}}" >>.env | |
| echo "VITE_CONTENTFUL_CDA_HOST=localhost:8000" >>.env | |
| echo "VITE_CONTENTFUL_BASE_PATH=contentful" >>.env | |
| - run: cp .env implementations/node-ssr/ | |
| - run: cp .env implementations/web-vanilla/ | |
| - uses: actions/cache@v5 | |
| id: dotenv-cache | |
| with: | |
| path: | | |
| .env | |
| implementations/node-ssr/.env | |
| implementations/web-vanilla/.env | |
| key: ${{ runner.os }}-dotenv | |
| - uses: actions/cache@v5 | |
| id: node-modules-cache | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-pnpm-${{ hashFiles('pnpm-lock.yaml') }} | |
| - if: steps.node-modules-cache.outputs.cache-hit != 'true' | |
| run: pnpm i --prefer-offline --frozen-lockfile | |
| license-check: | |
| name: License Check 📄 | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dorny/paths-filter@v3 | |
| id: changes | |
| with: | |
| filters: | | |
| lock: | |
| - 'pnpm-lock.yaml' | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - uses: actions/cache@v5 | |
| if: steps.filter.outputs.lock == 'true' | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-pnpm-${{ hashFiles('pnpm-lock.yaml') }} | |
| - if: steps.filter.outputs.lock == 'true' | |
| run: > | |
| echo "In case of error, please see ./CONTRIBUTING.md" pnpx license-checker \ --summary \ | |
| --production \ --relativeLicensePath \ --onlyAllow | |
| 'MIT;Apache-2.0;ISC;BSD-3-Clause;BSD-2-Clause;MIT*;Apache | |
| 2.0;Unlicense;Unlicensed;:CC0-1.0;CC-BY-4.0;WTFPL;0BSD;UNLICENSED;Python-2.0;MPL-2.0;CC-BY-3.0;CC0-1.0' | |
| format: | |
| name: Format Check 🎨 | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - uses: actions/cache@v5 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-pnpm-${{ hashFiles('pnpm-lock.yaml') }} | |
| - run: pnpm i --prefer-offline --frozen-lockfile | |
| - run: pnpm format:check | |
| build: | |
| name: Build 📦 | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| needs: setup | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - uses: actions/cache@v5 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-pnpm-${{ hashFiles('pnpm-lock.yaml') }} | |
| - run: pnpm i --prefer-offline --frozen-lockfile | |
| - run: pnpm build | |
| type-check: | |
| name: Type Check 🔷 | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - uses: actions/cache@v5 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-pnpm-${{ hashFiles('pnpm-lock.yaml') }} | |
| - run: pnpm i --prefer-offline --frozen-lockfile | |
| - run: pnpm typecheck | |
| lint: | |
| name: Lint 🎨 | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - uses: actions/cache@v5 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-pnpm-${{ hashFiles('pnpm-lock.yaml') }} | |
| - run: pnpm i --prefer-offline --frozen-lockfile | |
| - run: pnpm lint:check | |
| test: | |
| name: Test 🧪 | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| needs: setup | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - uses: actions/cache@v5 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-pnpm-${{ hashFiles('pnpm-lock.yaml') }} | |
| - run: pnpm i --prefer-offline --frozen-lockfile | |
| - run: pnpm test:unit | |
| e2e-node: | |
| name: E2E Node 🖥️ | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| needs: setup | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - run: | | |
| echo "DOTENV_CONFIG_QUIET=true" >>implementations/node-ssr/.env | |
| echo "VITE_NINETAILED_CLIENT_ID=${{secrets.NINETAILED_CLIENT_ID}}" >>implementations/node-ssr/.env | |
| echo "VITE_NINETAILED_ENVIRONMENT=${{secrets.NINETAILED_ENVIRONMENT}}" >>implementations/node-ssr/.env | |
| echo "VITE_EXPERIENCE_API_BASE_URL=http://localhost:8000/experience/" >>implementations/node-ssr/.env | |
| echo "VITE_INSIGHTS_API_BASE_URL=http://localhost:8000/insights/" >>implementations/node-ssr/.env | |
| echo "VITE_CONTENTFUL_TOKEN=${{secrets.CONTENTFUL_TOKEN}}" >>implementations/node-ssr/.env | |
| echo "VITE_CONTENTFUL_PREVIEW_TOKEN=${{secrets.CONTENTFUL_PREVIEW_TOKEN}}" >>implementations/node-ssr/.env | |
| echo "VITE_CONTENTFUL_ENVIRONMENT=${{secrets.CONTENTFUL_ENVIRONMENT}}" >>implementations/node-ssr/.env | |
| echo "VITE_CONTENTFUL_SPACE_ID=${{secrets.CONTENTFUL_SPACE_ID}}" >>implementations/node-ssr/.env | |
| echo "VITE_CONTENTFUL_CDA_HOST=localhost:8000" >>implementations/node-ssr/.env | |
| echo "VITE_CONTENTFUL_BASE_PATH=contentful" >>implementations/node-ssr/.env | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - uses: actions/cache@v5 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-pnpm-${{ hashFiles('pnpm-lock.yaml') }} | |
| - run: pnpm i --prefer-offline --frozen-lockfile | |
| - run: pnpm --filter @implementation/node exec playwright install --with-deps | |
| - run: pnpm --filter @implementation/node test:e2e | |
| - uses: actions/upload-artifact@v6 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: ci-results-node | |
| path: | | |
| ./implementations/node-ssr/playwright-report/ | |
| ./implementations/node-ssr/test-results/ | |
| retention-days: 1 | |
| e2e-web: | |
| name: E2E Web Vanilla 🖥️ | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| needs: setup | |
| steps: | |
| - uses: docker/setup-compose-action@v1 | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - uses: actions/cache@v5 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-pnpm-${{ hashFiles('pnpm-lock.yaml') }} | |
| - uses: actions/cache@v5 | |
| with: | |
| path: | | |
| .env | |
| implementations/node-ssr/.env | |
| implementations/web-vanilla/.env | |
| key: ${{ runner.os }}-dotenv | |
| - run: pnpm i --prefer-offline --frozen-lockfile | |
| - run: pnpm --filter @implementation/web-vanilla exec playwright install --with-deps | |
| - run: pnpm --filter @implementation/web-vanilla test:e2e | |
| - uses: actions/upload-artifact@v6 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: ci-results-web-vanilla | |
| path: | | |
| ./implementations/web-vanilla/playwright-report/ | |
| ./implementations/web-vanilla/test-results/ | |
| retention-days: 1 | |
| e2e-react-native-android: | |
| name: E2E React Native Android 📱 | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 60 | |
| needs: setup | |
| env: | |
| DETOX_AVD_NAME: test | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Free Disk Space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android/sdk/ndk | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| sudo docker image prune --all --force | |
| df -h | |
| - name: Enable KVM | |
| 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 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'pnpm' | |
| - name: Setup Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - uses: actions/cache@v5 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-pnpm-${{ hashFiles('pnpm-lock.yaml') }} | |
| - run: pnpm i --prefer-offline --frozen-lockfile | |
| - name: Create .env file for React Native | |
| run: | | |
| cat > implementations/react-native/.env << 'EOF' | |
| VITE_NINETAILED_CLIENT_ID=${{ secrets.NINETAILED_CLIENT_ID }} | |
| VITE_NINETAILED_ENVIRONMENT=${{ secrets.NINETAILED_ENVIRONMENT }} | |
| VITE_EXPERIENCE_API_BASE_URL=http://localhost:8000/experience/ | |
| VITE_INSIGHTS_API_BASE_URL=http://localhost:8000/insights/ | |
| VITE_CONTENTFUL_TOKEN=${{ secrets.CONTENTFUL_TOKEN }} | |
| VITE_CONTENTFUL_ENVIRONMENT=${{ secrets.CONTENTFUL_ENVIRONMENT }} | |
| VITE_CONTENTFUL_SPACE_ID=${{ secrets.CONTENTFUL_SPACE_ID }} | |
| VITE_CONTENTFUL_CDA_HOST=localhost:8000 | |
| VITE_CONTENTFUL_BASE_PATH=contentful | |
| EOF | |
| - name: Start Mock Server | |
| run: | | |
| pnpm --filter mocks serve > /tmp/mock-server.log 2>&1 & | |
| echo $! > /tmp/mock-server.pid | |
| for i in {1..30}; do | |
| if nc -z localhost 8000 2>/dev/null; then | |
| echo "Mock server is ready" | |
| break | |
| fi | |
| echo "Waiting for mock server... ($i/30)" | |
| sleep 1 | |
| done | |
| if ! nc -z localhost 8000 2>/dev/null; then | |
| echo "Mock server failed to start:" | |
| cat /tmp/mock-server.log | |
| exit 1 | |
| fi | |
| - name: Start Metro Bundler | |
| run: | | |
| cd implementations/react-native | |
| npx react-native start --port 8081 > /tmp/metro.log 2>&1 & | |
| echo $! > /tmp/metro.pid | |
| sleep 15 | |
| - name: Cache Gradle dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| implementations/react-native/android/.gradle | |
| key: | |
| ${{ runner.os }}-gradle-${{ | |
| hashFiles('implementations/react-native/android/**/*.gradle*', | |
| 'implementations/react-native/android/gradle/wrapper/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Run Android E2E Tests | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: 33 | |
| arch: x86_64 | |
| target: google_apis | |
| avd-name: test | |
| force-avd-creation: true | |
| emulator-options: | |
| -no-window -no-audio -no-boot-anim -gpu swiftshader_indirect -no-snapshot-save | |
| disable-animations: true | |
| emulator-boot-timeout: 300 | |
| disk-size: 6G | |
| script: | | |
| echo "Verifying JAVA_HOME: $JAVA_HOME" | |
| java -version | |
| echo "Setting up adb reverse port forwarding..." | |
| adb reverse tcp:8000 tcp:8000 | |
| adb reverse tcp:8081 tcp:8081 | |
| echo "Building Android app..." | |
| pnpm --filter @implementation/react-native test:e2e:android:build | |
| echo "Running E2E tests..." | |
| pnpm --filter @implementation/react-native test:e2e:android:run | |
| - name: Upload Metro logs on failure | |
| if: failure() | |
| run: | | |
| echo "=== Metro Bundler Logs ===" | |
| cat /tmp/metro.log || echo "No metro logs found" | |
| echo "=== Mock Server Logs ===" | |
| cat /tmp/mock-server.log || echo "No mock server logs found" | |
| - name: Stop Metro and Mock Server | |
| if: always() | |
| run: | | |
| kill $(cat /tmp/metro.pid) 2>/dev/null || true | |
| kill $(cat /tmp/mock-server.pid) 2>/dev/null || true | |
| - uses: actions/upload-artifact@v6 | |
| if: always() | |
| with: | |
| name: ci-results-react-native-android | |
| path: | | |
| implementations/react-native/android/app/build/outputs/ | |
| implementations/react-native/.detox/ | |
| implementations/react-native/android/app/build/reports/ | |
| /tmp/metro.log | |
| /tmp/mock-server.log | |
| retention-days: 7 |