E2E #2620
Workflow file for this run
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: E2E | |
on: [deployment_status] | |
jobs: | |
e2e: | |
# only runs this job on successful deploy | |
if: github.event.deployment_status.state == 'success' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# fetch all commits so we can find the branch | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
cache: "yarn" | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps chromium | |
- name: Run Playwright tests | |
run: yarn e2e | |
env: | |
E2E_BASE_URL: ${{ github.event.deployment_status.target_url }} | |
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} | |
- name: Upload E2E artifacts to job | |
uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: e2e-screenshots | |
path: | | |
e2e-screenshots | |
playwright-report | |
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#job-status-check-functions | |
- name: E2E tests ✅ | |
if: ${{ success() }} | |
# set the merge commit status check | |
# using GitHub REST API | |
# see https://docs.github.com/en/rest/reference/repos#create-a-commit-status | |
run: | | |
curl --request POST \ | |
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \ | |
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | |
--header 'content-type: application/json' \ | |
--data '{ | |
"context": "e2e", | |
"state": "success", | |
"description": "E2E tests passed" | |
}' | |
- name: E2E tests 🚨 | |
if: ${{ failure() }} | |
run: | | |
curl --request POST \ | |
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \ | |
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | |
--header 'content-type: application/json' \ | |
--data '{ | |
"context": "e2e", | |
"state": "failure", | |
"description": "E2E tests failed" | |
}' |