chore: Update build to React 19 #705
This file contains hidden or 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 | |
| permissions: | |
| contents: read | |
| # Automatically cancel outdated runs for the same PR/branch: | |
| # https://stackoverflow.com/a/72408109 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref || github.run_id }} | |
| cancel-in-progress: true | |
| 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.fork) }} | |
| 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: true | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| node-version: [20.x, 22.x, 24.x] | |
| react-version: | |
| - "v19.2.0" | |
| - "v18.3.1" | |
| docusaurus-version: | |
| - "v3.9.2" | |
| - "v3.8.1" | |
| - "v3.7.0" | |
| exclude: | |
| # React 19 only compiles with Docusaurus 3.8.0+ due to one of its dependencies. | |
| - react-version: "v19.2.0" | |
| docusaurus-version: "v3.7.0" | |
| 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 --frozen-lockfile | |
| - run: pnpm run lint | |
| - name: Installing Docusaurus ${{ matrix.docusaurus-version }}, React ${{ matrix.react-version }} and dependencies | |
| 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 }}' 'react@${{ matrix.react-version }}' 'react-dom@${{ matrix.react-version }}' '@types/react@${{ matrix.react-version }}' '@types/react-dom@${{ matrix.react-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 |