Skip to content

Test CDN Build (jsdelivr) #23

Test CDN Build (jsdelivr)

Test CDN Build (jsdelivr) #23

name: Test CDN Build (jsdelivr)
on:
schedule:
# every hour
- cron: '0 * * * *'
pull_request:
paths:
- 'playwright/tests/**'
- 'examples/cdn-api-reference/**'
- '.github/workflows/test-cdn-jsdelivr.yml'
jobs:
test:
if: github.repository == 'scalar/scalar' || github.event_name != 'schedule'
runs-on: ubuntu-22.04
timeout-minutes: 15
strategy:
matrix:
node-version: [22]
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@09d2acae674a48949e3602304ab46fd20ae0c42f
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda
- name: Build packages
uses: ./.github/actions/build
with:
packages-only: true
node-version: ${{ matrix.node-version }}
# Caching browser binaries is not recommended, since the amount of time it takes to restore the cache is comparable to the time it takes to download the binaries.
- name: Install Playwright browsers
run: npx playwright install
- name: Install Playwright dependencies
run: npx playwright install-deps
- name: Start HTML server
run: pnpm --filter @scalar-examples/cdn-api-reference dev &
- name: Run E2E tests (jsdelivr)
run: |
CI=1 pnpm test:e2e:jsdelivr
- uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8
id: artifact-upload
if: ${{ failure() }}
with:
name: playwright-report
path: ./playwright/test-results/
retention-days: 5
- name: Update snapshot files
if: ${{ failure() && github.event_name != 'pull_request'}}
run: pnpm vite-node scripts/update-snapshots.ts
- name: Create Pull Request
if: ${{ failure() && github.event_name != 'pull_request' }}
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e
with:
commit-message: 'test: update CDN API Reference snapshots'
body: |
This PR was automatically created to update the snapshots for the CDN build hosted on jsdelivr.
Please look at the screenshots to review the changes.
title: 'test(api-reference): update CDN snapshots'
branch: update-cdn-snapshots
base: main
delete-branch: true
reviewers: amritk, antlio, cameronrohani, geoffgscott, hanspagel, marclave
- name: Comment on PR with report link
uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6
if: ${{ failure() && github.event_name == 'pull_request'}}
with:
message: |
### Playwright visual snapshot differences were detected.
View the [Playwright report](${{ steps.artifact-upload.outputs.artifact-url }}) to review the visual differences.
Inspect the changes and commit the updated snapshots if they are satisfactory.
If a **snapshot-diff.png** is not provided, the snapshots are different sizes.
comment-tag: playwright-report
mode: upsert
create-if-not-exists: true