From 17ae2285aba00a333264ebecc4bf277bac8f5d7a Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Sat, 28 Oct 2023 12:34:50 -0400 Subject: [PATCH] Copy RTK 2.0 beta CI setup from React-Redux repo --- .github/workflows/build-and-test-types.yml | 75 +++++++++++++++------- 1 file changed, 52 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build-and-test-types.yml b/.github/workflows/build-and-test-types.yml index 697752a08..16b53f0b0 100644 --- a/.github/workflows/build-and-test-types.yml +++ b/.github/workflows/build-and-test-types.yml @@ -8,7 +8,7 @@ on: jobs: build: - name: Lint, Test, Report Coverage on Node ${{ matrix.node }} + name: Build and Test on Node ${{ matrix.node }} runs-on: ubuntu-latest strategy: matrix: @@ -58,12 +58,13 @@ jobs: matrix: node: ['16.x'] ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2'] + steps: - name: Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Use node ${{ matrix.node }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} cache: 'yarn' @@ -94,6 +95,28 @@ jobs: ./node_modules/.bin/tsc --version yarn test:typescript + 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: ['16.x'] + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - uses: actions/download-artifact@v3 + with: + name: package + path: . + + # Note: We currently expect "FalseCJS" failures for Node16 + `moduleResolution: "node16", + - name: Run are-the-types-wrong + run: npx @arethetypeswrong/cli ./package.tgz --format table --ignore-rules false-cjs + test-published-artifact: name: Test Published Artifact ${{ matrix.example }} @@ -103,22 +126,13 @@ jobs: fail-fast: false matrix: node: ['16.x'] - example: - [ - 'cra4', - 'cra5', - 'next', - 'vite', - 'node-standard', - 'node-esm', - 'are-the-types-wrong' - ] + example: ['cra4', 'cra5', 'next', 'vite', 'node-standard', 'node-esm'] steps: - name: Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Use node ${{ matrix.node }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3.8.1 with: node-version: ${{ matrix.node }} cache: 'yarn' @@ -126,12 +140,31 @@ jobs: - name: Clone RTK repo run: git clone https://github.com/reduxjs/redux-toolkit.git ./redux-toolkit + - name: Check out v2.0-integration + working-directory: ./redux-toolkit + run: git checkout v2.0-integration + - name: Check folder contents run: ls -l . + # Some weird install diffs with cloning this repo and installing. + # Just kill the lockfiles for this repo and RTK and reinstall + + - name: Remove top lockfile + run: rm yarn.lock && rm package.json + + - name: Remove RTK lockfile + working-directory: ./redux-toolkit + run: rm yarn.lock && rm package.json + - name: Install deps working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }} - run: yarn install + run: rm yarn.lock && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn add msw@latest + + - name: Install Playwright browser if necessary + working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }} + continue-on-error: true + run: yarn playwright install - uses: actions/download-artifact@v2 with: @@ -150,6 +183,9 @@ jobs: working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }} run: yarn info reselect && yarn why reselect + - name: Check MSW version + run: yarn why msw + - name: Build example working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }} run: yarn build @@ -157,10 +193,3 @@ jobs: - 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 (attw) - 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'