Skip to content

Introduce pre-typed listener middleware via listenerMiddleware.withTypes<RootState, AppDispatch>() method #4892

Introduce pre-typed listener middleware via listenerMiddleware.withTypes<RootState, AppDispatch>() method

Introduce pre-typed listener middleware via listenerMiddleware.withTypes<RootState, AppDispatch>() method #4892

Workflow file for this run

name: CI
on: [push, 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@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
toolkit:
- 'packages/toolkit/**'
- 'examples/publish-ci/**'
- '.github/workflows/tests.yml'
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: ['18.x']
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
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: node scripts/writeGitVersion.mjs $(git rev-parse --short HEAD)
- name: Check updated version
run: jq .version package.json
- name: Pack
run: yarn pack
- uses: actions/upload-artifact@v2
with:
name: package
path: packages/toolkit/package.tgz
test-dist:
name: Test against dist
needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ['18.x']
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Install deps
run: yarn install
- uses: actions/download-artifact@v2
with:
name: package
path: packages/toolkit
- run: ls -lah
- name: Install build artifact
run: yarn workspace @reduxjs/toolkit add $(pwd)/package.tgz
- run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json ./vitest.config.ts ./src/tests/*.* ./src/query/tests/*.*
- name: Run tests, against dist
run: yarn test
test-types:
name: Test Types with TypeScript ${{ matrix.ts }}
needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ['18.x']
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3']
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Install deps
run: yarn install
- name: Install TypeScript ${{ matrix.ts }}
run: yarn add typescript@${{ matrix.ts }}
- uses: actions/download-artifact@v2
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
- run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json ./vitest.config.ts ./src/tests/*.* ./src/query/tests/*.*
- name: Test types
run: |
yarn tsc --version
yarn type-tests
test-published-artifact:
name: Test Published Artifact ${{ matrix.example }}
needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ['18.x']
example: ['cra4', 'cra5', 'next', 'vite', 'node-standard', 'node-esm', 'expo']
defaults:
run:
working-directory: ./examples/publish-ci/${{ matrix.example }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
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@v2
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 17 for React Native build
if: matrix.example == 'react-native' || matrix.example == 'expo'
uses: actions/setup-java@v2
with:
java-version: '17.x'
distribution: 'temurin'
- name: Build example
run: NODE_OPTIONS=--openssl-legacy-provider 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: ['18.x']
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Install deps
run: yarn install
- uses: actions/download-artifact@v2
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