Skip to content

chore: update workflow for 🚧 stage#32

Merged
imbajin merged 6 commits intohugegraph:3.7.1-pd-storefrom
JisoLya:master
Sep 8, 2025
Merged

chore: update workflow for 🚧 stage#32
imbajin merged 6 commits intohugegraph:3.7.1-pd-storefrom
JisoLya:master

Conversation

@JisoLya
Copy link
Copy Markdown
Member

@JisoLya JisoLya commented Sep 5, 2025

Purpose of the PR

update workflow, build struct module before store & pd

Main Changes

Verifying these changes

  • Trivial rework / code cleanup without any test coverage. (No Need)
  • Already covered by existing tests, such as (please modify tests here).
  • Need tests and can be verified as follows:
    • xxx

Does this PR potentially affect the following parts?

Documentation Status

  • Doc - TODO
  • Doc - Done
  • Doc - No Need

Summary by CodeRabbit

  • Chores
    • 新增顶层预构建任务以统一产出并复用构建工件
    • 调整任务依赖,确保下游任务在预构建完成后再执行
    • 启用分阶段仓库以提升依赖获取与发布验证的稳定性
    • 传递并复用版本标识,避免版本不一致导致的失败
    • 增强流水线可靠性:条件化获取/构建工件、改进检出与缓存策略并使用一致的运行环境配置

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Sep 5, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

在 GitHub Actions 工作流中新增顶层作业 struct 用于准备 hugegraph-struct 工件并解析 REVISION;将 pd、store、hstore 作业设为依赖于 struct,并启用 store/hstore 的阶段仓库设置;在获取 hugegraph-struct 时根据是否存在源码选择构建或通过 Maven 拉取;同时调整 hstore 的 checkout 参数。

Changes

Cohort / File(s) Summary
新增 struct 作业与工件获取
\.github/workflows/pd-store-ci.yml
添加 struct 作业:安装 JDK11、缓存 Maven、检出代码、应用阶段 settings、解析并导出 REVISION;若存在 hugegraph-struct/pom.xml 则本地构建,否则使用 mvn dependency:get 拉取工件(需 REVISION)。
作业依赖与阶段仓库开关
\.github/workflows/pd-store-ci.yml
pdstorehstore 增加 needs: struct;将 storehstoreUSE_STAGE 切为 true,使用阶段仓库。
检出与版本传播调整
\.github/workflows/pd-store-ci.yml
struct 中解析项目版本并写入 GitHub 环境供下游使用;调整 hstoreactions/checkout@v3 且设置 fetch-depth: 2

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant GH as GitHub Actions
  participant Struct as Job: struct
  participant PD as Job: pd
  participant Store as Job: store
  participant HStore as Job: hstore
  participant Maven as Maven Repo(s)

  GH->>Struct: 启动 struct (JDK11, cache, checkout, stage settings)
  Struct->>Struct: 解析并设置 REVISION
  alt 有 hugegraph-struct/pom.xml
    Struct->>Maven: 本地构建并安装 hugegraph-struct
  else 无 pom.xml
    Struct->>Maven: mvn dependency:get hugegraph-struct:${REVISION}
  end
  Struct->>GH: 导出 REVISION 到环境

  GH->>PD: 在 struct 完成后启动 (needs)
  GH->>Store: 在 struct 完成后启动 (needs, USE_STAGE=true)
  GH->>HStore: 在 struct 完成后启动 (needs, USE_STAGE=true, checkout@v3 depth=2)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

enhancement, size:L

Suggested reviewers

  • Pengzna

Poem

小兔忙在流水线,先筑 struct 把关前,
版本落位写环境,源码有则自家炼。
pd、store、hstore 排,阶段仓库门已开。
若无依赖来拉取,CI 路更稳更欢快。 🐇

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Sep 5, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 5, 2025

@codecov-ai-reviewer review

@codecov-ai

This comment has been minimized.

@codecov-ai

This comment has been minimized.

@JisoLya
Copy link
Copy Markdown
Member Author

JisoLya commented Sep 5, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Sep 5, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@JisoLya
Copy link
Copy Markdown
Member Author

JisoLya commented Sep 5, 2025

@codecov-ai-reviewer review

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
.github/workflows/pd-store-ci.yml (2)

85-89: cp 可能因原始 settings.xml 不存在而失败,需容错

在 pd/store/hstore 中,cp 未加容错,与 struct 的“|| true”不一致;在全新 runner 上会直接失败。

-  cp $HOME/.m2/settings.xml /tmp/settings.xml
+  cp $HOME/.m2/settings.xml /tmp/settings.xml || true

Also applies to: 149-154, 222-227


116-120: 升级 Codecov Action 至 v4 并使用正确参数

建议将 Codecov 上传步骤改为:

- uses: codecov/[email protected]
- with:
-   file: ${{ env.REPORT_DIR }}/*.xml
+ uses: codecov/codecov-action@v4
+ with:
+   files: ${{ env.REPORT_DIR }}/*.xml
+   fail_ci_if_error: true

请确认已在仓库中设置好上传认证:要么提供 CODECOV_TOKEN(或在 with 中使用 use_oidc: true 并在 workflow/permissions 中开启 id-token: write),以满足 v4 的认证要求。
也请对 188–192 行和 258–262 行同步更新。

🧹 Nitpick comments (3)
.github/workflows/pd-store-ci.yml (3)

217-221: 统一 checkout fetch-depth,避免覆盖率与基线差异计算异常

部分覆盖率/变更基线工具需要完整历史。建议在 PR 上将 fetch-depth 设为 0(或至少保证包含 merge-base)。

-        with:
-          fetch-depth: 2
+        with:
+          fetch-depth: 0

228-236: 可读性/稳定性小优化:Maven 批处理与显式日志参数

建议对所有 mvn 命令添加 -B(batch-mode),并在打包/测试中统一使用 -ntp,减少日志噪音、避免交互提示。

-  mvn clean package -U -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -ntp
+  mvn -B -ntp clean package -U -Dmaven.javadoc.skip=true -Dmaven.test.skip=true

同理于各处 mvn test 命令可加 -B -ntp。

Also applies to: 100-107, 159-163


248-251: 确认 hstore 的 Raft 测试条件是否符合预期

BACKEND 固定为 hstore,条件 if: ${{ env.BACKEND == 'rocksdb' }} 始终为假,Raft 测试永远跳过。若这是预期行为请忽略;若需要 hstore 也覆盖 Raft 测试,请调整条件或 BACKEND。

Also applies to: 200-201

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6bce417 and 52d8439.

📒 Files selected for processing (1)
  • .github/workflows/pd-store-ci.yml (3 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/pd-store-ci.yml

19-19: the runner of "actions/setup-java@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


25-25: the runner of "actions/cache@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Comment on lines +41 to +43
- name: Resolve project revision
run: echo "REVISION=$(mvn -q -DforceStdout help:evaluate -Dexpression=revision -f pom.xml)" >> $GITHUB_ENV

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

提升 REVISION 解析与回退健壮性,防止取到空值或字面占位符

mvn 解析 revision 失败时常返回空或字面“${revision}”。建议加入对 project.version 的回退与占位符检测,失败即退出。

-      - name: Resolve project revision
-        run: echo "REVISION=$(mvn -q -DforceStdout help:evaluate -Dexpression=revision -f pom.xml)" >> $GITHUB_ENV
+      - name: Resolve project revision
+        run: |
+          REVISION="$(mvn -q -DforceStdout help:evaluate -Dexpression=revision -f pom.xml || true)"
+          if [ -z "$REVISION" ] || [[ "$REVISION" == *'$'{*}* ]]; then
+            REVISION="$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version -f pom.xml)"
+          fi
+          if [ -z "$REVISION" ] || [[ "$REVISION" == *'$'{*}* ]]; then
+            echo "[ERROR] failed to resolve project revision"; exit 1
+          fi
+          echo "REVISION=$REVISION" >> "$GITHUB_ENV"
@@
-            mvn -U -ntp dependency:get -Dartifact=org.apache.hugegraph:hugegraph-struct:$REVISION
+            mvn -U -ntp dependency:get -Dartifact=org.apache.hugegraph:hugegraph-struct:$REVISION -Dtransitive=false

Also applies to: 44-53

🤖 Prompt for AI Agents
.github/workflows/pd-store-ci.yml around lines 41-43 (also apply same change to
44-53): the current step captures REVISION from mvn help:evaluate but can yield
empty string or the literal placeholder "${revision}"; update the step to detect
empty or placeholder values, attempt a fallback evaluation using
project.version, and if both evaluations are empty or placeholders exit
non-zero; implement checks that treat values matching /^\s*$/ or /^\$\{.*\}$/ as
invalid, log clear error messages when fallbacks fail, and ensure the job fails
immediately on unresolved revision.

@JisoLya
Copy link
Copy Markdown
Member Author

JisoLya commented Sep 5, 2025

@codecov-ai-reviewer review

@codecov-ai

This comment has been minimized.

@JisoLya
Copy link
Copy Markdown
Member Author

JisoLya commented Sep 5, 2025

@CodeRabbit review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Sep 5, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (6)
.github/workflows/pd-store-ci.yml (6)

217-221: hstore 作业 checkout 仍为 @V3,统一到 @v4

与其它作业保持一致,减少行为差异。

-      - name: Checkout
-        uses: actions/checkout@v3
+      - name: Checkout
+        uses: actions/checkout@v4
         with:
           fetch-depth: 2

36-40: struct 作业的“stage settings”建议受 USE_STAGE 控制,保持语义一致

当前 USE_STAGE='true' 行为正确,但为一致性与可配置性,建议加 if 条件。

-      - name: Use staged maven repo settings
-        run: |
+      - name: Use staged maven repo settings
+        if: ${{ env.USE_STAGE == 'true' }}
+        run: |
           cp $HOME/.m2/settings.xml /tmp/settings.xml || true
           mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml

18-23: 升级 setup-java 到 v4 并改用 Temurin,修复 actionlint 报错与兼容性问题

按 actionlint 提示,v3 过旧。建议同步到 v4,distribution 使用 temurin。

-      - name: Install JDK 11
-        uses: actions/setup-java@v3
+      - name: Install JDK 11
+        uses: actions/setup-java@v4
         with:
           java-version: '11'
-          distribution: 'zulu'
+          distribution: 'temurin'

Also applies to: 66-71, 131-136, 204-209


24-29: actions/cache 升级到 v4;仅缓存仓库目录保持不变

已很好地仅缓存 ~/.m2/repository,继续保持;同时将 v3 → v4 以避免运行时问题。

-      - name: Cache Maven packages
-        uses: actions/cache@v3
+      - name: Cache Maven packages
+        uses: actions/cache@v4
         with:
           path: ~/.m2/repository
           key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
           restore-keys: ${{ runner.os }}-m2

Also applies to: 72-78, 137-143, 210-216


41-43: 增强 REVISION 解析的鲁棒性(占位符/空值回退到 project.version)

避免拿到空或字面 ${revision} 导致后续 dependency:get 失败。

-      - name: Resolve project revision
-        run: echo "REVISION=$(mvn -q -DforceStdout help:evaluate -Dexpression=revision -f pom.xml)" >> $GITHUB_ENV
+      - name: Resolve project revision
+        run: |
+          REVISION="$(mvn -q -DforceStdout help:evaluate -Dexpression=revision -f pom.xml || true)"
+          if [ -z "$REVISION" ] || [[ "$REVISION" == *'$'{*}* ]]; then
+            REVISION="$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version -f pom.xml || true)"
+          fi
+          if [ -z "$REVISION" ] || [[ "$REVISION" == *'$'{*}* ]]; then
+            echo "[ERROR] failed to resolve project revision"; exit 1
+          fi
+          echo "REVISION=$REVISION" >> "$GITHUB_ENV"

44-53: 获取/构建 hugegraph-struct:加严格错误处理并避免传递下载

为减少不必要的传递依赖拉取,建议加 -Dtransitive=false;并使用严格 shell 选项快速失败。

-      - name: Build or fetch hugegraph-struct
-        run: |
+      - name: Build or fetch hugegraph-struct
+        run: |
+          set -euo pipefail
           if [ -f hugegraph-struct/pom.xml ]; then
             echo "[INFO] Found hugegraph-struct source, building from source"
             mvn -U -ntp -DskipTests -pl hugegraph-struct -am install
           else
             echo "[INFO] hugegraph-struct source not found, fetching artifact $REVISION"
             if [ -z "$REVISION" ]; then echo "[ERROR] revision not resolved"; exit 1; fi
-            mvn -U -ntp dependency:get -Dartifact=org.apache.hugegraph:hugegraph-struct:$REVISION
+            mvn -U -ntp dependency:get -Dartifact=org.apache.hugegraph:hugegraph-struct:$REVISION -Dtransitive=false
           fi
🧹 Nitpick comments (2)
.github/workflows/pd-store-ci.yml (2)

116-119: 考虑将 Codecov Action 升级到 v4(注意需要 Token)

v4 带来更好的安全模型,但通常需要 CODECOV_TOKEN。若组织允许,建议升级;否则保持 v3 亦可。

-      - name: Upload coverage to Codecov
-        uses: codecov/[email protected]
+      - name: Upload coverage to Codecov
+        uses: codecov/codecov-action@v4
         with:
           file: ${{ env.REPORT_DIR }}/*.xml
+        env:
+          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Also applies to: 188-191, 258-261


24-29: 确认跨作业 Maven 缓存可命中(同一 key)

struct 首个生成缓存,后续作业应命中相同 key。建议在步骤上加 id 并检查 cache-hit,便于后续诊断。

-      - name: Cache Maven packages
-        uses: actions/cache@v4
+      - name: Cache Maven packages
+        id: m2cache
+        uses: actions/cache@v4
         with:
           path: ~/.m2/repository
           key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
           restore-keys: ${{ runner.os }}-m2
+      - name: Debug cache hit
+        run: echo "m2 cache hit? ${{ steps.m2cache.outputs.cache-hit }}"

Also applies to: 72-78, 137-143, 210-216

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 52d8439 and 7756a0a.

📒 Files selected for processing (1)
  • .github/workflows/pd-store-ci.yml (6 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/pd-store-ci.yml

19-19: the runner of "actions/setup-java@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


25-25: the runner of "actions/cache@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Analyze (java)
  • GitHub Check: build-server (hbase, 11)
  • GitHub Check: struct
🔇 Additional comments (1)
.github/workflows/pd-store-ci.yml (1)

125-126: 启用 store/hstore 的阶段仓库设置与 struct 对齐

该改动与目标一致,有助于构建一致性。

Also applies to: 197-198

Copy link
Copy Markdown
Collaborator

@Pengzna Pengzna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 7, 2025
@imbajin imbajin changed the title update: update workflow chore: update workflow for 🚧 stage Sep 8, 2025
@imbajin imbajin merged commit 832c7e6 into hugegraph:3.7.1-pd-store Sep 8, 2025
4 of 14 checks passed
Tsukilc pushed a commit that referenced this pull request Sep 23, 2025
* update: update workflow

* fix: update workflow

* update: change USE_STAGE param & add maven package param

* update: add todo tag

* Update check-dependencies.yml

---------

Co-authored-by: imbajin <[email protected]>
Tsukilc pushed a commit that referenced this pull request Sep 23, 2025
* update: update workflow

* fix: update workflow

* update: change USE_STAGE param & add maven package param

* update: add todo tag

* Update check-dependencies.yml

---------

Co-authored-by: imbajin <[email protected]>
imbajin added a commit that referenced this pull request Oct 26, 2025
* update: update workflow

* fix: update workflow

* update: change USE_STAGE param & add maven package param

* update: add todo tag

* Update check-dependencies.yml

---------

Co-authored-by: imbajin <[email protected]>
imbajin added a commit that referenced this pull request Oct 29, 2025
* update: update workflow

* fix: update workflow

* update: change USE_STAGE param & add maven package param

* update: add todo tag

* Update check-dependencies.yml

---------

Co-authored-by: imbajin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants