Skip to content

Commit

Permalink
ci: playwright cache (#2142)
Browse files Browse the repository at this point in the history
* fix: wrong path filter

* fix: playwright binaries aren’t cached

* fix: playwright cache still doesn’t work

* ci: remove pnpm ci

* fix: turbo cache isn’t used

* ci: better way to get the playwright version

* ci: let playwright start the dev server

* fix: pnpm not found

* ci: start the dev server in github actions again

* ci: always install playwright system dependencies

* ci: playwrights starts the web server

* Revert "ci: playwrights starts the web server"

This reverts commit 0261dc4.

* ci: update all playwright workflows

* ci: update workflow triggers

* chore: upgrade to actions/cache@v4

* ci: titlecase

* ci: remove job name

* chore: move turbocache update to separate PR

* chore: clean up

* chore: install all dependencies

* chore: rebase
  • Loading branch information
hanspagel committed Jun 19, 2024
1 parent 5de391e commit 83fcdb8
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 44 deletions.
1 change: 0 additions & 1 deletion .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ permissions:

jobs:
lint:
name: Validate PR title
runs-on: ubuntu-latest
steps:
# https://github.com/marketplace/actions/semantic-pull-request
Expand Down
34 changes: 20 additions & 14 deletions .github/workflows/test-cdn-jsdelivr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ on:
- cron: '0 * * * *'
push:
paths:
- 'packages/cdn-api-reference/**'
- 'playwright/tests/**'
- 'examples/cdn-api-reference/**'
- '.github/workflows/test-cdn-jsdelivr.yml'

jobs:
Expand All @@ -19,6 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
Expand All @@ -33,22 +35,26 @@ jobs:
key: ${{ runner.os }}-turbo-node-${{ matrix.node-version }}
restore-keys: |
${{ runner.os }}-turbo-node-
- name: Build Packages
- name: Build packages
run: pnpm build:packages
- name: Start HTML Server
run: pnpm --filter @scalar-examples/cdn-api-reference dev &
- name: Get installed Playwright version
- name: Get Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@playwright/test'])")" >> $GITHUB_ENV
# TODO doesn't work
- name: Cache playwright binaries
run: echo "PLAYWRIGHT_VERSION=$(npx playwright --version | cut -d' ' -f2)" >> $GITHUB_ENV
- name: Playwright binary cache
uses: actions/cache@v4
id: playwright-cache
with:
path: '~/.cache/ms-playwright'
key: '${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}'
restore-keys: ${{ runner.os }}-playwright-
- name: Install Playwright browser binaries & OS dependencies
run: pnpm exec playwright install --with-deps
- name: Run e2e tests (jsdelivr)
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.PLAYWRIGHT_VERSION }}
restore-keys: |
${{ runner.os }}-playwright-
- name: Install Playwright browsers
run: npx playwright install
if: steps.playwright-cache.outputs.cache-hit != 'true'
- 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
28 changes: 16 additions & 12 deletions .github/workflows/test-cdn-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,26 @@ jobs:
key: ${{ runner.os }}-turbo-node-${{ matrix.node-version }}
restore-keys: |
${{ runner.os }}-turbo-node-
- name: Build Packages
- name: Build packages
run: pnpm build:packages
- name: Start HTML Server
run: pnpm --filter @scalar-examples/cdn-api-reference dev &
- name: Get installed Playwright version
- name: Get Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@playwright/test'])")" >> $GITHUB_ENV
# TODO doesn't work
- name: Cache playwright binaries
run: echo "PLAYWRIGHT_VERSION=$(npx playwright --version | cut -d' ' -f2)" >> $GITHUB_ENV
- name: Playwright binary cache
uses: actions/cache@v4
id: playwright-cache
with:
path: '~/.cache/ms-playwright'
key: '${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}'
restore-keys: ${{ runner.os }}-playwright-
- name: Install Playwright browser binaries & OS dependencies
run: pnpm exec playwright install --with-deps
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.PLAYWRIGHT_VERSION }}
restore-keys: |
${{ runner.os }}-playwright-
- name: Install Playwright browsers
run: npx playwright install
if: steps.playwright-cache.outputs.cache-hit != 'true'
- 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 (local)
run: CI=1 pnpm test:e2e:local
39 changes: 22 additions & 17 deletions .github/workflows/test-nuxt-integration.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: Test nuxt integration
name: Test Nuxt Integration

on:
push:
paths:
- 'packages/**'
- '.github/workflows/test-nuxt-integration.yml'
- 'playwright/tests/**'
pull_request:
branches:
- main

jobs:
test:
Expand All @@ -23,27 +21,34 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm --filter nuxt install
run: pnpm install
- name: Turborepo cache
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-node-${{ matrix.node-version }}
restore-keys: |
${{ runner.os }}-turbo-node-
- name: Start nuxt server
run: pnpm --filter nuxt dev --host &
- name: Get installed Playwright version
- name: Build packages
run: pnpm build:packages
- name: Get Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@playwright/test'])")" >> $GITHUB_ENV
- name: Cache playwright binaries
run: echo "PLAYWRIGHT_VERSION=$(npx playwright --version | cut -d' ' -f2)" >> $GITHUB_ENV
- name: Playwright binary cache
uses: actions/cache@v4
id: playwright-cache
with:
path: '~/.cache/ms-playwright'
key: '${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}'
restore-keys: ${{ runner.os }}-playwright-
- name: Install Playwright browser binaries & OS dependencies
run: pnpm exec playwright install --with-deps
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.PLAYWRIGHT_VERSION }}
restore-keys: |
${{ runner.os }}-playwright-
- name: Install Playwright browsers
run: npx playwright install
if: steps.playwright-cache.outputs.cache-hit != 'true'
- name: Install Playwright dependencies
run: npx playwright install-deps
- name: Start nuxt server
run: pnpm --filter nuxt dev --host &
- name: Run e2e tests
run: CI=1 pnpm -r --parallel test:e2e:nuxt
5 changes: 5 additions & 0 deletions examples/cdn-api-reference/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ await app.register(fastifyStatic, {
cacheControl: false,
})

// health check
app.get('/ping', (_request, reply) => {
reply.send('pong')
})

// @scalar/api-reference bundle

app.get('/api-reference/standalone.js', (_request, reply) => {
Expand Down

0 comments on commit 83fcdb8

Please sign in to comment.