From 64c5c1e1aa352ece5a4dc589b219a9048c35017b Mon Sep 17 00:00:00 2001 From: lijinke666 Date: Thu, 12 Dec 2024 14:22:13 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=20CI=20Workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/ask-for-question.md | 48 ------ .github/ISSUE_TEMPLATE/bug-report.md | 91 ----------- .github/ISSUE_TEMPLATE/bug-report.yml | 146 ++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 6 + .github/ISSUE_TEMPLATE/feature-request.md | 60 ------- .github/ISSUE_TEMPLATE/feature-request.yml | 47 ++++++ .github/workflows/issue-opend.yml | 14 -- .../workflows/test-s2-react-components.yml | 84 ++++++++++ .github/workflows/test-s2-react.yml | 84 ++++++++++ .github/workflows/{test.yml => test-s2.yml} | 4 +- packages/s2-core/package.json | 4 +- 11 files changed, 371 insertions(+), 217 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/ask-for-question.md delete mode 100644 .github/ISSUE_TEMPLATE/bug-report.md create mode 100644 .github/ISSUE_TEMPLATE/bug-report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml delete mode 100644 .github/ISSUE_TEMPLATE/feature-request.md create mode 100644 .github/ISSUE_TEMPLATE/feature-request.yml create mode 100644 .github/workflows/test-s2-react-components.yml create mode 100644 .github/workflows/test-s2-react.yml rename .github/workflows/{test.yml => test-s2.yml} (97%) diff --git a/.github/ISSUE_TEMPLATE/ask-for-question.md b/.github/ISSUE_TEMPLATE/ask-for-question.md deleted file mode 100644 index 0f42cbc17d..0000000000 --- a/.github/ISSUE_TEMPLATE/ask-for-question.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -name: 🤔 Ask for question -about: Look for some help or ask question -title: '🤔' -labels: ❔question ---- - - - - - - -### 🏷 Version - - - - - -| Package | Version | -| -------------- | ------- | -| @antv/s2 | | -| @antv/s2-react | | -| @antv/s2-vue | | - -### Sheet Type - - - - -- [ ] PivotSheet -- [ ] TableSheet -- [ ] GridAnalysisSheet -- [ ] StrategySheet -- [ ] EditableSheet - -### 🖋 Description - - - - -### 🔗 Reproduce Link - - - - -### 😊 Expected Behavior - -### 😅 Current Behavior diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md deleted file mode 100644 index 916dadda53..0000000000 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -name: 🐛 Bug report -about: Let us know something is wrong. -title: '🐛' ---- - - - - -### 🏷 Version - - - - - - -| Package | Version | -| -------------- | ------- | -| @antv/s2 | | -| @antv/s2-react | | -| @antv/s2-vue | | - -### Sheet Type - - - - -- [ ] PivotSheet -- [ ] TableSheet -- [ ] GridAnalysisSheet -- [ ] StrategySheet -- [ ] EditableSheet - -### 🖋 Description - - - - -### ⌨️ Code Snapshots - - - - - - -### 🔗 Reproduce Link - - - - -### 🤔 Steps to Reproduce - - - - -### 😊 Expected Behavior - - - - -### 😅 Current Behavior - - - - -### 💻 System information - - - - -| Environment | Info | -| ------- | ------- | -| System | | -| Browser | | diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000000..05e12debd7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,146 @@ +name: '🐛 Bug report' +description: Create a report to help us improve, Ask questions in Discussions / 创建一个问题报告以帮助我们改进,提问请到 Discussions +title: '🐛' +body: + - type: markdown + attributes: + value: | + Report errors and exceptions found in S2. + + Before submitting a new bug/issue, please check the links below to see if there is a solution or question posted there already: + + --- + + ### 反馈在 S2 中发现的错误、异常 ([提 Issue 前必读](https://github.com/antvis/S2/issues/1904))。 + + ⚠️ 在提出问题前,请确保你已经仔细阅读👓/搜索🔍过 [官方文档](https://s2.antv.antgroup.com/docs/manual/introduction) 和 [常见问题](https://s2.antv.antgroup.com/docs/manual/faq) 以及 [图表示例](https://s2.antv.antgroup.com/examples/gallery), 并且已经搜索查阅过相关 [Issues 列表](https://github.com/antvis/S2/issues?q=is%3Aissue+is%3Aclosed) 和 [Discussions 列表](https://github.com/antvis/S2/discussions). 当你确定自己的问题没有解决方案时,请提交 issue。 ⚠️ + + 如果是使用问题,不知道怎么用,请移步 [Discussions 讨论区](https://github.com/antvis/S2/discussions) 并提供 [有效信息](https://github.com/antvis/S2/issues/1904) 进行提问。 + + ### 参与社区共建 + + **这是一个开源项目, 我们也有繁忙的业务要做, 是用自己的业余时间在维护, 为爱发电, 精力有限, 所以有时候 issue 响应速度不是那么及时, 如果你遇到了问题, 或者对 [Issues](https://github.com/antvis/S2/issues) 和 [Discussions](https://github.com/antvis/S2/discussions) 列表的问题感兴趣, 可以直接认领并尝试修复 ([贡献指南](https://s2.antv.antgroup.com/manual/contribution)),帮助 S2 变得更好, 而不是一味的埋怨和催促, 我们不是甲方乙方的关系.** + + - type: textarea + id: version + attributes: + label: 🏷 S2 Version / S2 版本 + description: | + 请填写你实际安装到 node_modules 中的具体版本号,请确保你已经尝试过安装最新版本解决问题,并且本地和官网都能复现该问题. + 请不要写 `latest`, `2.x` 这种没有意义的版本号, + placeholder: | + 复制下方的表格, 修改对应版本号即可: + + | Package | Version | + | -------------- | ------- | + | @antv/s2 | 2.0.0 | + | @antv/s2-react | 2.0.0 | + | @antv/s2-react-components | 2.0.0 | + + validations: + required: true + + - type: checkboxes + id: sheet-type + attributes: + label: 💻 Sheet Type / 表格类型 + description: | + 请选择你具体使用的表格,这能帮助我们更快的定位问题 + options: + - label: PivotSheet + - label: TableSheet + - label: GridAnalysisSheet + - label: StrategySheet + - label: EditableSheet + + - type: textarea + id: description + attributes: + label: 🖋 Describe the bug / 问题描述 + description: | + 1. 请填写你具体的问题描述,**请不要惜字如金,尽可能的多提供一些你能想到的有用信息**。 + 2. 请至少懂表格的基本概念,会基本的 JavaScript, 统一用语,不要将 `行头` 说成 `列头`, `列头` 说成 `表头`, 统一用语,可以减少我们的沟通成本。 + + validations: + required: true + + - type: textarea + id: code + attributes: + label: ⌨️ Code Snapshots / 代码片段 + description: | + 1. 请粘贴你的**核心代码片段**,包括但不限于 `报错信息`, `s2Options 配置信息`, `s2DataConfig 数据源信息`。 + 2. 请不要粘贴你自己的业务代码, 更不要无脑粘贴一大段没有格式化的 "乱码"。 + 3. 请不要**直接粘贴官网的在线示例链接, 然后告诉我们有问题, 官网不会保存你编辑后的代码**, 请粘贴 `你的代码片段`, 或者使用 [codesandbox](https://codesandbox.io/) + 4. 请尽量不要粘贴代码的截图,请使用文本. + placeholder: | + If there is a code block, please use Markdown syntax, such as: + 请注意使用 markdown code 标签: + + ```javascript + // Your code here + ``` + validations: + required: true + + - type: input + id: link + attributes: + label: 🔗 Reproduction link / 复现链接 + description: | + 1. 请提供一个精简的可复现链接,它可以让我们更快的帮你复现,定位问题,这很重要,尽量避免 gif, 视频等形式。 + 2. 推荐使用 [codesandbox](https://codesandbox.io/), 我们提供了各种版本的模板,方便你反馈问题。[查看所有模板](https://www.yuque.com/antv/vo4vyz/bam4vz)。 + 3. [官网在线示例](https://s2.antv.vision/zh/examples/gallery) 支持在线编写代码,你可以将代码转成 `codesandbox` 并将对应的链接发给我们,请不要将官网的代码原封不动的复制给我们,请不要 `这么麻烦, 还要复现链接? 赶紧给我修啊, 很急!`, 请不要 `打了一个压缩包给你, 代码都在这, 给我修吧`,更不要 `复现步骤,联系 xxx@qq.com`。 + 4. 请不要 `开局一张图,内容全靠猜`, 我们不是侦探 + validations: + required: false + + - type: textarea + id: steps + attributes: + label: 📋 Steps to Reproduce the Bug or Issue / 重现步骤 + description: | + 1. 请不要惜字如金,粘贴一个张图或者一句话就草草了事,我们需要你详细的复现步骤,这个问题需要怎么样的操作步骤才能复现。 + 2. 不同的问题有不同的复现步骤,只有你最清楚怎么复现这个问题,比如问题需要 **滚动表格到指定位置才能复现, 但是通篇都没有提到, 而你就贴一张图, 什么信息都不给**:所以请 `1. 拖动表格滚动条,滚动到 xx 位置 2. 停留 300ms, 3. tooltip 消失`。 + validations: + required: true + + - type: textarea + id: expected-behavior + attributes: + label: 😊 Expected Behavior / 期望行为 + description: | + 说明这个问题的预期行为,只有你才最了解自己的代码,所以请不要让我们猜,请说明预期,不如 `数据不对,正确应该是:xx`, `布局错误:正确应该是 A 节点在 B 位置`, 如有必要请使用截图工具标注一下, 让问题更醒目。 + validations: + required: true + + - type: textarea + id: current-behavior + attributes: + label: 😅 Current Behavior / 当前行为 + description: | + 说明这个问题当前行为, 如有必要请使用截图工具标注一下, 让问题更醒目。 + validations: + required: false + + - type: checkboxes + id: OS + attributes: + label: 💻 OS / 操作系统 + options: + - label: macOS + - label: Windows + - label: Linux + - label: Others / 其他 + + - type: checkboxes + id: Browser + attributes: + label: 🌏 Browser / 浏览器 + options: + - label: Chrome + - label: Edge + - label: Firefox + - label: Safari (Limited support / 有限支持) + - label: IE (Nonsupport / 不支持) + - label: Others / 其他 diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000..a9145ba2b1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,6 @@ +# Ref: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser +blank_issues_enabled: false +contact_links: + - name: 🤔 Question / 问题咨询 + url: https://github.com/antvis/S2/discussions/new?category=q-a + about: Discuss S2 usage / 讨论 S2 使用问题 diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md deleted file mode 100644 index 518d3e947a..0000000000 --- a/.github/ISSUE_TEMPLATE/feature-request.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -name: 🙏 Feature request -about: Suggest an idea for this project -title: '🙏' -labels: 🙏feature request ---- - - - - -### 🏷 Version - - - - - - -| Package | Version | -| -------------- | ------- | -| @antv/s2 | | -| @antv/s2-react | | -| @antv/s2-vue | | - -### Sheet Type - - - - -- [ ] PivotSheet -- [ ] TableSheet -- [ ] GridAnalysisSheet -- [ ] StrategySheet -- [ ] EditableSheet - -### 🖋 Description - - - - -### 🏞 What problem does this feature solve - - - - -### 🧐 Suggest the API - - - -| name | type | default | description | -| ---- | ---- | ------- | ----------- | -| - | - | - | - | diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 0000000000..c6261211fd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,47 @@ +name: '🙏 Feature request' +description: I have a suggestion (and may want to implement it) / 我有一个建议(或者想参与贡献) +title: '🙏' +labels: ['🙏feature request'] +body: + - type: markdown + attributes: + value: | + 如果你遇到了问题,或者对 [Issues](https://github.com/antvis/S2/issues) 和 [Discussions](https://github.com/antvis/S2/discussions) 列表的问题感兴趣,**可以直接认领并尝试修复**,帮助 S2 变得更好,期待在 [贡献者列表](https://github.com/antvis/S2/graphs/contributors) 里看见你的头像。 + + S2 非常需要你的共建,请阅读 [贡献指南](https://s2.antv.antgroup.com/manual/contribution) 后提交 PR. + + - type: textarea + id: description + attributes: + label: Describe the feature / 功能描述 + placeholder: | + What problem does this feature solve? Where are the existing features not enough? + 这个功能能解决什么问题? 现有功能不满足的点在哪? + + validations: + required: true + + - type: textarea + id: api + attributes: + label: Design the API / API 设计 + placeholder: | + If you need to add an API, how do you want to design it? + 如果需要新增 API, 你希望怎么设计? + + | name | type | default | description | + | ---- | ---- | ------- | ----------- | + | - | - | - | - | + + validations: + required: true + + - type: dropdown + attributes: + label: Are you willing to contribute? / 是否愿意参与贡献? + options: + - Please select / 请选择 + - ✅ Yes / 是 + - ❌ No / 否 + validations: + required: true diff --git a/.github/workflows/issue-opend.yml b/.github/workflows/issue-opend.yml index 4225078b58..09e7f0d91d 100644 --- a/.github/workflows/issue-opend.yml +++ b/.github/workflows/issue-opend.yml @@ -20,20 +20,6 @@ jobs: Hello, @${{ github.event.issue.user.login }}, please edit your issue title. a concise issue title will save everyone time. please do not leave the title as the body or empty. - # 如果 issue 的提交者无视模版, 连基本的版本号,表格类型, 描述都没有, 直接自动关闭, 不多BB. - - name: check issue body - if: contains(github.event.issue.body, 'Version') == false && contains(github.event.issue.body, 'Sheet Type') == false && contains(github.event.issue.body, 'Description') == false - uses: actions-cool/issues-helper@main - with: - actions: 'create-comment,add-labels,close-issue' - token: ${{ secrets.GITHUB_TOKEN }} - issue-number: ${{ github.event.issue.number }} - labels: '⛔ invalid' - body: | - 你好 @${{ github.event.issue.user.login }},请按照 issue 模板填写相关信息, 方便大家高效沟通, 强烈推荐你阅读 [提 Issue 前必读](https://github.com/antvis/S2/issues/1904) 和 [如何向开源项目提交无法解答的问题](https://zhuanlan.zhihu.com/p/25795393)。 - - Hello @${{ github.event.issue.user.login }}, please fill in the relevant information according to the issue template to facilitate communication efficiently. recommend you to read [提 Issue 前必读](https://github.com/antvis/S2/issues/1904) and [如何向开源项目提交无法解答的问题](https://zhuanlan.zhihu.com/p/25795393), Thanks so much! - # 标题或正文 (版本号) 带有 next, 增加标记便于统计 - name: Auto Set Next Label if: contains(github.event.issue.title, 'next') || contains(github.event.issue.body, 'next') diff --git a/.github/workflows/test-s2-react-components.yml b/.github/workflows/test-s2-react-components.yml new file mode 100644 index 0000000000..5c2782ae32 --- /dev/null +++ b/.github/workflows/test-s2-react-components.yml @@ -0,0 +1,84 @@ +name: 💯 test (@antv/s2-react-components) + +on: [pull_request] + +concurrency: + group: ${{github.workflow}}-${{github.event_name}}-${{github.ref}} + cancel-in-progress: true + +jobs: + test: + # jest-electron 需要 macOS 环境, 但是 免费用户 并发有限制, 容易排队 https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners + # runs-on: macos-latest # (目前 macos-latest 对应的是 Big Sur 11, macos-12 对应 Monterey 12) + # macOS 3-core CPU, 其他 2-core CPU + # > macos-14 会导致 CI 的测试卡死, 没有任何报错!!! + runs-on: macos-14 + if: "!contains(github.event.head_commit.message, '[skip ci]')" + strategy: + matrix: + node-version: [20] + + steps: + - 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' + + - uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + + - name: Install dependencies + run: pnpm bootstrap:ci + + - name: Test + run: | + pnpm --filter @antv/s2-react-components test:ci-coverage + + - name: Upload test coverage + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false + verbose: true + + - name: Workflow failed alert + if: ${{ failure() }} + uses: actions-cool/maintain-one-comment@main + with: + token: ${{ secrets.GITHUB_TOKEN }} + body: | + 你好, @${{ github.event.pull_request.user.login }} CI 执行失败, 请点击 [Details] 按钮查看, 并根据日志修复。 + + Hello, @${{ github.event.pull_request.user.login }} CI run failed, please click the [Details] button for detailed log information and fix it. + + emojis: 'eyes' + body-include: '' + + # Github PR 列表 有显示 √ X 的提示, 但是比如一些 APP, 例如 codecov 的 patch 变低, 也会导致 出现 X, 添加label 在列表页快速识别是不是测试自身挂了 + - name: Workflow failed add test failed label + if: ${{ failure() && github.event.pull_request.number != '' }} + uses: actions-cool/issues-helper@main + with: + actions: 'add-labels' + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.pull_request.number }} + labels: '🚨 test failed' + + - name: Remove test failed label + if: ${{ success() && github.event.pull_request.number != '' }} + uses: actions-cool/issues-helper@main + with: + actions: 'remove-labels' + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.pull_request.number }} + labels: '🚨 test failed' diff --git a/.github/workflows/test-s2-react.yml b/.github/workflows/test-s2-react.yml new file mode 100644 index 0000000000..ca60787a30 --- /dev/null +++ b/.github/workflows/test-s2-react.yml @@ -0,0 +1,84 @@ +name: 💯 test (@antv/s2-react) + +on: [pull_request] + +concurrency: + group: ${{github.workflow}}-${{github.event_name}}-${{github.ref}} + cancel-in-progress: true + +jobs: + test: + # jest-electron 需要 macOS 环境, 但是 免费用户 并发有限制, 容易排队 https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners + # runs-on: macos-latest # (目前 macos-latest 对应的是 Big Sur 11, macos-12 对应 Monterey 12) + # macOS 3-core CPU, 其他 2-core CPU + # > macos-14 会导致 CI 的测试卡死, 没有任何报错!!! + runs-on: macos-14 + if: "!contains(github.event.head_commit.message, '[skip ci]')" + strategy: + matrix: + node-version: [20] + + steps: + - 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' + + - uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + + - name: Install dependencies + run: pnpm bootstrap:ci + + - name: Test + run: | + pnpm --filter @antv/s2-react test:ci-coverage + + - name: Upload test coverage + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false + verbose: true + + - name: Workflow failed alert + if: ${{ failure() }} + uses: actions-cool/maintain-one-comment@main + with: + token: ${{ secrets.GITHUB_TOKEN }} + body: | + 你好, @${{ github.event.pull_request.user.login }} CI 执行失败, 请点击 [Details] 按钮查看, 并根据日志修复。 + + Hello, @${{ github.event.pull_request.user.login }} CI run failed, please click the [Details] button for detailed log information and fix it. + + emojis: 'eyes' + body-include: '' + + # Github PR 列表 有显示 √ X 的提示, 但是比如一些 APP, 例如 codecov 的 patch 变低, 也会导致 出现 X, 添加label 在列表页快速识别是不是测试自身挂了 + - name: Workflow failed add test failed label + if: ${{ failure() && github.event.pull_request.number != '' }} + uses: actions-cool/issues-helper@main + with: + actions: 'add-labels' + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.pull_request.number }} + labels: '🚨 test failed' + + - name: Remove test failed label + if: ${{ success() && github.event.pull_request.number != '' }} + uses: actions-cool/issues-helper@main + with: + actions: 'remove-labels' + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.pull_request.number }} + labels: '🚨 test failed' diff --git a/.github/workflows/test.yml b/.github/workflows/test-s2.yml similarity index 97% rename from .github/workflows/test.yml rename to .github/workflows/test-s2.yml index f7ab65d367..7cca75115d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test-s2.yml @@ -1,4 +1,4 @@ -name: 💯 test +name: 💯 test (@antv/s2) on: [pull_request] @@ -42,7 +42,7 @@ jobs: - name: Test run: | - pnpm test:ci-coverage + pnpm --filter @antv/s2 test:ci-coverage - name: Upload test coverage uses: codecov/codecov-action@v3 diff --git a/packages/s2-core/package.json b/packages/s2-core/package.json index 4b7e332502..4cb3a81efd 100644 --- a/packages/s2-core/package.json +++ b/packages/s2-core/package.json @@ -64,8 +64,8 @@ "start": "pnpm test:live", "sync-event": "node ./scripts/sync-event.mjs", "test": "jest --passWithNoTests", - "test:ci": "pnpm test -- --maxWorkers=3", - "test:ci-coverage": "pnpm test:coverage --maxWorkers=3", + "test:ci": "pnpm test", + "test:ci-coverage": "pnpm test:coverage", "test:coverage": "pnpm test -- --coverage", "test:live": "node ./scripts/test-live.mjs", "test:watch": "pnpm test -- --watch",