Skip to content

Commit

Permalink
Merge pull request #2 from DTStack/dev
Browse files Browse the repository at this point in the history
v2.x
  • Loading branch information
liuxy0551 authored Jul 11, 2024
2 parents 024783b + f859678 commit 8dfef32
Show file tree
Hide file tree
Showing 197 changed files with 8,500 additions and 4,560 deletions.
36 changes: 36 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
node_modules
.git
.git*
.prettier*
.eslint*
.stylelint*
.dockerignore
test
docker
scripts
LICENSE
README.md
DEPLOY.md
.turbo
.env.*

# 检测结果
**/yice-report/*.html
**/yice-report/**/*.html

# compiled output
dist
node_modules

# OS
.DS_Store

# Tests
/coverage
/.nyc_output

# IDE
.idea
.vscode

yice-performance*.tar.gz
17 changes: 15 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# 修改配置文件需要重启服务

# node 服务信息
APP_PORT=4000
API_PREFIX='api/v1'

# 部分动作由于网络原因,延时再进行下一步操作比较稳妥,毫秒
RESPONSE_SLEEP=5000

# lighthouse 报告的语言
LIGHTHOUSE_LOCALE='zh'

# 仅在本地调试时允许放开下方一行的注释,放开会出现检测浏览器窗口
# USE_HEADLESS=yes

# 数据库信息
DB_HOST='localhost'
DB_HOST='yice-mysql'
DB_PORT=3306
DB_USERNAME='root'
DB_PASSWORD='123456'
Expand All @@ -18,6 +23,11 @@ DB_DATABASE='yice-performance'
# devops 的默认用户名和密码
DEVOPS_USERNAME="[email protected]"
DEVOPS_PASSWORD="123456"
# devops 接口请求时默认的 cookie
DEVOPS_COOKIE=""

# 邮件信息 - 数据周报
EMAIL_PASS=""

# 钉钉告警机器人
ALARM_WEBHOOK=""
Expand All @@ -26,5 +36,8 @@ ALARM_USER_PHONE=""
# 任务超时则取消该任务,分钟
TASK_TIMEOUT=5

# 项目新增版本后,默认 cron:凌晨两点和三点触发
# 项目新增版本后,默认 cron 为每天的凌晨两点和三点
TASK_DEFAULT_CRON='0 0 2-3 * * *'

# 数据周报默认接收邮箱,英文逗号隔开,一般为 TL 和易测 owner
DEFAULT_EMAIL=''
6 changes: 3 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = {
extends: [require.resolve('ko-lint-config/.eslintrc')],
rules: {
camelcase: 0,
'no-useless-escape': 0,
'prettier/prettier': 2,
// camelcase: 0,
// 'no-useless-escape': 0,
// 'prettier/prettier': 2,
'react-hooks/exhaustive-deps': 0,
},
};
64 changes: 29 additions & 35 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,42 @@
name: CI

on:
push:
branches: "*"
pull_request:
branches: ['master']
push:
branches: 'master'
pull_request:
branches: '*'

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
setup:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 14
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 14

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 6.32.20
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 6.35.1

- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run Prettier
run: pnpm prettier
- name: Run Prettier
run: pnpm prettier

- name: Run Eslint
run: pnpm eslint
- name: Run Eslint
run: pnpm eslint

- name: Run Stylelint
run: pnpm stylelint
- name: Run Stylelint
run: pnpm stylelint

- name: Run test
run: pnpm test
- name: Run test
run: pnpm test

- name: Run build
run: pnpm build

- name: Run website build
run: |
cd website
pnpm install --frozen-lockfile
pnpm build
- name: Run build
run: pnpm build
17 changes: 7 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
dist
node_modules

# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# OS
.DS_Store

Expand All @@ -35,6 +26,12 @@ lerna-debug.log*
!.vscode/extensions.json

# 检测结果
static/**/*.html
**/yice-report/*.html
**/yice-report/**/*.html

yice-performance*.tar.gz

.turbo
.env.*

*.log
94 changes: 41 additions & 53 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,55 @@
# https://docs.gitlab.cn/jh/ci/quick_start/

before_script:
- echo $CI_COMMIT_REF_NAME
- whoami
- pnpm i --reporter=silent
- echo $CI_COMMIT_REF_NAME
- whoami
- pnpm i --reporter=silent

stages:
- prettier
- eslint
- stylelint
- test
- build
- website-build
- prettier
- eslint
- stylelint
- test
- build

# 在 master 分支执行;创建 MR 时目标分支为 master 分支则执行
# 创建 MR 时执行;master 分支有 push 时执行
prettier:
stage: prettier
script:
- pnpm prettier;
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME =~ /master/
stage: prettier
script:
- pnpm prettier;
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME =~ /master/

# 在 master 分支执行;创建 MR 时目标分支为 master 分支则执行
# 创建 MR 时执行;master 分支有 push 时执行
eslint:
stage: eslint
script:
- pnpm eslint;
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME =~ /master/
stage: eslint
script:
- pnpm eslint;
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME =~ /master/

# 在 master 分支执行;创建 MR 时目标分支为 master 分支则执行
# 创建 MR 时执行;master 分支有 push 时执行
stylelint:
stage: stylelint
script:
- pnpm stylelint;
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME =~ /master/
stage: stylelint
script:
- pnpm stylelint;
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME =~ /master/

# 在 master 分支执行;创建 MR 时目标分支为 master 分支则执行
# 创建 MR 时执行;master 分支有 push 时执行
test:
stage: test
needs: [prettier, eslint, stylelint]
script:
- pnpm test;
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME =~ /master/

# 在 master 分支执行;创建 MR 时目标分支为 master 分支则执行
stage: test
needs: [prettier, eslint, stylelint]
script:
- pnpm test;
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME =~ /master/

# 创建 MR 时执行;master 分支有 push 时执行
build:
stage: build
needs: [test]
script:
- pnpm build;
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME =~ /master/

# 在 master 分支执行;创建 MR 时目标分支为 master 分支则执行
website-build:
stage: website-build
needs: [test]
script:
- cd website
- pnpm install --frozen-lockfile
- pnpm build
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME =~ /master/
stage: build
needs: [test]
script:
- pnpm build;
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME =~ /master/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Please Checkout And Make Sure Patterns Isn't Exist In .gitignore File First
*.md
dist
*.less
11 changes: 3 additions & 8 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
const prettier = require('ko-lint-config/.prettierrc');

module.exports = {
semi: true, // 行末添加分号
tabWidth: 4, // tab 缩进,默认 2
printWidth: 100, // 换行列数,默认 80
singleQuote: true, // 单引号
useTabs: false, // 使用 tab 缩进,默认 false 使用空格
bracketSpacing: true, // 对象中打印空格 默认 true
arrowParens: 'always', // 箭头函数参数括号 可选 avoid(一个参数时省略) | always
trailingComma: 'es5', // 尾逗号 可选 none | es5 | all
...prettier,
};
56 changes: 1 addition & 55 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,3 @@
module.exports = {
files: ['**/*.css', '**/*.scss'],
customSyntax: require.resolve('postcss-scss'),
extends: 'stylelint-config-standard',
plugins: ['stylelint-order'],
rules: {
// null 为关闭规则
indentation: 4, // 缩进4格
'at-rule-no-unknown': null, // 允许未知规则
'declaration-empty-line-before': 'never', // 第一条属性声明前不允许有空行
'selector-class-pattern': '[a-zA-Z]+', // className 的大小写
// 规则之前的空行
'rule-empty-line-before': [
'always',
{
except: ['inside-block', 'first-nested', 'after-single-line-comment'],
},
],
'alpha-value-notation': 'number', // 小数显示数字(number)或百分数(percentage)
'color-function-notation': 'legacy', // 颜色 rgba 等使用传统逗号隔开
'color-hex-case': 'upper', // 颜色十六进制字符大写
'selector-list-comma-newline-after': 'always-multi-line',
'max-line-length': [
300,
{
ignore: ['non-comments'],
},
],
'font-family-no-missing-generic-family-keyword': null, // 是否必须包含通用字体
'no-descending-specificity': null, // 选择器顺序
'keyframes-name-pattern': null, // keyframes 推荐小写+连字符命名
'no-empty-source': null, // 空文件
'block-no-empty': null, // 空规则
'function-url-quotes': null, // url 不需要引号
'function-no-unknown': null, // 未知方法名
'selector-id-pattern': null, // id 使用连字符和小写字母
'selector-pseudo-class-no-unknown': [
true,
{
ignorePseudoClasses: ['global'],
},
],
'selector-no-vendor-prefix': [
true,
{
ignoreSelectors: ['::-webkit-input-placeholder'],
},
],
'at-rule-name-case': null, // less 中变量名的大小写
'selector-no-vendor-prefix': null, // 兼容写法
'property-no-vendor-prefix': null, // 兼容写法
'selector-pseudo-class-no-unknown': null, // 兼容写法
'selector-type-no-unknown': null, // 兼容写法
'number-max-precision': 10, // 数字中允许的小数位数
'value-no-vendor-prefix': null,
},
extends: ['ko-lint-config/.stylelintrc'],
};
Loading

0 comments on commit 8dfef32

Please sign in to comment.