xref: /expo/.github/workflows/updates-e2e.yml (revision ca5a2fa2)
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-11
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 13.2.1
54        run: sudo xcode-select --switch /Applications/Xcode_13.2.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      - name: �� Yarn install
70        if: steps.expo-caches.outputs.yarn-workspace-hit != 'true'
71        run: yarn install --frozen-lockfile
72      - name: Build expo-updates CLI
73        working-directory: packages/expo-updates
74        run: yarn build:cli
75      - name: �� Install Expo CLI
76        run: yarn global add expo-cli
77      - name: �� Add EXPO_REPO_ROOT to environment
78        run: echo "EXPO_REPO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
79      - name: �� Get local IP address
80        run: echo "UPDATES_HOST=$(ifconfig -l | xargs -n1 ipconfig getifaddr)" >> $GITHUB_ENV
81      - name: �� Get artifacts path
82        run: mkdir -p artifact && echo "ARTIFACTS_DEST=$(pwd)/artifact" >> $GITHUB_ENV
83      - name: �� Setup test project and build
84        run: node packages/expo-updates/e2e/__tests__/setup/index.js
85      - name: Upload test project artifacts
86        uses: actions/upload-artifact@v3
87        with:
88          name: updates-e2e-artifacts
89          path: artifact
90      - name: �� Start iOS simulator
91        run: |
92          xcrun simctl list devices -j \
93          | jq -rc '[ .[] | .[] | .[] | select( .name | contains( "iPhone" ) ) | select( .isAvailable == true ) ] | last.udid ' \
94          | xargs open -a Simulator --args -CurrentDeviceUDID
95      - name: �� Run iOS tests
96        timeout-minutes: 30
97        working-directory: packages/expo-updates
98        run: yarn test --config e2e/jest.config.ios.js
99      - name: �� Start Android emulator and run tests
100        timeout-minutes: 30
101        uses: reactivecircus/android-emulator-runner@v2
102        with:
103          api-level: ${{ matrix.api-level }}
104          avd-name: avd-${{ matrix.api-level }}
105          arch: x86_64
106          force-avd-creation: false
107          script: yarn test --config e2e/jest.config.android.js
108          working-directory: packages/expo-updates
109