Skip to content

Commit

Permalink
chore: diff trigger (#4755)
Browse files Browse the repository at this point in the history
* chore: rspack test tools diff demo

* chore: add test diff to pipeline

* chore: add test diff to pipeline

* fix: memory leak

* chore: test-diff to test:diff

* chore: diff trigger

* fix: spell check

* fix: remove output and example diff file

* chore: rspack test tools diff demo

* chore: add test diff to pipeline

* chore: add test diff to pipeline

* fix: memory leak

* chore: test-diff to test:diff

* fix: pnpm lock

* fix: spell check

* fix: remove @types/webpack

* fix: pnpm lock

* fix: typo

* fix: typo

* fix: remove mac matrix

---------

Co-authored-by: LingyuCoder <--global>
  • Loading branch information
LingyuCoder authored Nov 23, 2023
1 parent d3ddbe7 commit 40fd396
Show file tree
Hide file tree
Showing 197 changed files with 12,330 additions and 5 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/diff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Diff assets comment with "!diff"

name: Diff Assets

on:
issue_comment:
types: [created]

jobs:
get-runner-labels:
name: Get Runner Labels
uses: ./.github/workflows/get-runner-labels.yml

build:
name: Build
needs: [get-runner-labels]
if: github.event.issue.pull_request && contains(github.event.comment.body, '!diff')
strategy:
fail-fast: false # Build and test everything so we can look at all the errors
matrix:
array:
- target: x86_64-unknown-linux-gnu # For Cloud IDE
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
uses: ./.github/workflows/reusable-build.yml
with:
ref: refs/pull/${{ github.event.issue.number }}/head
target: ${{ matrix.array.target }}
runner: ${{ matrix.array.runner }}
test: false

diff:
name: Diff Assets
runs-on: ubuntu-latest
needs: build
steps:
- name: Run Diff
run: node scripts/diff.cjs

- name: Write a new comment
uses: peter-evans/create-or-update-comment@v3
continue-on-error: true
with:
issue-number: ${{ github.event.issue.number }}
body-path: 'diff_output'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,5 @@ justfile
/webpack-examples/**/dist

smoke-example
diff_output

2 changes: 2 additions & 0 deletions diffcases/arco-pro/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PORT=3000
EXTEND_ESLINT=true
1 change: 1 addition & 0 deletions diffcases/arco-pro/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
41 changes: 41 additions & 0 deletions diffcases/arco-pro/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel

# typescript
*.tsbuildinfo

dist
/rspack-stats.json
/webpack-stats.json
13 changes: 13 additions & 0 deletions diffcases/arco-pro/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Arco Design Pro

## 快速开始

```
// 初始化项目
npm install
// 开发模式
npm run dev
// 构建
npm run build
12 changes: 12 additions & 0 deletions diffcases/arco-pro/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<div id="root"></div>
</body>
</html>
76 changes: 76 additions & 0 deletions diffcases/arco-pro/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"name": "example-arco-design-pro",
"version": "1.0.0",
"description": "Arco Design Pro",
"private": true,
"scripts": {
"dev": "rspack serve",
"build": "rspack build",
"analyze": "pnpm run build --analyze",
"preview": "cd dist && serve -s",
"bundle-stats": "rspack build --json ./rspack-stats.json"
},
"dependencies": {
"@antv/data-set": "^0.11.8",
"@arco-design/color": "^0.4.0",
"@arco-design/web-react": "2.29.2",
"@arco-themes/react-arco-pro": "^0.0.7",
"@loadable/component": "^5.15.2",
"@turf/turf": "^6.5.0",
"arco-design-pro": "^2.3.0",
"axios": "^0.24.0",
"bizcharts": "^4.1.15",
"classnames": "^2.3.1",
"copy-to-clipboard": "^3.3.1",
"dayjs": "^1.10.7",
"lodash": "^4.17.21",
"mockjs": "^1.1.0",
"nprogress": "^0.2.0",
"query-string": "^6.14.1",
"react": "^17.0.2",
"react-color": "^2.19.3",
"react-dom": "^17.0.2",
"react-redux": "^7.2.6",
"react-router": "^5.2.1",
"react-router-dom": "^5.3.0",
"redux": "^4.1.2",
"regenerator-runtime": "0.13.9"
},
"devDependencies": {
"@rspack/core": "workspace:*",
"@rspack/plugin-html": "workspace:*",
"@rspack/plugin-react-refresh": "workspace:*",
"@svgr/webpack": "^6.5.1",
"@swc/core": "^1.3.14",
"@swc/helpers": "^0.5.3",
"bundle-stats": "^4.1.2",
"css-loader": "^6.8.1",
"html-webpack-plugin": "^5.5.0",
"less": "^4.1.3",
"less-loader": "^11.1.0",
"mini-css-extract-plugin": "^2.6.1",
"postcss-loader": "7.0.2",
"serve": "14.1.2",
"style-loader": "^3.3.3",
"swc-loader": "^0.2.3",
"webpack": "^5.89.0"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"rspack": {}
}
11 changes: 11 additions & 0 deletions diffcases/arco-pro/patches/mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default {
setup() {},
mock() {
return {};
},
XHR: {
prototype: {
withCredentials: true
}
}
};
Binary file added diffcases/arco-pro/public/favicon.ico
Binary file not shown.
128 changes: 128 additions & 0 deletions diffcases/arco-pro/rspack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
const path = require("path");
const rspack = require("@rspack/core");
const ReactRefreshPlugin = require("@rspack/plugin-react-refresh");
const { default: HtmlPlugin } = require("@rspack/plugin-html");

const prod = process.env.NODE_ENV === "production";

/** @type {import('@rspack/cli').Configuration} */
const config = {
mode: 'development',
context: __dirname,
entry: "./src/index.tsx",
target: ["web", "es5"],
devServer: {
port: 5555,
webSocketServer: "sockjs",
historyApiFallback: true
},
module: {
rules: [
{
test: /\.less$/,
use: "less-loader",
type: "css"
},
{
test: /\.module\.less$/,
use: "less-loader",
type: "css/module"
},
{
test: /\.svg$/,
use: "@svgr/webpack"
},
{
test: /\.(j|t)s$/,
exclude: [/[\\/]node_modules[\\/]/],
loader: "builtin:swc-loader",
options: {
sourceMap: false,
jsc: {
parser: {
syntax: "typescript"
},
externalHelpers: true
},
env: {
targets: "Chrome >= 48"
}
}
},
{
test: /\.(j|t)sx$/,
loader: "builtin:swc-loader",
exclude: [/[\\/]node_modules[\\/]/],
options: {
sourceMap: false,
jsc: {
parser: {
syntax: "typescript",
tsx: true
},
transform: {
react: {
runtime: "automatic",
development: !prod,
refresh: !prod
}
},
externalHelpers: true
},
env: {
targets: "Chrome >= 48"
}
}
},
{
test: /\.png$/,
type: "asset"
}
]
},
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
// The default exported mock.js contains a minified [parser](https://github.com/nuysoft/Mock/blob/refactoring/src/mock/regexp/parser.js) with super deep binary
// expression, which causes stack overflow for swc parser in debug mode.
// Alias to the unminified version mitigates this problem.
// See also <https://github.com/search?q=repo%3Aswc-project%2Fswc+parser+stack+overflow&type=issues>
mockjs: require.resolve("./patches/mock.js")
}
},
output: {
publicPath: "/",
filename: "[name].js",
chunkFilename: "[name].js"
},
optimization: {
minimize: false, // Disabling minification because it takes too long on CI
realContentHash: true,
splitChunks: {
cacheGroups: {
someVendor: {
chunks: "all",
minChunks: 2
}
}
}
},
plugins: [
new HtmlPlugin({
title: "Arco Pro App",
template: path.join(__dirname, "index.html"),
favicon: path.join(__dirname, "public", "favicon.ico")
}),
new ReactRefreshPlugin(),
new rspack.ProgressPlugin()
],
infrastructureLogging: {
debug: false
},
experiments: {
rspackFuture: {
disableTransformByDefault: true
}
}
};
module.exports = config;
1 change: 1 addition & 0 deletions diffcases/arco-pro/src/assets/dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions diffcases/arco-pro/src/assets/light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 40fd396

Please sign in to comment.