Skip to content

Commit

Permalink
ci: 部分 Github Action CI 脚本升级
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Nov 23, 2023
1 parent fc5db47 commit 11f5038
Show file tree
Hide file tree
Showing 18 changed files with 565 additions and 53 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,23 @@ jobs:
release:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]') && startsWith(github.event.head_commit.message , 'chore(release):')"
strategy:
matrix:
node-version: [20]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# Python 3.11 和 node-gyp 有兼容问题, 导致无法安装依赖
# https://github.com/slint-ui/slint/commit/a9c48e33502fdebc36c5aa2f4f516c2218424679#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133dd
- uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Use Node.js 16
uses: actions/setup-node@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: 16 # semantic-release 需要 >= 16 的 Node.js 环境
node-version: ${{ matrix.node-version }} # semantic-release 需要 >= 16 的 Node.js 环境
cache: 'yarn'

# 发布开始通知
Expand All @@ -37,7 +40,7 @@ jobs:
{
"msgtype": "link",
"link": {
"title": "🚑 开始自动发布 🚑",
"title": "🚑 开始自动发布 (${{ github.head_ref || github.ref_name }}) 🚑",
"text": "🔗 请点击链接查看详情",
"messageUrl": "https://github.com/antvis/S2/actions/workflows/auto-release.yml",
"picUrl": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*gt5-RZDjt3IAAAAAAAAAAAAADmJ7AQ/original"
Expand Down Expand Up @@ -69,7 +72,7 @@ jobs:
{
"msgtype": "link",
"link": {
"title": "🚨 自动发布失败",
"title": "🚨 自动发布失败 (${{ github.head_ref || github.ref_name }})",
"text": "🔗 请点击链接查看具体原因, 及时修复, 尝试点击右上角 [Re-run all jobs] 重试, 或手动发布 🚑",
"messageUrl": "https://github.com/antvis/S2/actions/workflows/auto-release.yml",
"picUrl": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*PRSkSqsE_vYAAAAAAAAAAAAADmJ7AQ/original"
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ on:
schedule:
- cron: '38 0 * * 2'

concurrency:
group: ${{github.workflow}}-${{github.event_name}}-${{github.ref}}
cancel-in-progress: true

jobs:
analyze:
name: Analyze
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/compressed-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ on:
pull_request:
types: [opened, synchronize]

concurrency:
group: ${{github.workflow}}-${{github.event_name}}-${{github.ref}}
cancel-in-progress: true

jobs:
compressed-size:

runs-on: macos-latest

steps:

- uses: actions/checkout@v3
- uses: actions/checkout@v4

# Python 3.11 和 node-gyp 有兼容问题, 导致无法安装依赖
# https://github.com/slint-ui/slint/commit/a9c48e33502fdebc36c5aa2f4f516c2218424679#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133dd
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/disscustion.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: Discussions
name: 💬 Discussions

on:
discussion:
Expand All @@ -21,6 +21,6 @@ jobs:
"title": "📢 用户: ${{ github.event.discussion.user.login }} 创建了讨论:(${{ github.event.discussion.title }})",
"text": "👀 点击查看",
"messageUrl": "${{ github.event.discussion.html_url }}",
"picUrl": "https://gw.alipayobjects.com/zos/antfincdn/ISzgBCtgR/2c5c4aaa-4f40-46f7-8f6b-427fa9ff07bb.png"
"picUrl": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*1PTTQLk3j5AAAAAAAAAAAAAADmJ7AQ/original"
}
}
22 changes: 22 additions & 0 deletions .github/workflows/issue-labeled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,25 @@ jobs:
你好 @${{ github.event.issue.user.login }},经过我们的反复讨论, 你的需求过于定制化,不适合直接添加到 S2 中, S2 作为开源框架,只会进行通用能力的增强和自定义接口的开放。你可以通过 S2 提供的自定义能力自行实现,感谢你的理解。
Hello, @${{ github.event.issue.user.login }}, After our repeated discussions, your needs are too customized and not suitable for implementing directly to S2. As an open source framework, S2 will only enhance general capabilities and open custom interfaces. You can implement it yourself through the customization capabilities provided by S2, thank you for your understanding.
- name: Supported or fixed in next
if: github.event.label.name == '✨ supported or fixed in next'
uses: actions-cool/issues-helper@main
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
你好 @${{ github.event.issue.user.login }},该功能或缺陷已经在 `2.0 next 版本` 中支持或修复,`next` 版本目前处于内测中, 感谢你的支持与理解。
如有任何 `2.0 版本` 问题,请前往[讨论区](https://github.com/antvis/S2/discussions/1933),正式版预计年底发布 (文档施工中 🚧), 抢先试用:
```bash
yarn add @antv/s2@next
yarn add @antv/s2-react@next
yarn add @antv/s2-vue@next
```
Hello, @${{ github.event.issue.user.login }}, This feature or flaw has been supported or fixed in `2.0 next version`, `next` version is currently in private beta, thank you for your support and understanding.
Any `2.0` version issues, please go to [discussion](https://github.com/antvis/S2/discussions/1933), which released the official version is expected to the end (document 🚧) during construction, the first trial:
11 changes: 5 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ concurrency:
group: ${{github.workflow}}-${{github.event_name}}-${{github.ref}}
cancel-in-progress: true


jobs:
lint:
runs-on: macos-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
node-version: [18]
node-version: [20]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# Python 3.11 和 node-gyp 有兼容问题, 导致无法安装依赖
# https://github.com/slint-ui/slint/commit/a9c48e33502fdebc36c5aa2f4f516c2218424679#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133dd
Expand All @@ -25,7 +24,7 @@ jobs:
python-version: '3.10'

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
Expand All @@ -39,8 +38,8 @@ jobs:
- name: Build
run: yarn build

- name: Bundle size
run: yarn bundle:size
- name: Bundle size limit
run: yarn build:size-limit
env:
CI: true
BUNDLESIZE_GITHUB_TOKEN: ${{ secrets.BUNDLESIZE_GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prerelease-notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
${{ secrets.DING_TALK_ACCESS_TOKEN }}
${{ secrets.DING_TALK_GROUP_TOKEN }}
notify_title: '🎉 {release_tag} 发布 🎉'
notify_body: '## { title } <hr /> ![preview](https://gw.alipayobjects.com/zos/antfincdn/ISzgBCtgR/2c5c4aaa-4f40-46f7-8f6b-427fa9ff07bb.png) <hr /> { body } <hr />'
notify_body: '## { title } <hr /> ![preview](https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*1PTTQLk3j5AAAAAAAAAAAAAADmJ7AQ/original) <hr /> { body } <hr />'
notify_footer: '> 该版本为测试版, 请谨慎使用, 前往 [**AntV/S2 Releases**]({ release_url }) 查看完整更新日志.'
at_all: false
enable_prerelease: true
4 changes: 2 additions & 2 deletions .github/workflows/release-notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
${{ secrets.DING_TALK_ACCESS_TOKEN }}
${{ secrets.DING_TALK_GROUP_TOKEN }}
${{ secrets.DING_TALK_PUBLIC_TOKEN }}
notify_title: '🎉 S2 新版本发布啦 🎉'
notify_body: '## { title } <hr /> ![preview](https://gw.alipayobjects.com/zos/antfincdn/ISzgBCtgR/2c5c4aaa-4f40-46f7-8f6b-427fa9ff07bb.png) <hr /> 看看有哪些更新吧 <hr />'
notify_title: '🎉 AntV/S2 新版本发布啦 🎉'
notify_body: '## { title } <hr /> ![preview](https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*1PTTQLk3j5AAAAAAAAAAAAAADmJ7AQ/original) <hr /> 看看有哪些更新吧 <hr />'
notify_footer: '> 前往 [**AntV/S2 Releases**](https://github.com/antvis/S2/releases/latest) 查看完整更新日志.'
at_all: false
enable_prerelease: false
14 changes: 9 additions & 5 deletions .github/workflows/release-success.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ jobs:
runs-on: ubuntu-latest
# 自动发布成功后
if: github.event.workflow_run.conclusion == 'success'
strategy:
matrix:
node-version: [20]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js 16
uses: actions/setup-node@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: 16
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Git bootstrap
Expand Down Expand Up @@ -59,7 +63,7 @@ jobs:
{
"msgtype": "link",
"link": {
"title": "📢 开始自动部署旧版官网(https://s2.antv.vision) 📢 ",
"title": "📢 开始自动部署旧版官网 (https://s2.antv.vision) 📢 ",
"text": "🔗 请点击链接查看详情",
"messageUrl": "https://github.com/antvis/S2/actions/workflows/release-success.yml",
"picUrl": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*gt5-RZDjt3IAAAAAAAAAAAAADmJ7AQ/original"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/site-build-notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
{
"msgtype": "link",
"link": {
"title": "✅ 旧官网(https://s2.antv.vision) 部署成功",
"text": "点击访问 https://s2.antv.vision/",
"title": "✅ 旧官网 (https://s2.antv.vision) 部署成功",
"text": "点击访问",
"messageUrl": "https://s2.antv.vision/",
"picUrl": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*Eel8Rp5jlAkAAAAAAAAAAAAADmJ7AQ/original"
"picUrl": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*1PTTQLk3j5AAAAAAAAAAAAAADmJ7AQ/original"
}
}
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/size-limit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "size"

on:
pull_request:
types: [opened, synchronize]

permissions:
pull-requests: write

jobs:
size:
runs-on: ubuntu-latest
env:
CI_JOB_NUMBER: 1

steps:
- uses: actions/checkout@v4
- uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/sync-notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
"title": "✅ 同步 changelog 成功",
"text": "📢 请发布值班合并该 PR 后, 访问官网查看是否有异常",
"messageUrl": "https://s2.antv.antgroup.com",
"picUrl": "https://gw.alipayobjects.com/zos/antfincdn/ISzgBCtgR/2c5c4aaa-4f40-46f7-8f6b-427fa9ff07bb.png"
"picUrl": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*1PTTQLk3j5AAAAAAAAAAAAAADmJ7AQ/original"
}
}
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
node-version: [18]
node-version: [20]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# Python 3.11 和 node-gyp 有兼容问题, 导致无法安装依赖
# https://github.com/slint-ui/slint/commit/a9c48e33502fdebc36c5aa2f4f516c2218424679#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133dd
Expand All @@ -27,7 +27,7 @@ jobs:
python-version: '3.10'

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
Expand All @@ -40,9 +40,10 @@ jobs:
yarn test:ci-coverage
- name: Upload test coverage
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true

- name: Workflow failed alert
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
"build": "lerna run build --include-dependencies --stream",
"build:esm": "lerna run build:esm --include-dependencies --stream",
"build:umd": "lerna run build:umd --include-dependencies --stream",
"bundle:size": "lerna run bundle:size --stream",
"size-limit": "lerna run size-limit --stream",
"release": "lerna exec --ignore @antv/s2-shared --concurrency 1 -- npx --no-install semantic-release",
"release:bump-latest":"node ./scripts/latest-bump-version.js",
"release:bump-latest": "node ./scripts/latest-bump-version.js",
"release:preview": "yarn release --dry-run --no-ci",
"prepublish:manual": "yarn build",
"publish:manual": "lerna publish",
Expand Down Expand Up @@ -107,6 +107,9 @@
"@rushstack/eslint-patch": "^1.1.3",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/git": "^10.0.1",
"@size-limit/esbuild": "^11.0.0",
"@size-limit/esbuild-why": "^11.0.0",
"@size-limit/file": "^11.0.0",
"@swc/core": "^1.2.171",
"@swc/jest": "^0.2.20",
"@types/jest": "^27.4.1",
Expand Down Expand Up @@ -165,6 +168,7 @@
"rollup-plugin-visualizer": "^5.6.0",
"semantic-release": "^18.0.1",
"semantic-release-monorepo": "^7.0.5",
"size-limit": "^11.0.0",
"stylelint": "^13.13.1",
"stylelint-config-standard": "^22.0.0",
"ts-jest": "^26.5.6",
Expand Down
9 changes: 5 additions & 4 deletions packages/s2-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
"build:umd": "cross-env FORMAT=umd rollup -c rollup.config.js",
"build:analysis": "cross-env FORMAT=esm ANALYSIS=true rollup -c rollup.config.js",
"build:dts": "run-s dts:*",
"size-limit": "size-limit",
"dts:build": "tsc -p tsconfig.declaration.json",
"dts:extract": "cross-env LIB=s2-core node ../../scripts/dts.js",
"bundle:size": "bundlesize",
"watch": "rimraf esm && yarn build:esm -w",
"test:live": "node ./scripts/test-live.mjs",
"sync-event": "node ./scripts/sync-event.mjs",
Expand Down Expand Up @@ -83,14 +83,15 @@
"*.css",
"dist/*"
],
"bundlesize": [
"size-limit": [
{
"path": "./dist/index.min.js",
"maxSize": "200 kB"
"import": "{ createComponent }",
"limit": "200 kB"
},
{
"path": "./dist/style.min.css",
"maxSize": "5 kB"
"limit": "5 kB"
}
],
"publishConfig": {
Expand Down
9 changes: 5 additions & 4 deletions packages/s2-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
"build:umd": "cross-env FORMAT=umd vite build",
"build:analysis": "cross-env FORMAT=es ANALYSIS=true vite build",
"build:dts": "run-s dts:*",
"size-limit": "size-limit",
"watch": "rimraf esm && yarn build:esm -w",
"dts:build": "tsc -p tsconfig.declaration.json",
"dts:extract": "cross-env LIB=s2-react node ../../scripts/dts.js",
"bundle:size": "bundlesize",
"test": "jest --passWithNoTests",
"test:coverage": "yarn test --coverage",
"test:ci": "yarn test --maxWorkers=3",
Expand Down Expand Up @@ -85,14 +85,15 @@
"react-dom": "^17.0.2",
"vite-plugin-svgr": "^2.1.0"
},
"bundlesize": [
"size-limit": [
{
"path": "./dist/index.min.js",
"maxSize": "650 kB"
"import": "{ createComponent }",
"limit": "70 kB"
},
{
"path": "./dist/style.min.css",
"maxSize": "205 kB"
"limit": "5 kB"
}
],
"publishConfig": {
Expand Down
Loading

0 comments on commit 11f5038

Please sign in to comment.