Apply changes required by the centralized tooling configs #7242
Workflow file for this run
This file contains 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, 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@v4 | |
- uses: dorny/paths-filter@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: ['20.x'] | |
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 | |
- name: Check formatting | |
run: yarn workspaces foreach -Ap -j unlimited run format-check | |
- name: Lint files | |
run: yarn workspaces foreach -Ap -j unlimited run lint | |
# 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@v4 | |
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: ['20.x'] | |
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 | |
- 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 | |
- name: Run tests, against dist | |
env: | |
TEST_DIST: true | |
run: yarn test | |
- 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-types: | |
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', '5.5'] | |
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 | |
- name: Install TypeScript ${{ matrix.ts }} | |
run: yarn add typescript@${{ matrix.ts }} | |
- uses: actions/download-artifact@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 | |
- run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json | |
- name: Test types | |
env: | |
TEST_DIST: true | |
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: ['20.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@v4 | |
- name: Use node ${{ matrix.node }} | |
uses: actions/setup-node@v4 | |
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@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 17 for React Native build | |
if: matrix.example == 'react-native' || matrix.example == 'expo' | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17.x' | |
distribution: 'temurin' | |
- 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: ['20.x'] | |
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: 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: | |
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 |