Enable prefer type-only imports #1015
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] | |
jobs: | |
changes: | |
name: Check for changes | |
runs-on: ubuntu-latest | |
outputs: | |
src: ${{ steps.filter.outputs.src }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
src: | |
- '.github/**' | |
- 'src/**' | |
- 'test/**' | |
- '.github/**/*.yaml' | |
- 'tsup.config.ts' | |
build: | |
needs: changes | |
if: ${{ needs.changes.outputs.src == 'true' }} | |
name: Lint, Test, Build & Pack on Node ${{ matrix.node }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: ['16.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 | |
- name: Build | |
run: yarn build | |
- name: Pack | |
run: yarn pack | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: package | |
path: ./package.tgz | |
test-dist: | |
name: Test against dist | |
needs: [build] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node: ['16.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: . | |
- run: ls -lah | |
- name: Install build artifact | |
run: yarn add ./package.tgz | |
- run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.json ./vitest.config.ts ./test/tsconfig.json ./test/typescript/tsconfig.json | |
- 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: ['16.x'] | |
ts: ['4.7', '4.8', '4.9', '5.0'] | |
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: . | |
- name: Install build artifact | |
run: yarn add ./package.tgz | |
- name: Test types | |
run: | | |
yarn tsc --version | |
yarn check-types | |
yarn test:typecheck | |
yarn test:types | |
test-published-artifact: | |
name: Test Published Artifact ${{ matrix.example }} | |
needs: [build] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node: ['16.x'] | |
example: | |
[ | |
'cra4', | |
'cra5', | |
'next', | |
'vite', | |
'node-standard', | |
'node-esm', | |
'are-the-types-wrong' | |
] | |
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: Clone RTK repo | |
run: git clone https://github.com/reduxjs/redux-toolkit.git ./redux-toolkit | |
- name: Check folder contents | |
run: ls -l . | |
- name: Install deps | |
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }} | |
run: yarn install | |
- uses: actions/download-artifact@v2 | |
with: | |
name: package | |
path: ./redux-toolkit/examples/publish-ci/${{ matrix.example }} | |
- name: Check folder contents | |
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }} | |
run: ls -l . | |
- name: Install build artifact | |
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }} | |
run: yarn add ./package.tgz | |
- name: Show installed package versions | |
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }} | |
run: yarn info redux && yarn why redux | |
- name: Build example | |
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }} | |
run: yarn build | |
- name: Run test step | |
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }} | |
run: yarn test | |
if: matrix.example != 'are-the-types-wrong' | |
- name: Run test step | |
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }} | |
# Ignore "FalseCJS" errors in the `attw` job | |
run: yarn test -n FalseCJS | |
if: matrix.example == 'are-the-types-wrong' |