xref: /expo/.github/workflows/updates-e2e.yml (revision dfd15ebd)
1name: Updates e2e
2
3on:
4  workflow_dispatch: {}
5  pull_request:
6    paths:
7      - .github/workflows/updates-e2e.yml
8      - packages/expo-json-utils/**
9      - packages/expo-manifests/**
10      - packages/expo-modules-core/**
11      - packages/expo-structured-headers/**
12      - packages/expo-updates-interface/**
13      - packages/expo-updates/**
14      - packages/expo/android/**
15      - packages/expo/ios/**
16      - templates/expo-template-bare-minimum/**
17  push:
18    branches: [main, 'sdk-*']
19    paths:
20      - .github/workflows/updates-e2e.yml
21      - packages/expo-json-utils/**
22      - packages/expo-manifests/**
23      - packages/expo-modules-core/**
24      - packages/expo-structured-headers/**
25      - packages/expo-updates-interface/**
26      - packages/expo-updates/**
27      - packages/expo/android/**
28      - packages/expo/ios/**
29      - templates/expo-template-bare-minimum/**
30
31concurrency:
32  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
33  cancel-in-progress: true
34
35jobs:
36  # (2022-05): we run both iOS and Android tests in a single job in order to avoid taking up 2 macOS
37  # runners each time this workflow runs
38  build:
39    runs-on: macos-12
40    timeout-minutes: 120
41    env:
42      UPDATES_PORT: 4747
43    strategy:
44      matrix:
45        api-level: [31]
46    steps:
47      - name: �� Checkout
48        uses: actions/checkout@v3
49      - name: ⬢ Setup Node
50        uses: actions/setup-node@v3
51        with:
52          node-version: '16'
53      - name: �� Switch to Xcode 14.1
54        run: sudo xcode-select --switch /Applications/Xcode_14.1.app
55      - name: �� Use JDK 11
56        uses: actions/setup-java@v3
57        with:
58          distribution: 'temurin'
59          java-version: '11'
60      - name: ➕ Add `bin` to GITHUB_PATH
61        run: echo "$(yarn global bin)" >> $GITHUB_PATH
62      - name: ♻️ Restore caches
63        uses: ./.github/actions/expo-caches
64        id: expo-caches
65        with:
66          yarn-workspace: 'true'
67          avd: 'true'
68          avd-api: ${{ matrix.api-level }}
69          react-native-gradle-downloads: 'true'
70      - name: �� Yarn install
71        if: steps.expo-caches.outputs.yarn-workspace-hit != 'true'
72        run: yarn install --frozen-lockfile
73      - name: �� Build local Expo CLI
74        working-directory: packages/@expo/cli
75        run: yarn prepare
76      - name: Build expo-updates CLI
77        working-directory: packages/expo-updates
78        run: yarn build:cli
79      - name: �� Install Expo CLI
80        run: yarn global add expo-cli
81      - name: �� Add EXPO_REPO_ROOT to environment
82        run: echo "EXPO_REPO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
83      - name: �� Get local IP address
84        run: echo "UPDATES_HOST=$(ifconfig -l | xargs -n1 ipconfig getifaddr)" >> $GITHUB_ENV
85      - name: �� Get artifacts path
86        run: mkdir -p artifact && echo "ARTIFACTS_DEST=$(pwd)/artifact" >> $GITHUB_ENV
87      - name: �� Setup test project and build
88        run: node packages/expo-updates/e2e/__tests__/setup/index.js
89      - name: Upload test project artifacts
90        uses: actions/upload-artifact@v3
91        with:
92          name: updates-e2e-artifacts
93          path: artifact
94      - name: �� Start iOS simulator
95        run: |
96          xcrun simctl list devices -j \
97          | jq -rc '[ .[] | .[] | .[] | select( .name | contains( "iPhone" ) ) | select( .isAvailable == true ) ] | last.udid ' \
98          | xargs open -a Simulator --args -CurrentDeviceUDID
99      - name: �� Run iOS tests
100        timeout-minutes: 30
101        working-directory: packages/expo-updates
102        run: yarn test --config e2e/jest.config.ios.js --runInBand
103      - name: �� Start Android emulator and run tests
104        timeout-minutes: 30
105        uses: reactivecircus/android-emulator-runner@v2
106        with:
107          api-level: ${{ matrix.api-level }}
108          avd-name: avd-${{ matrix.api-level }}
109          arch: x86_64
110          force-avd-creation: false
111          script: yarn test --config e2e/jest.config.android.js --runInBand
112          working-directory: packages/expo-updates
113