Skip to content

Commit

Permalink
test(preview): add e2e tests in workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
byCedric committed Feb 18, 2023
1 parent 5e47f55 commit 9c25434
Showing 1 changed file with 100 additions and 0 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,106 @@ jobs:
if: ${{ env.hasAuth == 'true' }}
run: expo whoami

preview:
runs-on: ubuntu-latest
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v3

- name: 🏗 Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn

- name: 🏗 Setup EAS
uses: ./
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

- name: 🏗 Setup project
run: yarn create expo-app ./temp

- 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
- 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@v6
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@v6
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
echo $(jq '.expo.android.runtimeVersion.policy = "sdkVersion"') > app.json
echo $(jq '.expo.ios.runtimeVersion.policy = "appVersion"') > 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@v6
with:
script: |
const comment = `${{ steps.multi-qr.outputs.comment }}`
if (!comment) {
console.log({ comment });
throw new Error('Message output is empty');
}
preview-comment:
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit 9c25434

Please sign in to comment.