Merge pull request #22 from bigbluebutton/nov-15 #170
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: End to end tests | |
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 | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.18.2 | |
cache: 'yarn' | |
cache-dependency-path: 'public-yarn.lock' | |
- name: Enable corepack | |
run: corepack enable | |
- name: Install dependencies | |
run: yarn | |
- name: Run script to generate CSS | |
run: | | |
echo "Current directory: $(pwd)" | |
node packages/tldraw/scripts/copy-css-files.mjs | |
- name: Verify CSS file exists | |
run: | | |
if [ -f packages/tldraw/tldraw.css ]; then | |
echo "CSS file exists" | |
else | |
echo "CSS file is missing" | |
exit 1 | |
fi | |
- 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 | |
run: npx playwright install --with-deps chromium chrome | |
if: steps.playwright-cache.outputs.cache-hit != 'true' | |
- name: Start the development server | |
run: yarn dev & | |
working-directory: apps/examples | |
- name: Wait for server to be ready | |
run: | | |
for i in `seq 1 30`; do | |
curl --silent http://localhost:5420 && break | |
sleep 1 | |
done | |
- name: Run Playwright tests | |
run: 'xvfb-run yarn e2e' | |
working-directory: apps/examples | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: apps/examples/playwright-report | |
retention-days: 30 | |
- uses: shallwefootball/s3-upload-action@master | |
# only upload if we have AWS credentials: | |
env: | |
HAS_AWS_KEY: ${{ secrets.AWS_S3_SECRET_KEY && '1' || '' }} | |
if: always() && env.HAS_AWS_KEY == '1' | |
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 |