test #1433
This file contains 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: test | |
on: | |
schedule: | |
- cron: '0 15 * * *' | |
push: | |
branches: [main] | |
pull_request: | |
types: [opened, synchronize] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
hasAuth: ${{ !!secrets.EXPO_TOKEN }} | |
jobs: | |
setup: | |
strategy: | |
matrix: | |
os: [ubuntu, windows, macos] | |
cache: [cache, no-cache] | |
packager: [bun, npm, yarn] | |
exclude: | |
# Mac can't unpack caches that fast | |
- os: macos | |
cache: cache | |
# Windows can't unpack caches that fast | |
- os: windows | |
cache: cache | |
# Bun isn't supported on Windows (yet) | |
- os: windows | |
packager: bun | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- name: 🏗 Setup repo | |
uses: actions/checkout@v4 | |
- name: 🏗 Setup runner | |
uses: ./.github/actions/setup | |
- name: 🏗 Setup Expo | |
uses: ./ | |
with: | |
eas-version: latest | |
eas-cache: ${{ matrix.cache == 'cache' }} | |
expo-version: latest | |
expo-cache: ${{ matrix.cache == 'cache' }} | |
packager: ${{ matrix.packager }} | |
token: ${{ secrets.EXPO_TOKEN }} | |
- name: 🧪 EAS installed | |
run: eas --version | |
- name: 🧪 EAS authenticated | |
if: ${{ env.hasAuth == 'true' }} | |
run: eas whoami | |
- name: 🧪 Expo installed | |
run: expo --version | |
- name: 🧪 Expo authenticated | |
if: ${{ env.hasAuth == 'true' }} | |
run: expo whoami | |
preview: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🏗 Setup repo | |
uses: actions/checkout@v4 | |
- name: 🏗 Setup runner | |
uses: ./.github/actions/setup | |
- name: 🏗 Setup EAS | |
uses: ./ | |
with: | |
eas-version: latest | |
packager: bun | |
token: ${{ secrets.EXPO_TOKEN }} | |
- name: 🏗 Setup project | |
run: bun create expo ./temp --template blank | |
- name: 🏗 Setup `expo-dev-client` | |
working-directory: ./temp | |
run: bun expo install expo-dev-client | |
- name: 👷 Configure project | |
working-directory: ./temp | |
run: | | |
eas init --id ${{ secrets.EXPO_PROJECT_ID }} --force --non-interactive | |
echo $(jq '.expo.runtimeVersion.policy = "sdkVersion"' app.json) > app.json | |
echo $(jq '.expo.scheme = ["expogithubaction", "ega"]' app.json) > app.json | |
- name: 🚀 Create preview (without comment) | |
if: ${{ env.hasAuth == 'true' }} | |
uses: ./preview | |
id: no-comment | |
env: | |
EXPO_TEST_GITHUB_PULL: 206 | |
with: | |
working-directory: ./temp | |
command: eas update --branch test --message "This is a test" | |
comment: false | |
- name: 🧪 Comment has content | |
if: ${{ env.hasAuth == 'true' }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const comment = `${{ steps.no-comment.outputs.comment }}` | |
if (!comment) { | |
console.log({ comment }); | |
throw new Error('Message output is empty'); | |
} | |
- name: 🚀 Create preview (single QR) | |
if: ${{ env.hasAuth == 'true' }} | |
id: single-qr | |
uses: ./preview | |
env: | |
EXPO_TEST_GITHUB_PULL: 206 | |
with: | |
working-directory: ./temp | |
command: eas update --branch test --message "This is a test" | |
comment-id: 'projectId:{projectId} single-qr' | |
- name: 🧪 Single QR has content | |
if: ${{ env.hasAuth == 'true' }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const comment = `${{ steps.single-qr.outputs.comment }}` | |
if (!comment) { | |
console.log({ comment }); | |
throw new Error('Message output is empty'); | |
} | |
- name: 👷 Configure runtime versions | |
working-directory: ./temp | |
run: | | |
echo $(jq 'del(.expo.runtimeVersion)' app.json) > app.json | |
echo $(jq '.expo.android.runtimeVersion.policy = "sdkVersion"' app.json) > app.json | |
echo $(jq '.expo.ios.runtimeVersion.policy = "appVersion"' app.json) > app.json | |
echo $(jq '.expo.scheme = "expogithubaction"' app.json) > app.json | |
- name: 🚀 Create preview (multi QR) | |
if: ${{ env.hasAuth == 'true' }} | |
id: multi-qr | |
uses: ./preview | |
env: | |
EXPO_TEST_GITHUB_PULL: 206 | |
with: | |
working-directory: ./temp | |
command: eas update --branch test --message "This is a test" | |
comment-id: 'projectId:{projectId} multi-qr' | |
- name: 🧪 Multi QR has content | |
if: ${{ env.hasAuth == 'true' }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const comment = `${{ steps.multi-qr.outputs.comment }}` | |
if (!comment) { | |
console.log({ comment }); | |
throw new Error('Message output is empty'); | |
} | |
- name: 🚀 Create preview (with "dev-build" QR target) | |
if: ${{ env.hasAuth == 'true' }} | |
uses: ./preview | |
id: dev-build-qr | |
env: | |
EXPO_TEST_GITHUB_PULL: 206 | |
with: | |
working-directory: ./temp | |
command: eas update --branch test --message "This is a test" | |
comment: false | |
- name: 🧪 Comment has "dev-build" QR | |
if: ${{ env.hasAuth == 'true' }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const qrUrl = `${{ steps.dev-build-qr.outputs.qr }}` | |
if (!qrUrl || !qrUrl.includes('appScheme')) { | |
console.log({ qrUrl }); | |
throw new Error('QR URL is missing "appScheme" to point to a dev build'); | |
} | |
- name: 🚀 Create preview (with "expo-go" QR target from input) | |
if: ${{ env.hasAuth == 'true' }} | |
uses: ./preview | |
id: expo-go-qr | |
env: | |
EXPO_TEST_GITHUB_PULL: 206 | |
with: | |
working-directory: ./temp | |
qr-target: expo-go | |
command: eas update --branch test --message "This is a test" | |
comment: false | |
- name: 🧪 Comment has "expo-go" QR code | |
if: ${{ env.hasAuth == 'true' }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const qrUrl = `${{ steps.expo-go-qr.outputs.qr }}` | |
if (!qrUrl || qrUrl.includes('appScheme')) { | |
console.log({ qrUrl }); | |
throw new Error('QR URL points to a dev build, not Expo Go'); | |
} | |
preview-comment: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🏗 Setup repo | |
uses: actions/checkout@v4 | |
- name: 🏗 Setup runner | |
uses: ./.github/actions/setup | |
- name: 🏗 Setup Expo | |
uses: ./ | |
with: | |
eas-version: latest | |
expo-version: latest | |
packager: bun | |
token: ${{ secrets.EXPO_TOKEN }} | |
- name: 🏗 Setup project | |
run: bun create expo ./temp --template blank | |
- name: 🧪 Without commenting | |
if: ${{ env.hasAuth == 'true' }} | |
uses: ./preview-comment | |
id: preview | |
with: | |
project: ./temp | |
comment: false | |
- name: 🧪 Output has content | |
if: ${{ env.hasAuth == 'true' }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const message = `${{ steps.preview.outputs.message }}` | |
if (!message) throw new Error('Message output is empty') | |
- name: 🧪 Comment on PR (github-token) | |
if: ${{ env.hasAuth == 'true' }} | |
uses: ./preview-comment | |
env: | |
EXPO_TEST_GITHUB_PULL: 149 | |
with: | |
project: ./temp | |
channel: test | |
- name: 🧪 Comment on PR (GITHUB_TOKEN) | |
if: ${{ env.hasAuth == 'true' }} | |
uses: ./preview-comment | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
EXPO_TEST_GITHUB_PULL: 149 | |
with: | |
project: ./temp | |
channel: test | |
github-token: badtoken |