Release 2.11.1 #8493
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 | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| defaults: | |
| run: | |
| working-directory: ./packages/toolkit | |
| jobs: | |
| changes: | |
| name: Check for changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| toolkit: ${{ steps.filter.outputs.toolkit }} | |
| steps: | |
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3 | |
| id: filter | |
| with: | |
| filters: | | |
| toolkit: | |
| - 'packages/toolkit/**' | |
| - 'examples/publish-ci/**' | |
| - '.github/workflows/tests.yml' | |
| - 'yarn.lock' | |
| build: | |
| needs: changes | |
| if: ${{ needs.changes.outputs.toolkit == 'true' }} | |
| name: Lint, Test, Build & Pack on Node ${{ matrix.node }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node: ['24.x'] | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Use node ${{ matrix.node }} | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: 'yarn' | |
| - name: Install deps | |
| run: yarn install | |
| # Read existing version, reuse that, add a Git short hash | |
| - name: Set build version to Git commit | |
| run: yarn tsx scripts/writeGitVersion.mts $(git rev-parse --short HEAD) | |
| - name: Check updated version | |
| run: jq .version package.json | |
| - name: Pack | |
| run: yarn pack | |
| - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: package | |
| path: packages/toolkit/package.tgz | |
| test-dist: | |
| name: Run local tests against build artifact (React ${{ matrix.react.version }}) | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node: ['24.x'] | |
| react: | |
| - version: '^18' | |
| types: '^18' | |
| react-dom: { version: '^18', types: '^18' } | |
| - version: '^19' | |
| types: '^19' | |
| react-dom: { version: '^19', types: '^19' } | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Use node ${{ matrix.node }} | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: 'yarn' | |
| - name: Install deps | |
| run: yarn install | |
| - name: Download build artifact | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| name: package | |
| path: packages/toolkit | |
| - name: Check folder contents | |
| run: ls -lah | |
| - name: Install React ${{ matrix.react.version }} and React-DOM ${{ matrix.react.react-dom.version }} | |
| run: yarn up react@${{ matrix.react.version }} react-dom@${{ matrix.react.react-dom.version }} @types/react@${{ matrix.react.types }} @types/react-dom@${{ matrix.react.react-dom.types }} | |
| - name: Install build artifact | |
| run: yarn workspace @reduxjs/toolkit add $(pwd)/package.tgz | |
| - name: Erase path aliases | |
| run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json | |
| - name: Run type tests with `moduleResolution Bundler` | |
| run: rm -rf dist && yarn tsc -p . --moduleResolution Bundler --module ESNext --noEmit false --declaration --emitDeclarationOnly --outDir dist --target ESNext && rm -rf dist | |
| - name: Ensure there's no dist folder | |
| run: rm -rf dist | |
| - name: Change RTK package name to ensure node_modules is used | |
| run: sed -i -e 's|@reduxjs/toolkit|@reduxjs/toolkit-test|' ./package.json | |
| - name: Run tests, against installed artifact | |
| env: | |
| TEST_DIST: true | |
| working-directory: ./packages/toolkit | |
| run: ../../node_modules/.bin/vitest --run --typecheck | |
| test-types: | |
| name: 'Test Types: TS ${{ matrix.ts }} and React ${{ matrix.react.version }}' | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Sparse matrix: All TS versions with React 19, boundary TS versions with React 18 | |
| include: | |
| # React 19 × all TS versions | |
| - node: '24.x' | |
| ts: '5.4' | |
| react: | |
| { | |
| version: '^19', | |
| types: '^19', | |
| react-dom: { version: '^19', types: '^19' }, | |
| } | |
| - node: '24.x' | |
| ts: '5.5' | |
| react: | |
| { | |
| version: '^19', | |
| types: '^19', | |
| react-dom: { version: '^19', types: '^19' }, | |
| } | |
| - node: '24.x' | |
| ts: '5.6' | |
| react: | |
| { | |
| version: '^19', | |
| types: '^19', | |
| react-dom: { version: '^19', types: '^19' }, | |
| } | |
| - node: '24.x' | |
| ts: '5.7' | |
| react: | |
| { | |
| version: '^19', | |
| types: '^19', | |
| react-dom: { version: '^19', types: '^19' }, | |
| } | |
| - node: '24.x' | |
| ts: '5.8' | |
| react: | |
| { | |
| version: '^19', | |
| types: '^19', | |
| react-dom: { version: '^19', types: '^19' }, | |
| } | |
| - node: '24.x' | |
| ts: '5.9' | |
| react: | |
| { | |
| version: '^19', | |
| types: '^19', | |
| react-dom: { version: '^19', types: '^19' }, | |
| } | |
| - node: '24.x' | |
| ts: 'next' | |
| react: | |
| { | |
| version: '^19', | |
| types: '^19', | |
| react-dom: { version: '^19', types: '^19' }, | |
| } | |
| # React 18 × boundary TS versions only (5.4, 5.9, next) | |
| - node: '24.x' | |
| ts: '5.4' | |
| react: | |
| { | |
| version: '^18', | |
| types: '^18', | |
| react-dom: { version: '^18', types: '^18' }, | |
| } | |
| - node: '24.x' | |
| ts: '5.9' | |
| react: | |
| { | |
| version: '^18', | |
| types: '^18', | |
| react-dom: { version: '^18', types: '^18' }, | |
| } | |
| - node: '24.x' | |
| ts: 'next' | |
| react: | |
| { | |
| version: '^18', | |
| types: '^18', | |
| react-dom: { version: '^18', types: '^18' }, | |
| } | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Use node ${{ matrix.node }} | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: 'yarn' | |
| - name: Install deps | |
| run: yarn install | |
| - name: Install React ${{ matrix.react.version }} and React-DOM ${{ matrix.react.react-dom.version }} | |
| run: yarn up react@${{ matrix.react.version }} react-dom@${{ matrix.react.react-dom.version }} @types/react@${{ matrix.react.types }} @types/react-dom@${{ matrix.react.react-dom.types }} | |
| - name: Install TypeScript ${{ matrix.ts }} | |
| run: yarn add typescript@${{ matrix.ts }} | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| name: package | |
| path: packages/toolkit | |
| - name: Install build artifact | |
| run: yarn add ./package.tgz | |
| - name: Show installed RTK versions | |
| run: yarn info @reduxjs/toolkit | |
| - name: Erase path aliases | |
| run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json | |
| - name: Test types (TS 5.x) | |
| if: matrix.ts != 'next' && !startsWith(matrix.ts, '6.') | |
| env: | |
| TEST_DIST: true | |
| run: | | |
| yarn tsc --version | |
| yarn type-tests | |
| - name: Test types (TS 6.x/next) | |
| if: matrix.ts == 'next' || startsWith(matrix.ts, '6.') | |
| env: | |
| TEST_DIST: true | |
| run: | | |
| yarn tsc --version | |
| yarn tsc -p tsconfig.test.json --noEmit --ignoreDeprecations 6.0 | |
| test-published-artifact: | |
| name: Test Published Artifact ${{ matrix.example }} | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node: ['24.x'] | |
| example: | |
| [ | |
| 'cra4', | |
| 'cra5', | |
| 'next', | |
| 'vite', | |
| 'node-standard', | |
| 'node-esm', | |
| 'react-native', | |
| 'expo', | |
| ] | |
| defaults: | |
| run: | |
| working-directory: ./examples/publish-ci/${{ matrix.example }} | |
| env: | |
| YARN_ENABLE_IMMUTABLE_INSTALLS: false | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Use node ${{ matrix.node }} | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: 'yarn' | |
| - name: Install deps | |
| run: yarn install | |
| - name: Remove existing RTK | |
| run: yarn remove @reduxjs/toolkit | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| name: package | |
| path: ./examples/publish-ci/${{ matrix.example }} | |
| - name: Check folder contents | |
| run: ls -l . | |
| - name: Install RTK build artifact | |
| run: yarn add ./package.tgz | |
| - name: Show installed RTK versions | |
| run: yarn info @reduxjs/toolkit && yarn why @reduxjs/toolkit | |
| - name: Set up JDK 21 for React Native build | |
| if: matrix.example == 'react-native' || matrix.example == 'expo' | |
| uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 | |
| with: | |
| java-version: '21.x' | |
| distribution: 'temurin' | |
| cache: 'gradle' | |
| - name: Build example | |
| env: | |
| NODE_OPTIONS: --openssl-legacy-provider | |
| run: yarn build | |
| - name: Run test step | |
| run: yarn test | |
| are-the-types-wrong: | |
| name: Check package config with are-the-types-wrong | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node: ['24.x'] | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Use node ${{ matrix.node }} | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: 'yarn' | |
| - name: Install deps | |
| run: yarn install | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| name: package | |
| path: packages/toolkit | |
| - name: show folder | |
| run: ls -l . | |
| - name: Run are-the-types-wrong | |
| run: yarn attw ./package.tgz --format table --ignore-rules false-cjs | |
| test-type-portability: | |
| name: 'Test Type Portability: TS ${{ matrix.ts }} + Node ${{ matrix.node }}' | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Sparse matrix: All TS versions with bundler, boundary TS versions with nodenext | |
| include: | |
| # bundler × all TS versions | |
| - node: '24.x' | |
| ts: '5.4' | |
| example: { name: 'bundler', moduleResolution: 'Bundler' } | |
| - node: '24.x' | |
| ts: '5.5' | |
| example: { name: 'bundler', moduleResolution: 'Bundler' } | |
| - node: '24.x' | |
| ts: '5.6' | |
| example: { name: 'bundler', moduleResolution: 'Bundler' } | |
| - node: '24.x' | |
| ts: '5.7' | |
| example: { name: 'bundler', moduleResolution: 'Bundler' } | |
| - node: '24.x' | |
| ts: '5.8' | |
| example: { name: 'bundler', moduleResolution: 'Bundler' } | |
| - node: '24.x' | |
| ts: '5.9' | |
| example: { name: 'bundler', moduleResolution: 'Bundler' } | |
| - node: '24.x' | |
| ts: 'next' | |
| example: { name: 'bundler', moduleResolution: 'Bundler' } | |
| # nodenext-cjs × boundary TS versions only (5.4, 5.9, next) | |
| - node: '24.x' | |
| ts: '5.4' | |
| example: { name: 'nodenext-cjs', moduleResolution: 'NodeNext' } | |
| - node: '24.x' | |
| ts: '5.9' | |
| example: { name: 'nodenext-cjs', moduleResolution: 'NodeNext' } | |
| - node: '24.x' | |
| ts: 'next' | |
| example: { name: 'nodenext-cjs', moduleResolution: 'NodeNext' } | |
| # nodenext-esm × boundary TS versions only (5.4, 5.9, next) | |
| - node: '24.x' | |
| ts: '5.4' | |
| example: { name: 'nodenext-esm', moduleResolution: 'NodeNext' } | |
| - node: '24.x' | |
| ts: '5.9' | |
| example: { name: 'nodenext-esm', moduleResolution: 'NodeNext' } | |
| - node: '24.x' | |
| ts: 'next' | |
| example: { name: 'nodenext-esm', moduleResolution: 'NodeNext' } | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Use node ${{ matrix.node }} | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: 'yarn' | |
| - name: Install deps | |
| run: yarn install | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| name: package | |
| path: packages/toolkit | |
| - name: Install build artifact | |
| run: yarn workspace @examples-type-portability/${{ matrix.example.name }} add $(pwd)/package.tgz | |
| - name: Install TypeScript ${{ matrix.ts }} | |
| run: yarn workspace @examples-type-portability/${{ matrix.example.name }} add -D typescript@${{ matrix.ts }} | |
| - name: Test type portability with `moduleResolution ${{ matrix.example.moduleResolution }}` | |
| run: yarn workspace @examples-type-portability/${{ matrix.example.name }} run test | |
| - name: Test type portability with `moduleResolution Node10` | |
| if: matrix.ts != 'next' && !startsWith(matrix.ts, '6.') | |
| run: yarn workspace @examples-type-portability/${{ matrix.example.name }} run test --module CommonJS --moduleResolution Node10 --preserveSymLinks --verbatimModuleSyntax false | |
| - name: Test type portability with `moduleResolution Node10` and `type module` in `package.json` | |
| if: (matrix.example.name == 'nodenext-esm' || matrix.example.name == 'bundler') && matrix.ts != 'next' && !startsWith(matrix.ts, '6.') | |
| run: | | |
| npm --workspace=@examples-type-portability/${{ matrix.example.name }} pkg set type=module | |
| yarn workspace @examples-type-portability/${{ matrix.example.name }} run test --module ESNext --moduleResolution Node10 --preserveSymLinks --verbatimModuleSyntax false | |
| test-types-native-preview: | |
| if: false # Disabled pending TS 7.0 compatibility fixes | |
| name: 'Test Types: TypeScript Native Preview' | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| strategy: | |
| matrix: | |
| node: ['24.x'] | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Use node ${{ matrix.node }} | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: 'yarn' | |
| - name: Install deps | |
| run: yarn install | |
| - name: Install TypeScript Native Preview | |
| run: yarn add @typescript/native-preview | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| name: package | |
| path: packages/toolkit | |
| - name: Install build artifact | |
| run: yarn add ./package.tgz | |
| - name: Show installed RTK versions | |
| run: yarn info @reduxjs/toolkit | |
| - name: Erase path aliases | |
| run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json | |
| - name: Test types with tsgo | |
| env: | |
| TEST_DIST: true | |
| run: | | |
| yarn tsgo --version | |
| yarn tsgo -p tsconfig.test.json --noEmit --moduleResolution Bundler | |
| - name: Install build artifact for type-portability example | |
| run: yarn workspace @examples-type-portability/bundler add $(pwd)/package.tgz | |
| - name: Install TypeScript Native Preview for type-portability example | |
| run: yarn workspace @examples-type-portability/bundler add -D @typescript/native-preview | |
| - name: Test type portability with tsgo (bundler example) | |
| run: yarn workspace @examples-type-portability/bundler exec tsgo --noEmit |