Further preparation for supporting Docusaurus v3 #557
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: CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
# Prevent duplicates runs for PRs from non-forks. | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
defaults: | |
run: | |
# TODO: Our package.json scripts currently assume that they are run | |
# from bash, even on Windows. | |
# We should probably make them OS-agnostic instead. | |
shell: bash | |
continue-on-error: ${{ matrix.docusaurus-version == 'canary' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
node-version: [18.x, 20.x, 22.x] | |
docusaurus-version: | |
- "v2.4.3" | |
- "v2.4.1" | |
- "v2.4.0" | |
- "v2.3.1" | |
- "v2.2.0" | |
- "v2.1.0" | |
- "v2.0.1" | |
- "canary" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
run_install: false | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "pnpm" | |
- run: pnpm install | |
- run: pnpm run lint | |
- run: pnpm -r add --save-dev '@docusaurus/core@${{ matrix.docusaurus-version }}' '@docusaurus/preset-classic@${{ matrix.docusaurus-version }}' '@docusaurus/module-type-aliases@${{ matrix.docusaurus-version }}' '@docusaurus/plugin-content-blog@${{ matrix.docusaurus-version }}' '@docusaurus/plugin-content-docs@${{ matrix.docusaurus-version }}' '@docusaurus/plugin-content-pages@${{ matrix.docusaurus-version }}' '@docusaurus/theme-common@${{ matrix.docusaurus-version }}' '@docusaurus/theme-classic@${{ matrix.docusaurus-version }}' '@docusaurus/types@${{ matrix.docusaurus-version }}' | |
- run: pnpm dedupe | |
- run: pnpm run build | |
- run: pnpm run test | |
# Install OS dependencies | |
# Run `apt update` beforehand to avoid 404 Not Found errors during apt install. | |
- run: sudo apt update | |
if: runner.os == 'Linux' | |
- run: pnpm --filter docusaurus-search-local --fail-if-no-match exec playwright install-deps | |
# Install Browsers | |
- run: pnpm --filter docusaurus-search-local --fail-if-no-match exec playwright install | |
- run: pnpm run test:e2e -- --browser=all --forbid-only | |
# TODO: Cannot run browser tests for these for now. | |
- run: pnpm --filter example-docs --fail-if-no-match run build --config docusaurus.config.noTrailingSlash.js | |
- run: pnpm --filter example-docs --fail-if-no-match run build --config docusaurus.config.subDirectory.js | |
- run: pnpm --filter example-docs --fail-if-no-match run build --config docusaurus.config.noTrailingSlashSubdirectory.js |