Skip to content

Commit ef6c07f

Browse files
committed
Run both runtime and type tests against the dist folder during CI
1 parent eb79ff3 commit ef6c07f

File tree

1 file changed

+52
-22
lines changed

1 file changed

+52
-22
lines changed

.github/workflows/build-and-test-types.yml

+52-22
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: CI
22

3-
on:
4-
push:
5-
branches: [master]
6-
pull_request:
7-
branches: [master]
3+
on: [push, pull_request, workflow_dispatch]
84

95
jobs:
106
build:
@@ -69,13 +65,15 @@ jobs:
6965
node-version: ${{ matrix.node }}
7066
cache: 'yarn'
7167

68+
- name: Download build artifact
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: package
72+
path: .
73+
7274
- name: Install deps
7375
run: yarn install
7476

75-
# Build with the actual TS version in the repo
76-
- name: Pack
77-
run: yarn build && yarn pack
78-
7977
- name: Install build artifact
8078
run: yarn add ./package.tgz
8179

@@ -85,11 +83,12 @@ jobs:
8583

8684
# Remove config line that points "reselect" to the `src` folder,
8785
# so that the typetest will use the installed version instead
88-
- run: sed -i -e /@remap-prod-remove-line/d tsconfig.base.json vitest.config.mts
86+
- name: Erase path aliases
87+
run: sed -i -e /@remap-prod-remove-line/d tsconfig.base.json vitest.config.mts
8988

9089
- name: Test types
9190
run: |
92-
./node_modules/.bin/tsc --version
91+
yarn tsc --version
9392
yarn type-tests
9493
9594
are-the-types-wrong:
@@ -105,7 +104,8 @@ jobs:
105104
- name: Checkout repo
106105
uses: actions/checkout@v4
107106

108-
- uses: actions/download-artifact@v4
107+
- name: Download build artifact
108+
uses: actions/download-artifact@v4
109109
with:
110110
name: package
111111
path: .
@@ -150,16 +150,6 @@ jobs:
150150
- name: Check folder contents
151151
run: ls -l .
152152

153-
# Some weird install diffs with cloning this repo and installing.
154-
# Just kill the lockfiles for this repo and RTK and reinstall
155-
156-
- name: Remove top lockfile
157-
run: rm yarn.lock && rm package.json
158-
159-
- name: Remove RTK lockfile
160-
working-directory: ./redux-toolkit
161-
run: rm yarn.lock && rm package.json
162-
163153
- name: Install deps
164154
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
165155
env:
@@ -208,3 +198,43 @@ jobs:
208198
- name: Run test step
209199
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
210200
run: yarn test
201+
202+
test-dist:
203+
name: Run local tests against build artifact
204+
needs: [build]
205+
runs-on: ubuntu-latest
206+
strategy:
207+
fail-fast: false
208+
matrix:
209+
node: ['20.x']
210+
211+
steps:
212+
- name: Checkout repo
213+
uses: actions/checkout@v4
214+
215+
- name: Use node ${{ matrix.node }}
216+
uses: actions/setup-node@v4
217+
with:
218+
node-version: ${{ matrix.node }}
219+
cache: 'yarn'
220+
221+
- name: Install dependencies
222+
run: yarn install
223+
224+
- name: Download build artifact
225+
uses: actions/download-artifact@v4
226+
with:
227+
name: package
228+
path: .
229+
230+
- name: Check folder contents
231+
run: ls -lah
232+
233+
- name: Install build artifact
234+
run: yarn add ./package.tgz
235+
236+
- name: Erase path aliases
237+
run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json ./vitest.config.mts
238+
239+
- name: Run local tests against the build artifact
240+
run: yarn test

0 commit comments

Comments
 (0)