Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
Browse files Browse the repository at this point in the history
…o fix-size-limit-config
  • Loading branch information
aryaemami59 committed Sep 3, 2024
2 parents a10f72b + eef4250 commit 764eb4e
Show file tree
Hide file tree
Showing 55 changed files with 6,561 additions and 2,096 deletions.
120 changes: 112 additions & 8 deletions .github/workflows/test-codegen.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: RTK-Query OpenAPI Codegen Tests
name: RTKQ OpenAPI Codegen
defaults:
run:
working-directory: ./packages/rtk-query-codegen-openapi
Expand All @@ -23,24 +23,128 @@ jobs:
codegen:
- 'packages/rtk-query-codegen-openapi/**'
- 'yarn.lock'
- '.github/workflows/test-codegen.yml'
build:
needs: changes
needs: [changes]
if: ${{ needs.changes.outputs.codegen == 'true' }}

runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/rtk-query-codegen-openapi

runs-on: ${{ matrix.os }}

name: 'Build artifact: ${{ matrix.os }} + Node ${{ matrix.node-version }}'

strategy:
matrix:
node-version: ['20.x']
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install dependencies
run: yarn install

- name: Pack
run: yarn pack

- name: Upload artifact
uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: package
path: ./packages/rtk-query-codegen-openapi/package.tgz

- name: Did we fail?
if: failure()
run: ls -lR

test:
needs: build
defaults:
run:
working-directory: ./packages/rtk-query-codegen-openapi
name: 'Test build artifact: ${{ matrix.os }} + Node ${{ matrix.node-version }}'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node-version: [20.x]
os: [ubuntu-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- run: yarn install
- run: yarn test
- name: Download artifact
id: download-artifact
uses: actions/download-artifact@v4
with:
path: ./packages/rtk-query-codegen-openapi
name: package

- name: Install dependencies
run: yarn install

- name: Install build artifact
run: yarn add ./package.tgz

- name: Remove path alias
run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.json

- name: Run tests
run: yarn test
env:
TEST_DIST: true

- name: Did we fail?
if: failure()
run: ls -R

are-the-types-wrong:
name: Check package definition with are-the-types-wrong

needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [20.x]
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Use node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install deps
run: yarn install

- name: Download artifact
id: download-artifact
uses: actions/download-artifact@v4
with:
path: ./packages/rtk-query-codegen-openapi
name: package

- name: Run are-the-types-wrong
run: yarn dlx @arethetypeswrong/cli@latest ./package.tgz --format table
106 changes: 53 additions & 53 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,67 +102,16 @@ jobs:
- 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

test-type-portability:
name: Test Type Portability with TypeScript ${{ matrix.ts }} and Node.js ${{ matrix.node }}
needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ['20.x']
ts: ['5.0', '5.1', '5.2', '5.3', '5.4', '5.5', 'next']
example:
[
{ name: 'bundler', moduleResolution: 'Bundler' },
{ name: 'nodenext-cjs', moduleResolution: 'NodeNext' },
{ name: 'nodenext-esm', moduleResolution: 'NodeNext' },
]
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'

- name: Install deps
run: yarn install

- uses: actions/download-artifact@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`
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'
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:
name: Test Types with TypeScript ${{ matrix.ts }}
name: 'Test Types: TS ${{ matrix.ts }}'

needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ['20.x']
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3', '5.4']
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3', '5.4', '5.5']
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -301,3 +250,54 @@ jobs:

- 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:
node: ['20.x']
ts: ['5.3', '5.4', '5.5', 'next']
example:
[
{ name: 'bundler', moduleResolution: 'Bundler' },
{ name: 'nodenext-cjs', moduleResolution: 'NodeNext' },
{ name: 'nodenext-esm', moduleResolution: 'NodeNext' },
]
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'

- name: Install deps
run: yarn install

- uses: actions/download-artifact@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`
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'
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
Loading

0 comments on commit 764eb4e

Please sign in to comment.