diff --git a/.github/workflows/integration-full.yml b/.github/workflows/integration-full.yml deleted file mode 100644 index d023c28381..0000000000 --- a/.github/workflows/integration-full.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Branch - -# The main branch gets the full run across -# all OS/browsers for multiple node versions - -on: - push: - branches: - - main - paths-ignore: - - "packages/*/.changes/**" - - "decisions/**" - - "docs/**" - - "examples/**" - - "jest/**" - - "scripts/**" - - "tutorial/**" - - "contributors.yml" - - "**/*.md" - -jobs: - build: - name: "โš™๏ธ Build" - if: github.repository == 'remix-run/react-router' - uses: ./.github/workflows/shared-build.yml - - integration-ubuntu: - name: "๐Ÿ‘€ Integration Test" - if: github.repository == 'remix-run/react-router' - uses: ./.github/workflows/shared-integration.yml - with: - os: "ubuntu-latest" - node_version: "[22.22, 24]" - browser: '["chromium", "firefox"]' - - integration-windows: - name: "๐Ÿ‘€ Integration Test" - if: github.repository == 'remix-run/react-router' - uses: ./.github/workflows/shared-integration.yml - with: - os: "windows-latest" - node_version: "[24]" - browser: '["msedge"]' - timeout: 90 - - integration-macos: - name: "๐Ÿ‘€ Integration Test" - if: github.repository == 'remix-run/react-router' - uses: ./.github/workflows/shared-integration.yml - with: - os: "macos-latest" - node_version: "[22.22, 24]" - browser: '["webkit"]' diff --git a/.github/workflows/integration-pr-ubuntu.yml b/.github/workflows/integration-pr-ubuntu.yml deleted file mode 100644 index b13f78d1ac..0000000000 --- a/.github/workflows/integration-pr-ubuntu.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: PR (Base) - -# All PRs touching code will run tests on ubuntu/node/chromium - -on: - pull_request: - paths-ignore: - - "packages/*/.changes/**" - - "decisions/**" - - "docs/**" - - "examples/**" - - "jest/**" - - "scripts/**" - - "tutorial/**" - - "contributors.yml" - - "**/*.md" - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - name: "โš™๏ธ Build" - if: github.repository == 'remix-run/react-router' - uses: ./.github/workflows/shared-build.yml - - integration-chromium: - name: "๐Ÿ‘€ Integration Test" - if: github.repository == 'remix-run/react-router' - uses: ./.github/workflows/shared-integration.yml - with: - os: "ubuntu-latest" - node_version: "[24]" - browser: '["chromium"]' diff --git a/.github/workflows/integration-pr-windows-macos.yml b/.github/workflows/integration-pr-windows-macos.yml deleted file mode 100644 index c29da71511..0000000000 --- a/.github/workflows/integration-pr-windows-macos.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: PR (Full) - -# PRs touching @react-router/dev will also run on Ubuntu/Firefox, Windows/Edge and -# OSX/WebKit as well as an Ubuntu/Chromium run on Node 22.22. - -on: - pull_request: - paths: - - "pnpm-lock.yaml" - - "integration/**" - - "packages/react-router-dev/**" - - "!**/*.md" - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - integration-chromium: - name: "๐Ÿ‘€ Integration Test" - if: github.repository == 'remix-run/react-router' - uses: ./.github/workflows/shared-integration.yml - with: - os: "ubuntu-latest" - node_version: "[22.22]" - browser: '["chromium"]' - - integration-firefox: - name: "๐Ÿ‘€ Integration Test" - if: github.repository == 'remix-run/react-router' - uses: ./.github/workflows/shared-integration.yml - with: - os: "ubuntu-latest" - node_version: "[24]" - browser: '["firefox"]' - - integration-msedge: - name: "๐Ÿ‘€ Integration Test" - if: github.repository == 'remix-run/react-router' - uses: ./.github/workflows/shared-integration.yml - with: - os: "windows-latest" - node_version: "[24]" - browser: '["msedge"]' - timeout: 90 - - integration-webkit: - name: "๐Ÿ‘€ Integration Test" - if: github.repository == 'remix-run/react-router' - uses: ./.github/workflows/shared-integration.yml - with: - os: "macos-latest" - node_version: "[24]" - browser: '["webkit"]' diff --git a/.github/workflows/shared-integration.yml b/.github/workflows/integration-run.yml similarity index 92% rename from .github/workflows/shared-integration.yml rename to .github/workflows/integration-run.yml index b80396ef29..219bedb36d 100644 --- a/.github/workflows/shared-integration.yml +++ b/.github/workflows/integration-run.yml @@ -49,8 +49,8 @@ jobs: node-version: ${{ matrix.node }} cache: "pnpm" - # TODO: Track and renable once this has been fixed: https://github.com/google/wireit/issues/1297 - # - uses: google/wireit@setup-github-actions-caching/v2 + - name: Setup wireit cache ${{ matrix.node }} + uses: google/wireit@setup-github-actions-caching/v2.0.4 - name: Disable GitHub Actions Annotations run: | diff --git a/.github/workflows/pr-actions.yml b/.github/workflows/pr-actions.yml index 724fe3dd8c..91cc86014b 100644 --- a/.github/workflows/pr-actions.yml +++ b/.github/workflows/pr-actions.yml @@ -1,4 +1,4 @@ -name: PR (Actions) +name: PR Actions # Triggered when "PR (Check)" completes. Downloads the artifact produced by # the upstream workflow and applies the recorded actions (sticky comments, @@ -7,12 +7,12 @@ name: PR (Actions) on: workflow_run: - workflows: ["PR (Check)"] + workflows: ["PR Checks"] types: [completed] jobs: actions: - name: PR (Actions) + name: Actions if: > github.event.workflow_run.conclusion == 'success' && github.repository == 'remix-run/react-router' diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 46d8f5b2a3..756591f20c 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -1,4 +1,4 @@ -name: PR (Check) +name: PR Checks # Read-only PR inspection. Computes a list of "actions" (sticky comments, # label changes, close, etc.) and uploads them as an artifact. The PR (Actions) @@ -15,7 +15,7 @@ concurrency: jobs: check: - name: ๐Ÿ” Check PR + name: Checks if: github.repository == 'remix-run/react-router' runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/release-comments.yml b/.github/workflows/release-comments-manual.yml similarity index 94% rename from .github/workflows/release-comments.yml rename to .github/workflows/release-comments-manual.yml index b48f731c29..a35701506a 100644 --- a/.github/workflows/release-comments.yml +++ b/.github/workflows/release-comments-manual.yml @@ -9,7 +9,7 @@ concurrency: jobs: comment: - name: ๐Ÿ“ Comment on released issues/pull requests + name: Comment on released issues/pull requests runs-on: ubuntu-latest permissions: issues: write # enable commenting on released issues diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ffb5ba5960..b0f84fe0ed 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ # - v8 prereleases (from a workflow_dispatch trigger on the v8 branch) # - Experimental releases (from a workflow_dispatch trigger) -name: ๐Ÿšข Release/Publish +name: Release on: push: @@ -109,19 +109,19 @@ jobs: contents: write # enable pushing changes to the origin id-token: write # enable generation of an ID token for publishing steps: - - name: โฌ‡๏ธ Checkout repo + - name: Checkout repo uses: actions/checkout@v6 - - name: ๐Ÿ“ฆ Setup pnpm + - name: Setup pnpm uses: pnpm/action-setup@v6 - - name: โŽ” Setup node + - name: Setup node uses: actions/setup-node@v6 with: node-version-file: ".nvmrc" package-manager-cache: false - - name: ๐Ÿ“ฅ Install deps + - name: Install deps run: pnpm install --frozen-lockfile - name: Build packages @@ -133,31 +133,31 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} comment: - name: ๐Ÿ“ Comment on released issues/pull requests + name: Comment on released issues/pull requests needs: publish runs-on: ubuntu-latest permissions: issues: write # enable commenting on released issues pull-requests: write # enable commenting on released pull requests steps: - - name: โฌ‡๏ธ Checkout repo + - name: Checkout repo uses: actions/checkout@v6 with: fetch-depth: 0 - - name: ๐Ÿ“ฆ Setup pnpm + - name: Setup pnpm uses: pnpm/action-setup@v6 - - name: โŽ” Setup node + - name: Setup node uses: actions/setup-node@v6 with: node-version-file: ".nvmrc" package-manager-cache: false - - name: ๐Ÿ“ฅ Install deps + - name: Install deps run: pnpm install --frozen-lockfile - - name: ๐Ÿ“ Comment on released issues and pull requests + - name: Comment on released issues and pull requests env: GH_TOKEN: ${{ github.token }} run: pnpm run release-comments @@ -170,39 +170,39 @@ jobs: contents: read id-token: write # enable generation of an ID token for publishing steps: - - name: โฌ‡๏ธ Checkout repo + - name: Checkout repo uses: actions/checkout@v6 with: ref: ${{ github.event.inputs.branch }} fetch-depth: 0 # needed for tags - - name: ๐Ÿ“ฆ Setup pnpm + - name: Setup pnpm uses: pnpm/action-setup@v6 - - name: โŽ” Setup node + - name: Setup node uses: actions/setup-node@v6 with: node-version-file: ".nvmrc" package-manager-cache: false - - name: ๐Ÿ“ฅ Install deps + - name: Install deps run: pnpm install --frozen-lockfile - - name: ๐Ÿ— Build + - name: Build run: pnpm build - - name: ๐Ÿš€ Publish prerelease + - name: Publish prerelease run: pnpm prerelease:publish experimental-release: - name: ๐Ÿงช Experimental Release + name: Experimental Release if: github.repository == 'remix-run/react-router' && github.event_name == 'workflow_dispatch' && github.event.inputs.branch != 'v8' runs-on: ubuntu-latest permissions: contents: write # enable pushing changes to the origin id-token: write # enable generation of an ID token for publishing steps: - - name: โฌ‡๏ธ Checkout repo + - name: Checkout repo uses: actions/checkout@v6 with: ref: ${{ github.event.inputs.branch }} @@ -210,27 +210,27 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} fetch-depth: 0 - - name: ๐Ÿ“ฆ Setup pnpm + - name: Setup pnpm uses: pnpm/action-setup@v6 - - name: โŽ” Setup node + - name: Setup node uses: actions/setup-node@v6 with: node-version-file: ".nvmrc" package-manager-cache: false - - name: ๐Ÿ“ฅ Install deps + - name: Install deps run: pnpm install --frozen-lockfile - - name: โคด๏ธ Update version + - name: Update version run: | git config --local user.email "hello@remix.run" git config --local user.name "Remix Run Bot" pnpm run experimental:version git push origin --tags - - name: ๐Ÿ— Build + - name: Build run: pnpm build - - name: ๐Ÿš€ Publish + - name: Publish run: pnpm run experimental:publish diff --git a/.github/workflows/shared-build.yml b/.github/workflows/shared-build.yml deleted file mode 100644 index 06e5e44b48..0000000000 --- a/.github/workflows/shared-build.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: ๐Ÿ› ๏ธ Build - -on: - workflow_call: - -env: - CI: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: โฌ‡๏ธ Checkout repo - uses: actions/checkout@v6 - - - name: ๐Ÿ“ฆ Setup pnpm - uses: pnpm/action-setup@v6 - - - name: โŽ” Setup node - uses: actions/setup-node@v6 - with: - node-version-file: ".nvmrc" - cache: "pnpm" - - # TODO: Track and renable once this has been fixed: https://github.com/google/wireit/issues/1297 - # - uses: google/wireit@setup-github-actions-caching/v2 - - - name: Disable GitHub Actions Annotations - run: | - echo "::remove-matcher owner=tsc::" - echo "::remove-matcher owner=eslint-compact::" - echo "::remove-matcher owner=eslint-stylish::" - - - name: ๐Ÿ“ฅ Install deps - run: pnpm install --frozen-lockfile - - - name: ๐Ÿ— Build - run: pnpm build diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml new file mode 100644 index 0000000000..75ba10309f --- /dev/null +++ b/.github/workflows/test-integration.yml @@ -0,0 +1,141 @@ +name: Integration Test + +# Incrementally comprehensive based on the type of change: +# +# | Type | Description | Test Runs | +# |--------|-----------------------|-------------------------------------------| +# | base | Source code PRs | Chromium (Node 24) | +# | normal | @react-router/dev PRs | + Firefox/Webkit/Edge (n24), Chromium (n22) | +# | full | Commits on `main` | + Firefox/Webkit (n22) | + +on: + push: + branches: + - main + paths: + - "packages/**" + - "integration/**" + - "package.json" + - "pnpm-lock.yaml" + - "pnpm-workspace.yaml" + - "build.utils.ts" + - "build.utils.d.ts" + - "!**/*.md" + pull_request: + paths: + - "packages/**" + - "integration/**" + - "package.json" + - "pnpm-lock.yaml" + - "pnpm-workspace.yaml" + - "build.utils.ts" + - "build.utils.d.ts" + - "!**/*.md" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + pull-requests: read + +jobs: + changes: + name: "Check Changed Files" + if: github.repository == 'remix-run/react-router' + runs-on: ubuntu-latest + outputs: + type: ${{ steps.suites.outputs.type }} + steps: + - name: ๐Ÿ”Ž Select integration suites + id: suites + env: + GH_TOKEN: ${{ github.token }} + PR_NUMBER: ${{ github.event.pull_request.number }} + run: | + if [ "${{ github.event_name }}" = "push" ]; then + echo "type=full" >> "$GITHUB_OUTPUT" + elif gh pr view "$PR_NUMBER" --json files -q '.files[].path' | grep -q '^packages/react-router-dev/'; then + echo "type=dev" >> "$GITHUB_OUTPUT" + else + echo "type=base" >> "$GITHUB_OUTPUT" + fi + + # base only runs Node 24/Chromium + integration-chromium: + name: "Chromium (24)" + needs: changes + if: github.repository == 'remix-run/react-router' + uses: ./.github/workflows/integration-run.yml + with: + os: "ubuntu-latest" + node_version: "[24]" + browser: '["chromium"]' + + # dev/full add Node 22/Chromium + integration-chromium-node-22: + name: "Chromium (22)" + needs: changes + if: github.repository == 'remix-run/react-router' && contains(fromJSON('["dev", "full"]'), needs.changes.outputs.type) + uses: ./.github/workflows/integration-run.yml + with: + os: "ubuntu-latest" + node_version: "[22.22]" + browser: '["chromium"]' + + # dev/full add Node 24/Firefox + integration-firefox: + name: "Firefox (24)" + needs: changes + if: github.repository == 'remix-run/react-router' && contains(fromJSON('["dev", "full"]'), needs.changes.outputs.type) + uses: ./.github/workflows/integration-run.yml + with: + os: "ubuntu-latest" + node_version: "[24]" + browser: '["firefox"]' + + # dev/full add Node 24/Edge + integration-msedge: + name: "Edge (24)" + needs: changes + if: github.repository == 'remix-run/react-router' && contains(fromJSON('["dev", "full"]'), needs.changes.outputs.type) + uses: ./.github/workflows/integration-run.yml + with: + os: "windows-latest" + node_version: "[24]" + browser: '["msedge"]' + timeout: 90 + + # dev/full add Node 24/WebKit + integration-webkit: + name: "WebKit (24)" + needs: changes + if: github.repository == 'remix-run/react-router' && contains(fromJSON('["dev", "full"]'), needs.changes.outputs.type) + uses: ./.github/workflows/integration-run.yml + with: + os: "macos-latest" + node_version: "[24]" + browser: '["webkit"]' + + # full adds Node 22/Firefox + integration-firefox-node-22: + name: "Firefox (22)" + needs: changes + if: github.repository == 'remix-run/react-router' && needs.changes.outputs.type == 'full' + uses: ./.github/workflows/integration-run.yml + with: + os: "ubuntu-latest" + node_version: "[22.22]" + browser: '["firefox"]' + + # full adds Node 22/WebKit + integration-webkit-node-22: + name: "WebKit (22)" + needs: changes + if: github.repository == 'remix-run/react-router' && needs.changes.outputs.type == 'full' + uses: ./.github/workflows/integration-run.yml + with: + os: "macos-latest" + node_version: "[22.22]" + browser: '["webkit"]' diff --git a/.github/workflows/test.yml b/.github/workflows/test-unit.yml similarity index 67% rename from .github/workflows/test.yml rename to .github/workflows/test-unit.yml index 4ac54b5944..14f1f5a41c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test-unit.yml @@ -1,4 +1,4 @@ -name: ๐Ÿงช Test +name: Unit Test on: push: @@ -8,7 +8,7 @@ on: - v* paths-ignore: - "docs/**" - - "**/README.md" + - "**/*.md" pull_request: paths-ignore: - "docs/**" @@ -23,7 +23,8 @@ permissions: jobs: test: - name: "๐Ÿงช Test: (Node: ${{ matrix.node }})" + name: "Node ${{ matrix.node }}" + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -31,24 +32,22 @@ jobs: - 22.22 - 24 - runs-on: ubuntu-latest - steps: - - name: โฌ‡๏ธ Checkout repo + - name: Checkout repo uses: actions/checkout@v6 - - name: ๐Ÿ“ฆ Setup pnpm + - name: Setup pnpm uses: pnpm/action-setup@v6 - - name: โŽ” Setup node + - name: Setup node uses: actions/setup-node@v6 with: node-version: ${{ matrix.node }} cache: pnpm check-latest: true - # TODO: Track and renable once this has been fixed: https://github.com/google/wireit/issues/1297 - # - uses: google/wireit@setup-github-actions-caching/v2 + - name: Setup wireit cache + uses: google/wireit@setup-github-actions-caching/v2.0.4 - name: Disable GitHub Actions Annotations run: | @@ -56,17 +55,17 @@ jobs: echo "::remove-matcher owner=eslint-compact::" echo "::remove-matcher owner=eslint-stylish::" - - name: ๐Ÿ“ฅ Install deps + - name: Install deps run: pnpm install --frozen-lockfile - - name: ๐Ÿ— Build + - name: Build run: pnpm build - - name: ๐Ÿ” Typecheck + - name: Typecheck run: pnpm typecheck - - name: ๐Ÿ”ฌ Lint + - name: Lint run: pnpm lint - - name: ๐Ÿงช Run tests + - name: Run tests run: pnpm test diff --git a/README.md b/README.md index acc28164c2..f634862dc7 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [npm-badge]: https://img.shields.io/npm/v/react-router.svg [npm]: https://www.npmjs.org/package/react-router [build-badge]: https://img.shields.io/github/actions/workflow/status/remix-run/react-router/test.yml?branch=dev&style=square -[build]: https://github.com/remix-run/react-router/actions/workflows/test.yml +[build]: https://github.com/remix-run/react-router/actions/workflows/test-unit.yml React Router is a multi-strategy router for React bridging the gap from React 18 to React 19. You can use it maximally as a React framework or minimally as a library with your own architecture. diff --git a/package.json b/package.json index 81bae84e0c..78f494752f 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,9 @@ "typegen": "pnpm run --recursive --parallel typegen", "typecheck": "pnpm run --recursive --parallel typecheck", "test:integration:run": "pnpm playwright:integration", - "test:integration": "pnpm build && pnpm test:integration:run", "posttest:integration:run": "pnpm clean:integration", + "pretest:integration": "pnpm build", + "test:integration": "pnpm test:integration:run", "playwright:integration": "playwright test --config ./integration/playwright.config.ts", "vite-ecosystem-ci:build": "pnpm build", "vite-ecosystem-ci:before-test": "pnpm playwright install",