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-20.04 36 env: 37 UPDATES_PORT: 4747 38 steps: 39 - name: ⬢ Setup Node 40 uses: actions/setup-node@v3 41 with: 42 node-version: '14.17' 43 - name: Check out repository 44 uses: actions/checkout@v3 45 with: 46 submodules: false 47 - name: Use JDK 11 48 uses: actions/setup-java@v3 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 yarn resolutions for local dependencies 74 working-directory: ../updates-e2e 75 run: | 76 # A jq filter to add a "resolutions" field 77 JQ_FILTER=$(cat << EOF 78 . + { 79 resolutions: { 80 "expo-application": "file:../expo/packages/expo-application", 81 "expo-constants": "file:../expo/packages/expo-constants", 82 "expo-eas-client": "file:../expo/packages/expo-eas-client", 83 "expo-error-recovery": "file:../expo/packages/expo-error-recovery", 84 "expo-file-system": "file:../expo/packages/expo-file-system", 85 "expo-font": "file:../expo/packages/expo-font", 86 "expo-json-utils": "file:../expo/packages/expo-json-utils", 87 "expo-keep-awake": "file:../expo/packages/expo-keep-awake", 88 "expo-manifests": "file:../expo/packages/expo-manifests", 89 "expo-modules-core": "file:../expo/packages/expo-modules-core", 90 "expo-structured-headers": "file:../expo/packages/expo-structured-headers", 91 "expo-updates-interface": "file:../expo/packages/expo-updates-interface" 92 } 93 } 94 EOF 95 ) 96 jq "$JQ_FILTER" < package.json > new-package.json 97 mv new-package.json package.json 98 - name: Add local expo packages 99 working-directory: ../updates-e2e 100 run: yarn add file:../expo/packages/expo-updates file:../expo/packages/expo file:../expo/packages/expo-splash-screen file:../expo/packages/expo-status-bar 101 - name: Setup app.config.json 102 working-directory: ../updates-e2e 103 run: echo "{\"name\":\"updates-e2e\",\"plugins\":[\"expo-updates\"],\"android\":{\"package\":\"dev.expo.updatese2e\"},\"ios\":{\"bundleIdentifier\":\"dev.expo.updatese2e\"}}" > app.config.json 104 - name: Pack latest bare-minimum template as tarball for expo prebuild 105 working-directory: templates/expo-template-bare-minimum 106 run: npm pack --pack-destination ../../../updates-e2e/ 107 - name: Prebuild 108 working-directory: ../updates-e2e 109 run: expo-cli prebuild --template expo-template-bare-minimum-*.tgz 110 - name: Copy App.js from test fixtures 111 working-directory: ../updates-e2e 112 run: cp ../expo/packages/expo-updates/e2e/__tests__/fixtures/App.js . 113 - name: Set port in App.js 114 working-directory: ../updates-e2e 115 run: sed -i -e "s/UPDATES_PORT/$UPDATES_PORT/" ./App.js 116 - name: Assemble release APK 117 working-directory: ../updates-e2e/android 118 run: ./gradlew assembleRelease 119 - name: Copy APK to working directory 120 run: cp -R ../updates-e2e/android/app/build/outputs/apk artifact 121 - name: Upload test APK artifact 122 uses: actions/upload-artifact@v3 123 with: 124 name: updates-e2e-android-apk 125 path: artifact 126 - name: Get test APK path 127 id: test-apk-path 128 working-directory: ../updates-e2e/android/app/build/outputs/apk/release 129 run: echo "::set-output name=dir::$(pwd)" 130 - name: Run tests 131 env: 132 TEST_APK_PATH: '${{ steps.test-apk-path.outputs.dir }}/app-release.apk' 133 timeout-minutes: 30 134 uses: reactivecircus/android-emulator-runner@v2 135 with: 136 api-level: 29 137 emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -no-snapshot-save 138 script: yarn test --config e2e/jest.config.js 139 working-directory: packages/expo-updates 140