Skip to content

Commit 83f2458

Browse files
authored
Merge pull request #3213 from reduxjs/feature/rtk-apps-ci
2 parents a636751 + 5e2ca82 commit 83f2458

File tree

139 files changed

+43930
-29
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+43930
-29
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: ['cra4', 'cra5', 'next', 'vite']
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

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ es
99

1010
.yalc
1111
yalc.lock
12+
yalc.sig
1213

1314
.idea/
1415
.vscode/
@@ -29,7 +30,3 @@ typesversions
2930
!.yarn/versions
3031
.pnp.*
3132
*.tgz
32-
33-
.yalc
34-
yalc.lock
35-
yalc.sig

examples/publish-ci/cra4/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SKIP_PREFLIGHT_CHECK=true

examples/publish-ci/cra4/.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
25+
typesversions
26+
.cache
27+
.yarnrc
28+
.yarn/*
29+
!.yarn/patches
30+
!.yarn/releases
31+
!.yarn/plugins
32+
!.yarn/sdks
33+
!.yarn/versions
34+
.pnp.*
35+
*.tgz

examples/publish-ci/cra4/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Getting Started with Create React App
2+
3+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app), using the [Redux](https://redux.js.org/) and [Redux Toolkit](https://redux-toolkit.js.org/) TS template.
4+
5+
## Available Scripts
6+
7+
In the project directory, you can run:
8+
9+
### `npm start`
10+
11+
Runs the app in the development mode.\
12+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13+
14+
The page will reload if you make edits.\
15+
You will also see any lint errors in the console.
16+
17+
### `npm test`
18+
19+
Launches the test runner in the interactive watch mode.\
20+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21+
22+
### `npm run build`
23+
24+
Builds the app for production to the `build` folder.\
25+
It correctly bundles React in production mode and optimizes the build for the best performance.
26+
27+
The build is minified and the filenames include the hashes.\
28+
Your app is ready to be deployed!
29+
30+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31+
32+
### `npm run eject`
33+
34+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35+
36+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37+
38+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
39+
40+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
41+
42+
## Learn More
43+
44+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45+
46+
To learn React, check out the [React documentation](https://reactjs.org/).

examples/publish-ci/cra4/package.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"name": "rtk-esm-cra",
3+
"version": "0.1.0",
4+
"private": true,
5+
"dependencies": {
6+
"@reduxjs/toolkit": "^1.9.3",
7+
"msw": "^0.49.2",
8+
"react": "^18.2.0",
9+
"react-dom": "^18.2.0",
10+
"react-redux": "^8.0.5",
11+
"react-scripts": "^4",
12+
"web-vitals": "^2.1.4"
13+
},
14+
"scripts": {
15+
"start": "react-scripts start",
16+
"build": "react-scripts build",
17+
"eject": "react-scripts eject",
18+
"serve-app": "yarn serve -s build",
19+
"test": "yarn playwright test",
20+
"format": "prettier --write \"./src/**/*.{ts,tsx}\" \"**/*.md\""
21+
},
22+
"eslintConfig": {
23+
"extends": [
24+
"react-app",
25+
"react-app/jest"
26+
]
27+
},
28+
"browserslist": {
29+
"production": [
30+
">0.2%",
31+
"not dead",
32+
"not op_mini all"
33+
],
34+
"development": [
35+
"last 1 chrome version",
36+
"last 1 firefox version",
37+
"last 1 safari version"
38+
]
39+
},
40+
"msw": {
41+
"workerDirectory": "public"
42+
},
43+
"devDependencies": {
44+
"@playwright/test": "^1.31.1",
45+
"@testing-library/jest-dom": "^5.16.5",
46+
"@testing-library/react": "^13.4.0",
47+
"@testing-library/user-event": "^14.4.3",
48+
"@types/jest": "^27.5.2",
49+
"@types/node": "^17.0.45",
50+
"@types/react": "^18.0.26",
51+
"@types/react-dom": "^18.0.10",
52+
"playwright": "^1.31.1",
53+
"prettier": "^2.8.4",
54+
"serve": "^14.2.0",
55+
"typescript": "^4.9.4"
56+
}
57+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { defineConfig } from '@playwright/test'
2+
export default defineConfig({
3+
webServer: {
4+
command: 'yarn serve-app',
5+
port: 3000,
6+
timeout: 120 * 1000,
7+
reuseExistingServer: !process.env.CI,
8+
},
9+
timeout: 120 * 1000,
10+
use: {
11+
headless: true,
12+
viewport: { width: 1280, height: 720 },
13+
ignoreHTTPSErrors: true,
14+
},
15+
testDir: 'tests/playwright/',
16+
})
3.5 KB
Binary file not shown.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="Web site created using create-react-app"
11+
/>
12+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13+
<!--
14+
manifest.json provides metadata used when your web app is installed on a
15+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16+
-->
17+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18+
<!--
19+
Notice the use of %PUBLIC_URL% in the tags above.
20+
It will be replaced with the URL of the `public` folder during the build.
21+
Only files inside the `public` folder can be referenced from the HTML.
22+
23+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24+
work correctly both with client-side routing and a non-root public URL.
25+
Learn how to configure a non-root public URL by running `npm run build`.
26+
-->
27+
<title>React Redux App</title>
28+
</head>
29+
<body>
30+
<noscript>You need to enable JavaScript to run this app.</noscript>
31+
<div id="root"></div>
32+
<!--
33+
This HTML file is a template.
34+
If you open it directly in the browser, you will see an empty page.
35+
36+
You can add webfonts, meta tags, or analytics to this file.
37+
The build step will place the bundled scripts into the <body> tag.
38+
39+
To begin the development, run `npm start` or `yarn start`.
40+
To create a production bundle, use `npm run build` or `yarn build`.
41+
-->
42+
</body>
43+
</html>
4.06 KB
Loading
11.8 KB
Loading
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"short_name": "React App",
3+
"name": "Create React App Sample",
4+
"icons": [
5+
{
6+
"src": "favicon.ico",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
},
10+
{
11+
"src": "logo192.png",
12+
"type": "image/png",
13+
"sizes": "192x192"
14+
},
15+
{
16+
"src": "logo512.png",
17+
"type": "image/png",
18+
"sizes": "512x512"
19+
}
20+
],
21+
"start_url": ".",
22+
"display": "standalone",
23+
"theme_color": "#000000",
24+
"background_color": "#ffffff"
25+
}

0 commit comments

Comments
 (0)