2023-05-30 15:23:28 +00:00
|
|
|
name: End to end tests
|
2023-05-30 14:28:56 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
merge_group:
|
|
|
|
push:
|
|
|
|
branches: [main]
|
|
|
|
|
|
|
|
env:
|
|
|
|
CI: 1
|
|
|
|
PRINT_GITHUB_ANNOTATIONS: 1
|
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: 'End to end tests'
|
|
|
|
timeout-minutes: 60
|
2023-06-23 11:53:04 +00:00
|
|
|
runs-on: ubuntu-latest-16-cores-open
|
2023-05-30 14:28:56 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Check out code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Setup Node.js environment
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
2023-12-12 11:36:52 +00:00
|
|
|
node-version: 18.18.2
|
2023-05-30 14:28:56 +00:00
|
|
|
cache: 'yarn'
|
|
|
|
|
|
|
|
- name: Enable corepack
|
|
|
|
run: corepack enable
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: yarn
|
|
|
|
|
2023-10-12 09:28:55 +00:00
|
|
|
- name: Get installed Playwright version
|
|
|
|
id: playwright-version
|
|
|
|
run: |
|
|
|
|
cd apps/examples
|
|
|
|
yarn info @playwright/test --json > playwright.json
|
|
|
|
echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./playwright.json').children.Version)")" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
name: Check for Playwright browsers cache
|
|
|
|
id: playwright-cache
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/ms-playwright
|
|
|
|
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
|
|
|
|
|
|
|
|
- name: Install Playwright Browsers
|
2023-06-23 11:53:04 +00:00
|
|
|
run: npx playwright install --with-deps chromium chrome
|
2023-10-12 09:28:55 +00:00
|
|
|
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
2023-05-30 14:28:56 +00:00
|
|
|
|
|
|
|
- name: Run Playwright tests
|
2023-06-23 11:53:04 +00:00
|
|
|
run: 'yarn e2e'
|
|
|
|
working-directory: apps/examples
|
2023-05-30 14:28:56 +00:00
|
|
|
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
if: always()
|
|
|
|
with:
|
|
|
|
name: playwright-report
|
2023-06-23 11:53:04 +00:00
|
|
|
path: apps/examples/playwright-report
|
2023-05-30 14:28:56 +00:00
|
|
|
retention-days: 30
|
2023-06-23 11:53:04 +00:00
|
|
|
|
|
|
|
- uses: shallwefootball/s3-upload-action@master
|
2023-10-13 13:42:41 +00:00
|
|
|
# only upload if we have AWS credentials:
|
|
|
|
env:
|
|
|
|
HAS_AWS_KEY: ${{ secrets.AWS_S3_SECRET_KEY && '1' || '' }}
|
|
|
|
if: always() && env.HAS_AWS_KEY == '1'
|
2023-06-23 11:53:04 +00:00
|
|
|
name: Upload S3
|
|
|
|
id: s3
|
|
|
|
with:
|
|
|
|
aws_key_id: ${{ secrets.AWS_S3_KEY_ID }}
|
|
|
|
aws_secret_access_key: ${{ secrets.AWS_S3_SECRET_KEY}}
|
|
|
|
aws_bucket: playwright-reports.tldraw.xyz
|
|
|
|
source_dir: apps/examples/playwright-report
|
|
|
|
|
|
|
|
- name: Log report to summary
|
|
|
|
if: always()
|
|
|
|
run: |
|
|
|
|
report_url="https://playwright-reports.tldraw.xyz/${{ steps.s3.outputs.object_key }}/index.html"
|
|
|
|
echo "Report: $report_url"
|
|
|
|
echo "## Playwright report" >> $GITHUB_STEP_SUMMARY
|
|
|
|
echo "* $report_url" >> $GITHUB_STEP_SUMMARY
|