Skip to content

Commit 764eb4e

Browse files
committed
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit into fix-size-limit-config
2 parents a10f72b + eef4250 commit 764eb4e

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

+6561
-2096
lines changed

.github/workflows/test-codegen.yml

+112-8
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

+53-53
Original file line numberDiff line numberDiff line change
@@ -102,67 +102,16 @@ jobs:
102102
- name: Run type tests with `moduleResolution Bundler`
103103
run: rm -rf dist && yarn tsc -p . --moduleResolution Bundler --module ESNext --noEmit false --declaration --emitDeclarationOnly --outDir dist --target ESNext && rm -rf dist
104104

105-
test-type-portability:
106-
name: Test Type Portability with TypeScript ${{ matrix.ts }} and Node.js ${{ matrix.node }}
107-
needs: [build]
108-
runs-on: ubuntu-latest
109-
strategy:
110-
fail-fast: false
111-
matrix:
112-
node: ['20.x']
113-
ts: ['5.0', '5.1', '5.2', '5.3', '5.4', '5.5', 'next']
114-
example:
115-
[
116-
{ name: 'bundler', moduleResolution: 'Bundler' },
117-
{ name: 'nodenext-cjs', moduleResolution: 'NodeNext' },
118-
{ name: 'nodenext-esm', moduleResolution: 'NodeNext' },
119-
]
120-
steps:
121-
- name: Checkout repo
122-
uses: actions/checkout@v4
123-
124-
- name: Use node ${{ matrix.node }}
125-
uses: actions/setup-node@v4
126-
with:
127-
node-version: ${{ matrix.node }}
128-
cache: 'yarn'
129-
130-
- name: Install deps
131-
run: yarn install
132-
133-
- uses: actions/download-artifact@v4
134-
with:
135-
name: package
136-
path: packages/toolkit
137-
138-
- name: Install build artifact
139-
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} add $(pwd)/package.tgz
140-
141-
- name: Install TypeScript ${{ matrix.ts }}
142-
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} add -D typescript@${{ matrix.ts }}
143-
144-
- name: Test type portability with `moduleResolution ${{ matrix.example.moduleResolution }}`
145-
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} run test
146-
147-
- name: Test type portability with `moduleResolution Node10`
148-
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} run test --module CommonJS --moduleResolution Node10 --preserveSymLinks --verbatimModuleSyntax false
149-
150-
- name: Test type portability with `moduleResolution Node10` and `type module` in `package.json`
151-
if: matrix.example.name == 'nodenext-esm' || matrix.example.name == 'bundler'
152-
run: |
153-
npm --workspace=@examples-type-portability/${{ matrix.example.name }} pkg set type=module
154-
yarn workspace @examples-type-portability/${{ matrix.example.name }} run test --module ESNext --moduleResolution Node10 --preserveSymLinks --verbatimModuleSyntax false
155-
156105
test-types:
157-
name: Test Types with TypeScript ${{ matrix.ts }}
106+
name: 'Test Types: TS ${{ matrix.ts }}'
158107

159108
needs: [build]
160109
runs-on: ubuntu-latest
161110
strategy:
162111
fail-fast: false
163112
matrix:
164113
node: ['20.x']
165-
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3', '5.4']
114+
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3', '5.4', '5.5']
166115
steps:
167116
- name: Checkout repo
168117
uses: actions/checkout@v4
@@ -301,3 +250,54 @@ jobs:
301250

302251
- name: Run are-the-types-wrong
303252
run: yarn attw ./package.tgz --format table --ignore-rules false-cjs
253+
254+
test-type-portability:
255+
name: 'Test Type Portability: TS ${{ matrix.ts }} + Node ${{ matrix.node }}'
256+
needs: [build]
257+
runs-on: ubuntu-latest
258+
strategy:
259+
fail-fast: false
260+
matrix:
261+
node: ['20.x']
262+
ts: ['5.3', '5.4', '5.5', 'next']
263+
example:
264+
[
265+
{ name: 'bundler', moduleResolution: 'Bundler' },
266+
{ name: 'nodenext-cjs', moduleResolution: 'NodeNext' },
267+
{ name: 'nodenext-esm', moduleResolution: 'NodeNext' },
268+
]
269+
steps:
270+
- name: Checkout repo
271+
uses: actions/checkout@v4
272+
273+
- name: Use node ${{ matrix.node }}
274+
uses: actions/setup-node@v4
275+
with:
276+
node-version: ${{ matrix.node }}
277+
cache: 'yarn'
278+
279+
- name: Install deps
280+
run: yarn install
281+
282+
- uses: actions/download-artifact@v4
283+
with:
284+
name: package
285+
path: packages/toolkit
286+
287+
- name: Install build artifact
288+
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} add $(pwd)/package.tgz
289+
290+
- name: Install TypeScript ${{ matrix.ts }}
291+
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} add -D typescript@${{ matrix.ts }}
292+
293+
- name: Test type portability with `moduleResolution ${{ matrix.example.moduleResolution }}`
294+
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} run test
295+
296+
- name: Test type portability with `moduleResolution Node10`
297+
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} run test --module CommonJS --moduleResolution Node10 --preserveSymLinks --verbatimModuleSyntax false
298+
299+
- name: Test type portability with `moduleResolution Node10` and `type module` in `package.json`
300+
if: matrix.example.name == 'nodenext-esm' || matrix.example.name == 'bundler'
301+
run: |
302+
npm --workspace=@examples-type-portability/${{ matrix.example.name }} pkg set type=module
303+
yarn workspace @examples-type-portability/${{ matrix.example.name }} run test --module ESNext --moduleResolution Node10 --preserveSymLinks --verbatimModuleSyntax false

0 commit comments

Comments
 (0)