11name : CI
22
3- on :
4- push :
5- branches : [master]
6- pull_request :
7- branches : [master]
3+ on : [push, pull_request, workflow_dispatch]
84
95jobs :
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 : .
@@ -147,29 +147,23 @@ jobs:
147147 - name : Clone RTK repo
148148 run : git clone https://github.com/reduxjs/redux-toolkit.git ./redux-toolkit
149149
150+ - name : Cache example deps
151+ uses : actions/cache@v4
152+ with :
153+ path : ./redux-toolkit/examples/publish-ci/${{ matrix.example }}/node_modules
154+ key : test-published-artifact-${{ matrix.example }}-node_modules
155+
150156 - name : Check folder contents
151157 run : ls -l .
152158
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-
163- - name : Install deps
159+ - name : Install example deps
164160 working-directory : ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
165- env :
166- YARN_ENABLE_IMMUTABLE_INSTALLS : false
167- run : rm yarn.lock && yarn install
161+ run : yarn install
168162
169163 - name : Install Playwright browser if necessary
170164 working-directory : ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
171165 continue-on-error : true
172- run : yarn playwright install
166+ run : yarn playwright install || true
173167
174168 - uses : actions/download-artifact@v4
175169 with :
@@ -188,17 +182,6 @@ jobs:
188182 working-directory : ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
189183 run : yarn info reselect && yarn why reselect
190184
191- - name : Set up JDK 17 for React Native build
192- if : matrix.example == 'react-native'
193- uses : actions/setup-java@v4
194- with :
195- java-version : ' 17.x'
196- distribution : ' temurin'
197-
198- - name : Check MSW version
199- working-directory : ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
200- run : yarn why msw
201-
202185 - name : Build example
203186 working-directory : ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
204187 env :
@@ -208,3 +191,43 @@ jobs:
208191 - name : Run test step
209192 working-directory : ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
210193 run : yarn test
194+
195+ test-dist :
196+ name : Run local tests against build artifact
197+ needs : [build]
198+ runs-on : ubuntu-latest
199+ strategy :
200+ fail-fast : false
201+ matrix :
202+ node : ['20.x']
203+
204+ steps :
205+ - name : Checkout repo
206+ uses : actions/checkout@v4
207+
208+ - name : Use node ${{ matrix.node }}
209+ uses : actions/setup-node@v4
210+ with :
211+ node-version : ${{ matrix.node }}
212+ cache : ' yarn'
213+
214+ - name : Install dependencies
215+ run : yarn install
216+
217+ - name : Download build artifact
218+ uses : actions/download-artifact@v4
219+ with :
220+ name : package
221+ path : .
222+
223+ - name : Check folder contents
224+ run : ls -lah
225+
226+ - name : Install build artifact
227+ run : yarn add ./package.tgz
228+
229+ - name : Erase path aliases
230+ run : sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json ./vitest.config.mts
231+
232+ - name : Run local tests against the build artifact
233+ run : yarn test
0 commit comments