xref: /expo/.github/workflows/updates-e2e.yml (revision 75e080d0)
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  push:
17    branches: [main, 'sdk-*']
18    paths:
19      - .github/workflows/updates-e2e.yml
20      - packages/expo-json-utils/**
21      - packages/expo-manifests/**
22      - packages/expo-modules-core/**
23      - packages/expo-structured-headers/**
24      - packages/expo-updates-interface/**
25      - packages/expo-updates/**
26      - packages/expo/android/**
27      - packages/expo/ios/**
28
29concurrency:
30  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
31  cancel-in-progress: true
32
33jobs:
34  android:
35    runs-on: ubuntu-latest
36    env:
37      UPDATES_PORT: 4747
38    steps:
39      - name: ⬢ Setup Node
40        uses: actions/setup-node@v2
41        with:
42          node-version: '14.17'
43      - name: Check out repository
44        uses: actions/checkout@v2
45        with:
46          submodules: false
47      - name: �� Use JDK 11
48        uses: actions/setup-java@v2
49        with:
50          distribution: 'temurin'
51          java-version: '11'
52      - name: Get yarn cache directory path
53        id: yarn-cache-dir-path
54        run: echo "::set-output name=dir::$(yarn cache dir)"
55      - uses: actions/cache@v2
56        with:
57          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
58          key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
59          restore-keys: |
60            ${{ runner.os }}-yarn-
61      - run: yarn install --frozen-lockfile
62      - uses: actions/cache@v2
63        with:
64          path: ~/.gradle/caches
65          key: ${{ runner.os }}-gradle-${{ hashFiles('android/*.gradle*') }}
66          restore-keys: |
67            ${{ runner.os }}-gradle-
68      - run: yarn global add expo-cli
69      - run: echo "$(yarn global bin)" >> $GITHUB_PATH
70      - name: Init new expo app
71        working-directory: ../
72        run: expo-cli init updates-e2e --yes
73      - name: Add local expo-updates and dependencies
74        working-directory: ../updates-e2e
75        # install expo packages (including transitive packages) locally
76        run: yarn add file:../expo/packages/expo-updates file:../expo/packages/expo file:../expo/packages/expo-eas-client file:../expo/packages/expo-modules-core file:../expo/packages/expo-json-utils file:../expo/packages/expo-manifests file:../expo/packages/expo-structured-headers file:../expo/packages/expo-updates-interface file:../expo/packages/expo-constants file:../expo/packages/expo-file-system file:../expo/packages/expo-font file:../expo/packages/expo-keep-awake file:../expo/packages/expo-splash-screen file:../expo/packages/expo-status-bar file:../expo/packages/expo-application file:../expo/packages/expo-error-recovery
77      - name: Setup app.config.json
78        working-directory: ../updates-e2e
79        run: echo "{\"name\":\"updates-e2e\",\"plugins\":[\"expo-updates\"],\"android\":{\"package\":\"dev.expo.updatese2e\"},\"ios\":{\"bundleIdentifier\":\"dev.expo.updatese2e\"}}" > app.config.json
80      - name: Pack latest bare-minimum template as tarball for expo prebuild
81        working-directory: templates/expo-template-bare-minimum
82        run: npm pack --pack-destination ../../../updates-e2e/
83      - name: Prebuild
84        working-directory: ../updates-e2e
85        run: expo-cli prebuild --template expo-template-bare-minimum-*.tgz
86      - name: Copy App.js from test fixtures
87        working-directory: ../updates-e2e
88        run: cp ../expo/packages/expo-updates/e2e/__tests__/fixtures/App.js .
89      - name: Set port in App.js
90        working-directory: ../updates-e2e
91        run: sed -i -e "s/UPDATES_PORT/$UPDATES_PORT/" ./App.js
92      - name: Assemble release APK
93        working-directory: ../updates-e2e/android
94        run: ./gradlew assembleRelease
95      - name: Copy APK to working directory
96        run: cp -R ../updates-e2e/android/app/build/outputs/apk artifact
97      - name: Upload test APK artifact
98        uses: actions/upload-artifact@v2
99        with:
100          name: updates-e2e-android-apk
101          path: artifact
102      - name: Get test APK path
103        id: test-apk-path
104        working-directory: ../updates-e2e/android/app/build/outputs/apk/release
105        run: echo "::set-output name=dir::$(pwd)"
106      - name: Run tests
107        env:
108          TEST_APK_PATH: '${{ steps.test-apk-path.outputs.dir }}/app-release.apk'
109        timeout-minutes: 30
110        uses: reactivecircus/android-emulator-runner@v2
111        with:
112          api-level: 29
113          emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -no-snapshot-save
114          script: yarn test --config e2e/jest.config.js
115          working-directory: packages/expo-updates
116