diff --git a/.github/workflows/build-and-test-types.yml b/.github/workflows/build-and-test-types.yml index 8fa7c967a..5e8f877de 100644 --- a/.github/workflows/build-and-test-types.yml +++ b/.github/workflows/build-and-test-types.yml @@ -1,10 +1,6 @@ name: CI -on: - push: - branches: [master] - pull_request: - branches: [master] +on: [push, pull_request, workflow_dispatch] jobs: build: @@ -69,13 +65,15 @@ jobs: node-version: ${{ matrix.node }} cache: 'yarn' + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: package + path: . + - name: Install deps run: yarn install - # Build with the actual TS version in the repo - - name: Pack - run: yarn build && yarn pack - - name: Install build artifact run: yarn add ./package.tgz @@ -85,11 +83,12 @@ jobs: # Remove config line that points "reselect" to the `src` folder, # so that the typetest will use the installed version instead - - run: sed -i -e /@remap-prod-remove-line/d tsconfig.base.json vitest.config.mts + - name: Erase path aliases + run: sed -i -e /@remap-prod-remove-line/d tsconfig.base.json vitest.config.mts - name: Test types run: | - ./node_modules/.bin/tsc --version + yarn tsc --version yarn type-tests are-the-types-wrong: @@ -105,7 +104,8 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - name: Download build artifact + uses: actions/download-artifact@v4 with: name: package path: . @@ -150,16 +150,6 @@ jobs: - 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 }} env: @@ -208,3 +198,43 @@ jobs: - name: Run test step working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }} run: yarn test + + test-dist: + name: Run local tests against build artifact + 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 dependencies + run: yarn install + + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: package + path: . + + - name: Check folder contents + run: ls -lah + + - name: Install build artifact + run: yarn add ./package.tgz + + - name: Erase path aliases + run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json ./vitest.config.mts + + - name: Run local tests against the build artifact + run: yarn test