Files
docusaurus/.github/workflows/tests-e2e.yml
2026-06-25 13:45:52 +02:00

297 lines
11 KiB
YAML

name: E2E Tests
on:
push:
branches:
- main
- docusaurus-v**
paths:
- package.json
- pnpm-lock.yaml
- vitest.config.ts
- test/**
- packages/**
- tsconfig.*.json
pull_request:
branches:
- main
- docusaurus-v**
paths:
- package.json
- pnpm-lock.yaml
- vitest.config.ts
- test/**
- packages/**
- tsconfig.*.json
- admin/verdaccio.yaml
- .github/workflows/tests-e2e.yml
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
yarn-v1:
name: E2E — Yarn v1
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
matrix:
node: ['24.14', '26']
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node }}
cache: pnpm
- name: Installation
run: pnpm install --frozen-lockfile || pnpm install --frozen-lockfile || pnpm install --frozen-lockfile
- name: Generate test-website project against main branch
run: pnpm test:build:website -s
- name: Install test-website project with Yarn v1
run: yarn install --frozen-lockfile || yarn install --frozen-lockfile || yarn install --frozen-lockfile
working-directory: ../test-website
env:
npm_config_registry: http://localhost:4873
- name: Start test-website project
run: yarn start --no-open
working-directory: ../test-website
env:
E2E_TEST: true
- name: Build test-website project
# We build 2 locales to ensure a localized site doesn't leak memory
# See https://github.com/facebook/docusaurus/pull/10599
run: yarn build --locale en --locale fr
env:
# Our website should build even with limited memory
# See https://github.com/facebook/docusaurus/pull/10590
NODE_OPTIONS: '--max-old-space-size=300'
DOCUSAURUS_PERF_LOGGER: 'true'
working-directory: ../test-website
yarn-v1-windows:
name: E2E — Yarn v1 Windows
timeout-minutes: 30
runs-on: windows-8-core
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
- name: Use Node.js LTS
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: lts/*
cache: pnpm
- name: Installation
run: pnpm install --frozen-lockfile || pnpm install --frozen-lockfile || pnpm install --frozen-lockfile
- name: Generate test-website project against main branch
# Not using test-release.sh => no verdaccio docker image on Windows
run: node ./packages/create-docusaurus/bin/index.js ../test-website classic --typescript --package-manager yarn
- name: Install test-website project with Yarn v1
run: yarn install --frozen-lockfile || yarn install --frozen-lockfile || yarn install --frozen-lockfile
working-directory: ../test-website
- name: Start test-website project
run: yarn start --no-open
working-directory: ../test-website
env:
E2E_TEST: true
- name: Build test-website project
# We build 2 locales to ensure a localized site doesn't leak memory
# See https://github.com/facebook/docusaurus/pull/10599
run: yarn build --locale en --locale fr
env:
# Our website should build even with limited memory
# See https://github.com/facebook/docusaurus/pull/10590
NODE_OPTIONS: '--max-old-space-size=300'
DOCUSAURUS_PERF_LOGGER: 'true'
working-directory: ../test-website
- name: Copy to CWD
# Workaround for actions/upload-artifact, see comment below
run: cp -R ../test-website test-website
- name: Upload Website artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: website-e2e-windows
# Note: actions/upload-artifact can't upload from '../test-website'
# Error: Invalid pattern '../test-website/build'. Relative pathing '.' and '..' is not allowed.
path: test-website/build
if-no-files-found: error
yarn-berry:
name: E2E — Yarn Berry
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
matrix:
nodeLinker: [pnp, node-modules]
variant: [-s, -st]
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
- name: Use Node.js LTS
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: lts/*
cache: pnpm
- name: Installation
run: pnpm install --frozen-lockfile || pnpm install --frozen-lockfile || pnpm install --frozen-lockfile
- name: Generate test-website project with ${{ matrix.variant }} against main branch
run: pnpm test:build:website ${{ matrix.variant }}
- name: Install test-website project with Yarn Berry and nodeLinker = ${{ matrix.nodeLinker }}
run: |
yarn set version berry
yarn config set nodeLinker ${{ matrix.nodeLinker }}
yarn config set npmRegistryServer http://localhost:4873
yarn config set unsafeHttpWhitelist --json '["localhost"]'
yarn config set enableGlobalCache true
yarn config set npmPreapprovedPackages --json '["@docusaurus/*"]'
# Make PnP as strict as possible
# https://yarnpkg.com/features/pnp#fallback-mode
yarn config set pnpFallbackMode none
yarn || yarn || yarn
working-directory: ../test-website
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false # Yarn berry should create the lockfile, despite CI env
- name: Start test-website project
run: yarn start --no-open
working-directory: ../test-website
env:
E2E_TEST: true
- name: TypeCheck website
# TODO: there're some lingering issues with PnP + tsc. Enable tsc in PnP later.
if: matrix.variant == '-st' && matrix.nodeLinker != 'pnp'
working-directory: ../test-website
run: yarn typecheck
- name: TypeCheck website - min version - v6.0
# TODO: there're some lingering issues with PnP + tsc. Enable tsc in PnP later.
if: matrix.variant == '-st' && matrix.nodeLinker != 'pnp'
working-directory: ../test-website
run: |
yarn add typescript@6.0 --exact
yarn typecheck
- name: TypeCheck website - max version - Latest
# TODO: there're some lingering issues with PnP + tsc. Enable tsc in PnP later.
if: matrix.variant == '-st' && matrix.nodeLinker != 'pnp'
working-directory: ../test-website
run: |
yarn add typescript@latest --exact
yarn typecheck
- name: Build test-website project
# We build 2 locales to ensure a localized site doesn't leak memory
# See https://github.com/facebook/docusaurus/pull/10599
run: yarn build --locale en --locale fr
env:
# Our website should build even with limited memory
# See https://github.com/facebook/docusaurus/pull/10590
NODE_OPTIONS: '--max-old-space-size=300'
DOCUSAURUS_PERF_LOGGER: 'true'
working-directory: ../test-website
npm:
name: E2E — npm
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
- name: Use Node.js LTS
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: lts/*
cache: pnpm
- name: Installation
run: pnpm install --frozen-lockfile || pnpm install --frozen-lockfile || pnpm install --frozen-lockfile
- name: Generate test-website project against main branch
run: pnpm test:build:website -st
- name: Install test-website project with npm
run: npm install
working-directory: ../test-website
env:
npm_config_registry: http://localhost:4873
- name: TypeCheck website
working-directory: ../test-website
run: npm run typecheck
- name: Start test-website project
run: npm run start -- --no-open
working-directory: ../test-website
env:
E2E_TEST: true
- name: Build test-website project
# We build 2 locales to ensure a localized site doesn't leak memory
# See https://github.com/facebook/docusaurus/pull/10599
run: npm run build -- --locale en --locale fr
env:
# Our website should build even with limited memory
# See https://github.com/facebook/docusaurus/pull/10590
NODE_OPTIONS: '--max-old-space-size=300'
DOCUSAURUS_PERF_LOGGER: 'true'
working-directory: ../test-website
pnpm:
name: E2E — pnpm
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
- name: Use Node.js LTS
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: lts/*
cache: pnpm
- name: Installation
run: pnpm install --frozen-lockfile || pnpm install --frozen-lockfile || pnpm install --frozen-lockfile
- name: Generate test-website project against main branch
run: pnpm test:build:website -st
- name: Install test-website project with pnpm
run: |
cat > pnpm-workspace.yaml <<'YAML'
strictDepBuilds: true
allowBuilds:
'@swc/core': true
core-js: true
YAML
pnpm install
working-directory: ../test-website
env:
pnpm_config_registry: http://localhost:4873
- name: TypeCheck website
working-directory: ../test-website
run: pnpm run typecheck
- name: Start test-website project
run: pnpm start --no-open
working-directory: ../test-website
env:
E2E_TEST: true
- name: Build test-website project
# We build 2 locales to ensure a localized site doesn't leak memory
# See https://github.com/facebook/docusaurus/pull/10599
run: pnpm run build --locale en --locale fr
env:
# Our website should build even with limited memory
# See https://github.com/facebook/docusaurus/pull/10590
NODE_OPTIONS: '--max-old-space-size=300'
DOCUSAURUS_PERF_LOGGER: 'true'
working-directory: ../test-website