Skip to content

Commit 5cd1cad

Browse files
committed
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit into migrate-to-react-19
2 parents 3bf4f28 + eef4250 commit 5cd1cad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+6200
-2057
lines changed

.github/workflows/test-codegen.yml

Lines changed: 112 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
33

4-
name: RTK-Query OpenAPI Codegen Tests
4+
name: RTKQ OpenAPI Codegen
55
defaults:
66
run:
77
working-directory: ./packages/rtk-query-codegen-openapi
@@ -23,24 +23,128 @@ jobs:
2323
codegen:
2424
- 'packages/rtk-query-codegen-openapi/**'
2525
- 'yarn.lock'
26+
- '.github/workflows/test-codegen.yml'
2627
2728
build:
28-
needs: changes
29+
needs: [changes]
2930
if: ${{ needs.changes.outputs.codegen == 'true' }}
3031

31-
runs-on: ubuntu-latest
32+
defaults:
33+
run:
34+
working-directory: ./packages/rtk-query-codegen-openapi
35+
36+
runs-on: ${{ matrix.os }}
37+
38+
name: 'Build artifact: ${{ matrix.os }} + Node ${{ matrix.node-version }}'
3239

3340
strategy:
3441
matrix:
3542
node-version: ['20.x']
43+
os: [ubuntu-latest]
3644

3745
steps:
38-
- uses: actions/checkout@v4
39-
- name: Use Node.js ${{ matrix.node-version }}
46+
- name: Checkout repository
47+
uses: actions/checkout@v4
48+
49+
- name: Setup Node ${{ matrix.node-version }}
50+
uses: actions/setup-node@v4
51+
with:
52+
node-version: ${{ matrix.node-version }}
53+
cache: 'yarn'
54+
55+
- name: Install dependencies
56+
run: yarn install
57+
58+
- name: Pack
59+
run: yarn pack
60+
61+
- name: Upload artifact
62+
uses: actions/upload-artifact@v4
63+
id: artifact-upload-step
64+
with:
65+
name: package
66+
path: ./packages/rtk-query-codegen-openapi/package.tgz
67+
68+
- name: Did we fail?
69+
if: failure()
70+
run: ls -lR
71+
72+
test:
73+
needs: build
74+
defaults:
75+
run:
76+
working-directory: ./packages/rtk-query-codegen-openapi
77+
name: 'Test build artifact: ${{ matrix.os }} + Node ${{ matrix.node-version }}'
78+
runs-on: ${{ matrix.os }}
79+
strategy:
80+
fail-fast: false
81+
matrix:
82+
node-version: [20.x]
83+
os: [ubuntu-latest]
84+
85+
steps:
86+
- name: Checkout repository
87+
uses: actions/checkout@v4
88+
89+
- name: Setup Node ${{ matrix.node-version }}
4090
uses: actions/setup-node@v4
4191
with:
42-
node-version: ${{ matrix.node }}
92+
node-version: ${{ matrix.node-version }}
4393
cache: 'yarn'
4494

45-
- run: yarn install
46-
- run: yarn test
95+
- name: Download artifact
96+
id: download-artifact
97+
uses: actions/download-artifact@v4
98+
with:
99+
path: ./packages/rtk-query-codegen-openapi
100+
name: package
101+
102+
- name: Install dependencies
103+
run: yarn install
104+
105+
- name: Install build artifact
106+
run: yarn add ./package.tgz
107+
108+
- name: Remove path alias
109+
run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.json
110+
111+
- name: Run tests
112+
run: yarn test
113+
env:
114+
TEST_DIST: true
115+
116+
- name: Did we fail?
117+
if: failure()
118+
run: ls -R
119+
120+
are-the-types-wrong:
121+
name: Check package definition with are-the-types-wrong
122+
123+
needs: [build]
124+
runs-on: ubuntu-latest
125+
strategy:
126+
fail-fast: false
127+
matrix:
128+
node-version: [20.x]
129+
steps:
130+
- name: Checkout repo
131+
uses: actions/checkout@v4
132+
133+
- name: Use node ${{ matrix.node-version }}
134+
uses: actions/setup-node@v4
135+
with:
136+
node-version: ${{ matrix.node-version }}
137+
cache: 'yarn'
138+
139+
- name: Install deps
140+
run: yarn install
141+
142+
- name: Download artifact
143+
id: download-artifact
144+
uses: actions/download-artifact@v4
145+
with:
146+
path: ./packages/rtk-query-codegen-openapi
147+
name: package
148+
149+
- name: Run are-the-types-wrong
150+
run: yarn dlx @arethetypeswrong/cli@latest ./package.tgz --format table

.github/workflows/tests.yml

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -122,67 +122,16 @@ jobs:
122122
- name: Run type tests with `moduleResolution Bundler`
123123
run: rm -rf dist && yarn tsc -p . --moduleResolution Bundler --module ESNext --noEmit false --declaration --emitDeclarationOnly --outDir dist --target ESNext && rm -rf dist
124124

125-
test-type-portability:
126-
name: Test Type Portability with TypeScript ${{ matrix.ts }} and Node.js ${{ matrix.node }}
127-
needs: [build]
128-
runs-on: ubuntu-latest
129-
strategy:
130-
fail-fast: false
131-
matrix:
132-
node: ['20.x']
133-
ts: ['5.0', '5.1', '5.2', '5.3', '5.4', '5.5', 'next']
134-
example:
135-
[
136-
{ name: 'bundler', moduleResolution: 'Bundler' },
137-
{ name: 'nodenext-cjs', moduleResolution: 'NodeNext' },
138-
{ name: 'nodenext-esm', moduleResolution: 'NodeNext' },
139-
]
140-
steps:
141-
- name: Checkout repo
142-
uses: actions/checkout@v4
143-
144-
- name: Use node ${{ matrix.node }}
145-
uses: actions/setup-node@v4
146-
with:
147-
node-version: ${{ matrix.node }}
148-
cache: 'yarn'
149-
150-
- name: Install deps
151-
run: yarn install
152-
153-
- uses: actions/download-artifact@v4
154-
with:
155-
name: package
156-
path: packages/toolkit
157-
158-
- name: Install build artifact
159-
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} add $(pwd)/package.tgz
160-
161-
- name: Install TypeScript ${{ matrix.ts }}
162-
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} add -D typescript@${{ matrix.ts }}
163-
164-
- name: Test type portability with `moduleResolution ${{ matrix.example.moduleResolution }}`
165-
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} run test
166-
167-
- name: Test type portability with `moduleResolution Node10`
168-
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} run test --module CommonJS --moduleResolution Node10 --preserveSymLinks --verbatimModuleSyntax false
169-
170-
- name: Test type portability with `moduleResolution Node10` and `type module` in `package.json`
171-
if: matrix.example.name == 'nodenext-esm' || matrix.example.name == 'bundler'
172-
run: |
173-
npm --workspace=@examples-type-portability/${{ matrix.example.name }} pkg set type=module
174-
yarn workspace @examples-type-portability/${{ matrix.example.name }} run test --module ESNext --moduleResolution Node10 --preserveSymLinks --verbatimModuleSyntax false
175-
176125
test-types:
177-
name: Test Types with TypeScript ${{ matrix.ts }} and React ${{ matrix.react.version }}
126+
name: 'Test Types: TS ${{ matrix.ts }}'
178127

179128
needs: [build]
180129
runs-on: ubuntu-latest
181130
strategy:
182131
fail-fast: false
183132
matrix:
184133
node: ['20.x']
185-
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3', '5.4']
134+
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3', '5.4', '5.5']
186135
react:
187136
[
188137
{
@@ -339,3 +288,54 @@ jobs:
339288

340289
- name: Run are-the-types-wrong
341290
run: yarn attw ./package.tgz --format table --ignore-rules false-cjs
291+
292+
test-type-portability:
293+
name: 'Test Type Portability: TS ${{ matrix.ts }} + Node ${{ matrix.node }}'
294+
needs: [build]
295+
runs-on: ubuntu-latest
296+
strategy:
297+
fail-fast: false
298+
matrix:
299+
node: ['20.x']
300+
ts: ['5.3', '5.4', '5.5', 'next']
301+
example:
302+
[
303+
{ name: 'bundler', moduleResolution: 'Bundler' },
304+
{ name: 'nodenext-cjs', moduleResolution: 'NodeNext' },
305+
{ name: 'nodenext-esm', moduleResolution: 'NodeNext' },
306+
]
307+
steps:
308+
- name: Checkout repo
309+
uses: actions/checkout@v4
310+
311+
- name: Use node ${{ matrix.node }}
312+
uses: actions/setup-node@v4
313+
with:
314+
node-version: ${{ matrix.node }}
315+
cache: 'yarn'
316+
317+
- name: Install deps
318+
run: yarn install
319+
320+
- uses: actions/download-artifact@v4
321+
with:
322+
name: package
323+
path: packages/toolkit
324+
325+
- name: Install build artifact
326+
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} add $(pwd)/package.tgz
327+
328+
- name: Install TypeScript ${{ matrix.ts }}
329+
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} add -D typescript@${{ matrix.ts }}
330+
331+
- name: Test type portability with `moduleResolution ${{ matrix.example.moduleResolution }}`
332+
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} run test
333+
334+
- name: Test type portability with `moduleResolution Node10`
335+
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} run test --module CommonJS --moduleResolution Node10 --preserveSymLinks --verbatimModuleSyntax false
336+
337+
- name: Test type portability with `moduleResolution Node10` and `type module` in `package.json`
338+
if: matrix.example.name == 'nodenext-esm' || matrix.example.name == 'bundler'
339+
run: |
340+
npm --workspace=@examples-type-portability/${{ matrix.example.name }} pkg set type=module
341+
yarn workspace @examples-type-portability/${{ matrix.example.name }} run test --module ESNext --moduleResolution Node10 --preserveSymLinks --verbatimModuleSyntax false

0 commit comments

Comments
 (0)