From 7eef540c6acad041193b0b14b3b2a70c618e4aa3 Mon Sep 17 00:00:00 2001 From: Liu Date: Wed, 27 Jul 2022 19:02:18 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=9B=B4=E6=96=B0=E6=B5=81=E6=B0=B4?= =?UTF-8?q?=E7=BA=BF=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .workflow/keepfast.yml | 43 -------------------------- .workflow/test.yml | 41 +++++++++++++++++++++++++ README.md | 69 ++++++++++++++++++++++-------------------- 3 files changed, 78 insertions(+), 75 deletions(-) delete mode 100644 .workflow/keepfast.yml create mode 100644 .workflow/test.yml diff --git a/.workflow/keepfast.yml b/.workflow/keepfast.yml deleted file mode 100644 index 7820bd8..0000000 --- a/.workflow/keepfast.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: keepfast -displayName: keepfast -triggers: - push: - branches: - - master - - develop -steps: - - step: npmbuild@1 - name: npm-build - displayName: npm-build - inputs: - nodeVersion: 12.7 - goals: >- - npm config set registry https://registry.npm.taobao.org - - export GITEE_API_ACCESS_TOKEN=$KEEPFAST_API_TOKEN - - export SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ - - export COVERALLS_REPO_TOKEN=hGE6GYsEDQe0M4UhlFMPlucmFS7Pgniiw - - export COVERALLS_SERVICE_NAME=GiteeGo - - export COVERALLS_GIT_BRANCH=master - - npm install - - npm link - - keepfast upload --use-message "正在准备环境..." - - npm install -g mocha lighthouse - - yum install -y epel-release - - yum install -y chromium - - keepfast upload --use-message "测试中..." - - npm test - - npm run coverage diff --git a/.workflow/test.yml b/.workflow/test.yml new file mode 100644 index 0000000..45b5837 --- /dev/null +++ b/.workflow/test.yml @@ -0,0 +1,41 @@ +version: '1.0' +name: test +displayName: 测试 +triggers: + trigger: auto + pr: + branches: + include: + - master +variables: + global: + - KEEPFAST_API_TOKEN + - COVERALLS_SERVICE_NAME + - COVERALLS_GIT_BRANCH + - COVERALLS_REPO_TOKEN +stages: + - name: keepfast + displayName: 测试 + strategy: naturally + trigger: auto + steps: + - step: build@nodejs + name: test + displayName: test + nodeVersion: 14.16.0 + commands: + - set -e + - export GITEE_API_ACCESS_TOKEN=$KEEPFAST_API_TOKEN + - npm install -g lighthouse @gitee/keepfast + - npm install + - npm link + - keepfast upload --branch $GITEE_SOURCE_BRANCH --use-message "正在准备环境..." + - npm install -g mocha lighthouse + - yum install -y epel-release chromium procps + - keepfast upload --branch $GITEE_SOURCE_BRANCH --use-message "测试中..." + - npm test + - npm run coverage + - keepfast upload --branch $GITEE_SOURCE_BRANCH --use-message "已测试" + caches: + - ~/.npm + - /var/cache/yum diff --git a/README.md b/README.md index d548c9f..75818a2 100644 --- a/README.md +++ b/README.md @@ -75,41 +75,46 @@ Gitee Go 是 Gitee 推出的 CI/CD(持续构建与集成)服务,用户可以 在你的仓库的 master 分支上新建流水线文件,使用如下配置: ```yml +version: '1.0' name: keepfast -displayName: keepfast +displayName: 前端构建性能分析 triggers: - push: + trigger: auto + pr: branches: - - master - - develop -steps: - - step: npmbuild@1 - name: npm-build - displayName: npm-build - inputs: - nodeVersion: 12.7 - goals: >- - yum clean all - - yum install -y epel-release - - yum -y update - - yum install -y chromium - - npm config set registry https://registry.npm.taobao.org - - export GITEE_API_ACCESS_TOKEN=$KEEPFAST_API_TOKEN - - export SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ - - npm install - - npm install -g lighthouse @gitee/keepfast - - keepfast report ./report.json - - keepfast upload ./report.json + include: + - master +variables: + global: + - KEEPFAST_API_TOKEN +stages: + - name: keepfast + displayName: 前端构建性能分析 + strategy: naturally + trigger: auto + steps: + - step: build@nodejs + name: keepfast + displayName: keepfast + nodeVersion: 14.16.0 + commands: + - set -e + - export GITEE_API_ACCESS_TOKEN=$KEEPFAST_API_TOKEN + - npm install -g yarn lighthouse @gitee/keepfast + - keepfast upload --branch $GITEE_SOURCE_BRANCH --use-message "已开始分析,请稍后..." + - yum install -y epel-release procps chromium + - yum groupinstall -y "Development Tools" + - npm install + - keepfast report --branch $GITEE_SOURCE_BRANCH ./report.json + - keepfast upload --branch $GITEE_SOURCE_BRANCH ./report.json + artifacts: + - name: BUILD_ARTIFACT + path: + - ./report.json + caches: + - ~/.npm + - ~/.yarn + - /var/cache/yum ``` 然后在仓库的环境变量管理页面中设置 `KEEPFAST_API_TOKEN` 环境变量的值为你的访问令牌。 -- Gitee