Skip to content

Commit aacb6de

Browse files
committed
Test built package artifact in CI
1 parent 50d47cd commit aacb6de

File tree

2 files changed

+49
-2
lines changed

2 files changed

+49
-2
lines changed

.github/workflows/tests.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
filters: |
1919
toolkit:
2020
- 'packages/toolkit/**'
21+
- 'examples/publish-ci/**'
22+
- '.github/workflows/tests.yml'
2123
2224
build:
2325
needs: changes
@@ -127,3 +129,49 @@ jobs:
127129
run: |
128130
yarn tsc --version
129131
yarn type-tests
132+
133+
test-published-artifact:
134+
name: Test Published Artifact ${{ matrix.example }}
135+
136+
needs: [build]
137+
runs-on: ubuntu-latest
138+
strategy:
139+
fail-fast: false
140+
matrix:
141+
node: ['16.x']
142+
example: ['cra5']
143+
defaults:
144+
run:
145+
working-directory: ./examples/publish-ci/${{ matrix.example }}
146+
steps:
147+
- name: Checkout repo
148+
uses: actions/checkout@v2
149+
150+
- name: Use node ${{ matrix.node }}
151+
uses: actions/setup-node@v2
152+
with:
153+
node-version: ${{ matrix.node }}
154+
cache: 'yarn'
155+
156+
- name: Install deps
157+
run: yarn install
158+
159+
- name: Remove existing RTK
160+
run: yarn remove @reduxjs/toolkit
161+
162+
- uses: actions/download-artifact@v2
163+
with:
164+
name: package
165+
path: ./examples/publish-ci/${{ matrix.example }}
166+
167+
- name: Check folder contents
168+
run: ls -l .
169+
170+
- name: Install RTK build artifact
171+
run: yarn add ./package.tgz
172+
173+
- name: Build example
174+
run: yarn build
175+
176+
- name: Run Playwright test
177+
run: yarn test

examples/publish-ci/cra5/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
"scripts": {
1515
"start": "react-scripts start",
1616
"build": "react-scripts build",
17-
"test": "react-scripts test",
1817
"eject": "react-scripts eject",
1918
"serve-app": "yarn serve -s build",
20-
"test-playwright": "yarn playwright test",
19+
"test": "yarn playwright test",
2120
"format": "prettier --write \"./src/**/*.{ts,tsx}\" \"**/*.md\""
2221
},
2322
"eslintConfig": {

0 commit comments

Comments
 (0)