Skip to content

[Actions] ⚡ Optimize workflows #1

[Actions] ⚡ Optimize workflows

[Actions] ⚡ Optimize workflows #1

Workflow file for this run

name: E2E / Playwright Tests
on:
push:
branches: [main, next]
paths:
- "aksel.nav.no/**"
pull_request:
branches: [main, next]
paths:
- "aksel.nav.no/**"
jobs:
build_and_start_website:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Setup and build Next.js application
uses: ./.github/actions/build-website
with:
use_cdn_assets: false
npm_auth_token: ${{ secrets.READER_TOKEN }}
nais_id_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
nais_project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
sanity_read_token: ${{ secrets.SANITY_READ }}
sanity_read_no_drafts_token: ${{ secrets.SANITY_READ_NO_DRAFTS }}
- name: Start App
run: yarn serve:next
playwright:
needs: build_and_start_website
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.48.1-jammy
strategy:
matrix:
shard: [1, 2, 3, 4] # Example for 2 shards
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Run Playwright tests
run: yarn workspace website run yarn generate-testpaths
env:
SANITY_READ: ${{ secrets.SANITY_READ }}
SANITY_READ_NO_DRAFTS: ${{ secrets.SANITY_READ_NO_DRAFTS }}
- name: Run Playwright Tests
run: yarn workspace website run yarn playwright --shard ${{ matrix.shard }}/4