Skip to content

refactor: parallelize push release workflow#313

Merged
ModerRAS merged 1 commit intomasterfrom
refactor/parallel-push-release
Apr 24, 2026
Merged

refactor: parallelize push release workflow#313
ModerRAS merged 1 commit intomasterfrom
refactor/parallel-push-release

Conversation

@ModerRAS
Copy link
Copy Markdown
Owner

@ModerRAS ModerRAS commented Apr 24, 2026

Summary

  • split the master release pipeline into parallel jobs for validation, telegram-bot-api, Moder.Update updater, standalone packaging, and optional legacy bridge packaging
  • keep the final Backblaze B2 and GitHub Release publishing in a single upload job after the build jobs complete
  • document that the release workflow now parallelizes the build stages before the final upload

Summary by CodeRabbit

  • Chores

    • Restructured build pipeline for improved parallelization and efficiency in release processes.
  • Documentation

    • Updated build and test guide to reflect changes to the continuous integration workflow.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

📝 Walkthrough

Walkthrough

The CI/CD workflow is restructured from sequential execution to parallel build jobs with centralized orchestration. A new prepare job computes release metadata and publishes decision, while multiple independent jobs build artifacts (Telegram bot API, Moder.Update updater, main package, legacy bridge) that are collected and published by a final publish-release job.

Changes

Cohort / File(s) Summary
Workflow Restructuring
.github/workflows/push.yml
Complete overhaul from sequential pipeline to parallelized job architecture. New prepare job extracts metadata computation (version, tag, bridge flag). Build jobs now run independently and upload artifacts. Final publish-release job consolidates artifacts and performs B2/GitHub publishing. B2 pruning updated to use precomputed package paths.
CI/CD Documentation
Docs/Build_and_Test_Guide.md
Updated continuous integration section to document new parallel job structure and deferred publishing pattern.

Sequence Diagram(s)

sequenceDiagram
    participant Push as Push Event
    participant Prepare as prepare job
    participant Build as Parallel Build<br/>(telegram, moder,<br/>main, bridge)
    participant Artifacts as Artifact<br/>Storage
    participant Publish as publish-release<br/>job
    participant B2 as B2 Storage
    participant GH as GitHub<br/>Releases

    Push->>Prepare: Trigger workflow
    Prepare->>Prepare: Compute build-version<br/>release-tag, publish-bridge
    Prepare->>Build: Output metadata
    Build->>Build: Build all packages<br/>in parallel
    Build->>Artifacts: Upload artifacts
    Publish->>Artifacts: Download artifacts
    Publish->>Publish: Consolidate packages<br/>Copy telegram binary
    Publish->>B2: Sync update-feed<br/>& full-release
    Publish->>B2: Conditionally sync<br/>legacy bridge
    Publish->>GH: Create GitHub Release
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🐰 Hop! Hop! The builds run free,
In parallel streams of victory!
No more waiting for the queue,
Just metadata and artifacts too. 🚀
B2 and GitHub in sync at last,
The publish-release saves the day!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor: parallelize push release workflow' directly and clearly summarizes the main change: restructuring the push release workflow to use parallel jobs instead of sequential stages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/parallel-push-release

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.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 PR检查报告

📋 检查概览

🧪 测试结果

平台 状态 详情
Ubuntu 🟢 成功 测试通过,产物已上传
Windows 🟢 成功 测试通过,产物已上传

📊 代码质量

  • ✅ 代码格式化检查
  • ✅ 安全漏洞扫描
  • ✅ 依赖包分析
  • ✅ 代码覆盖率收集

📁 测试产物

  • 测试结果 artifacts 数量: 2
  • 代码覆盖率已上传到Codecov

🔗 相关链接


此报告由GitHub Actions自动生成

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: 3

🧹 Nitpick comments (1)
.github/workflows/push.yml (1)

41-58: Bridge presence check fails open — transient B2 errors trigger a full bridge rebuild.

If b2 account authorize or b2 ls fails for any reason (rate limit, credential hiccup, temporary outage), $existingMarker ends up empty and publish-bridge=true, so the legacy ClickOnce bridge is re‑built and re‑synced unnecessarily. Consider:

  1. Checking $LASTEXITCODE after b2 account authorize / b2 ls and failing the job (so the workflow retries cleanly), rather than silently treating errors as "marker missing".
  2. Pinning the b2 package (pip install b2==x.y.z) so a future major-version release (e.g. command renames or removed flags) doesn't break this step without warning. Same applies to line 436.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/push.yml around lines 41 - 58, The step with id
"bridge-check" treats any failure from the b2 client as a missing marker because
it never checks command exit status; update the PowerShell block to check
$LASTEXITCODE immediately after running "b2 account authorize" and after "b2 ls"
(the invocation that sets $existingMarker) and exit the step with a non‑zero
code (fail the job) if either command failed, instead of writing
publish-bridge=true; also pin the pip install to a specific known safe version
(replace "pip install ... b2" with "pip install ... b2==<x.y.z>" in this step
and the similar install at line ~436) so future b2 releases don’t silently break
the workflow.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/push.yml:
- Around line 327-329: Replace usages of the actions/setup-python@v4 action with
actions/setup-python@v5 wherever it's referenced in the workflow (notably the
step that sets python-version: '3.9' and the analogous step in the prepare job);
update both occurrences so the workflow uses actions/setup-python@v5 to avoid
the old runner/runtime issues flagged by actionlint and keep the python-version
input unchanged.
- Around line 10-18: Add a workflow-level concurrency block to serialize
overlapping releases so concurrent runs can't delete or race each other's B2
packages or release tags; in the push.yml top-level (near the existing env and
permissions) add a concurrency: group using a stable key that includes the ref
and a release identifier (e.g., "publish-release-${{ github.ref }}" or similar)
and set cancel-in-progress: false (or true based on desired behavior) so runs
for the same branch are executed/queued serially; ensure the block applies to
the publish-release job scope by keeping it at the workflow root so all jobs,
including publish-release and Prune-B2PackageVersions, are protected.
- Around line 48-58: Replace the deprecated top-level B2 CLI command `b2
clear-account` with the v4 nested form `b2 account clear` in the workflow:
update the deauthentication call (currently `b2 clear-account`) to `b2 account
clear` where it appears after the `b2 account authorize`/`b2 ls` block
(reference variables: $markerPath, $existingMarker) and make the identical
change in the `publish-release` job where the same old command is used.

---

Nitpick comments:
In @.github/workflows/push.yml:
- Around line 41-58: The step with id "bridge-check" treats any failure from the
b2 client as a missing marker because it never checks command exit status;
update the PowerShell block to check $LASTEXITCODE immediately after running "b2
account authorize" and after "b2 ls" (the invocation that sets $existingMarker)
and exit the step with a non‑zero code (fail the job) if either command failed,
instead of writing publish-bridge=true; also pin the pip install to a specific
known safe version (replace "pip install ... b2" with "pip install ...
b2==<x.y.z>" in this step and the similar install at line ~436) so future b2
releases don’t silently break the workflow.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 718b9588-bbe8-4452-8d92-d7bdad0cc527

📥 Commits

Reviewing files that changed from the base of the PR and between 5dba615 and 0fc79c7.

📒 Files selected for processing (2)
  • .github/workflows/push.yml
  • Docs/Build_and_Test_Guide.md

Comment on lines 10 to +18
permissions:
contents: write

jobs:
env:
LEGACY_BRIDGE_VERSION: '2026.04.23.553'
LEGACY_BRIDGE_MARKER: 'legacy-clickonce-bridge-version.txt'
MODER_UPDATE_COMMIT: 'd547c9905d0cb706aa163e418ab5ef424a14dc9c'

BuildClickOnce:
jobs:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add a concurrency group to serialize overlapping releases.

Two quick pushes to master will trigger two full workflow runs in parallel. In publish-release, Prune-B2PackageVersions deletes every version of every B2 package file whose fileName is not in the current run's KeepRelativePaths. If run A and run B execute concurrently with different package sets, each run will happily delete the other's freshly uploaded packages, plus they can race on b2 sync and on publishing the same/adjacent GitHub Release tags. A workflow-level concurrency block is the simplest guard.

🛡️ Proposed fix
 permissions:
   contents: write

+concurrency:
+  group: push-release-${{ github.ref }}
+  cancel-in-progress: false
+
 env:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/push.yml around lines 10 - 18, Add a workflow-level
concurrency block to serialize overlapping releases so concurrent runs can't
delete or race each other's B2 packages or release tags; in the push.yml
top-level (near the existing env and permissions) add a concurrency: group using
a stable key that includes the ref and a release identifier (e.g.,
"publish-release-${{ github.ref }}" or similar) and set cancel-in-progress:
false (or true based on desired behavior) so runs for the same branch are
executed/queued serially; ensure the block applies to the publish-release job
scope by keeping it at the workflow root so all jobs, including publish-release
and Prune-B2PackageVersions, are protected.

Comment on lines +48 to +58
run: |
pip install --quiet --cache-dir C:\pip-cache b2
b2 account authorize $env:B2_APPKEY_ID $env:B2_APPKEY --quiet
$markerPath = "TelegramSearchBot/$env:LEGACY_BRIDGE_MARKER"
$existingMarker = b2 ls --recursive "b2://$env:B2_BUCKET/$markerPath"
if ([string]::IsNullOrWhiteSpace($existingMarker)) {
"publish-bridge=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
} else {
"publish-bridge=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
}
b2 clear-account
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

b2 CLI v4 clear-account vs account clear command

💡 Result:

In Backblaze B2 CLI v4 (as of v4.0.2), the preferred command to clear the local authentication cache is b2 account clear. The legacy standalone command b2 clear-account from earlier versions (e.g., v3 and v2) is deprecated. Both commands erase the local cache (SQLite database or ~/.b2_account_info) used for storing account authorization tokens and related data, effectively logging out the CLI session. Use b2 account clear for new scripts and compatibility with the latest interface.

Citations:


🏁 Script executed:

cd .github/workflows && cat -n push.yml | sed -n '435,461p'

Repository: ModerRAS/TelegramSearchBot

Length of output: 1829


Replace deprecated b2 clear-account with b2 account clear (v4 CLI syntax).

Line 58 uses the legacy command b2 clear-account from B2 CLI v2/v3, while line 50 uses the v4 nested form b2 account authorize. Since pip install b2 resolves to v4, use the consistent nested syntax b2 account clear for deauthentication. The same inconsistency exists at line 459 in the publish-release job.

♻️ Proposed fix
-        b2 clear-account
+        b2 account clear

Apply the same change at line 459.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
run: |
pip install --quiet --cache-dir C:\pip-cache b2
b2 account authorize $env:B2_APPKEY_ID $env:B2_APPKEY --quiet
$markerPath = "TelegramSearchBot/$env:LEGACY_BRIDGE_MARKER"
$existingMarker = b2 ls --recursive "b2://$env:B2_BUCKET/$markerPath"
if ([string]::IsNullOrWhiteSpace($existingMarker)) {
"publish-bridge=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
} else {
"publish-bridge=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
}
b2 clear-account
run: |
pip install --quiet --cache-dir C:\pip-cache b2
b2 account authorize $env:B2_APPKEY_ID $env:B2_APPKEY --quiet
$markerPath = "TelegramSearchBot/$env:LEGACY_BRIDGE_MARKER"
$existingMarker = b2 ls --recursive "b2://$env:B2_BUCKET/$markerPath"
if ([string]::IsNullOrWhiteSpace($existingMarker)) {
"publish-bridge=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
} else {
"publish-bridge=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
}
b2 account clear
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/push.yml around lines 48 - 58, Replace the deprecated
top-level B2 CLI command `b2 clear-account` with the v4 nested form `b2 account
clear` in the workflow: update the deauthentication call (currently `b2
clear-account`) to `b2 account clear` where it appears after the `b2 account
authorize`/`b2 ls` block (reference variables: $markerPath, $existingMarker) and
make the identical change in the `publish-release` job where the same old
command is used.

Comment on lines +327 to +329
- uses: actions/setup-python@v4
with:
python-version: '3.9'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Upgrade actions/setup-python to v5 (actionlint warns v4 runner is too old).

The GHA runner no longer supports the Node runtime bundled with actions/setup-python@v4, so this step will eventually fail on hosted runners. Same applies to line 28 in the prepare job.

🛠️ Proposed fix
-    - uses: actions/setup-python@v4
+    - uses: actions/setup-python@v5
       with:
         python-version: '3.9'

Apply at both lines 28 and 327.

Based on actionlint hint: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- uses: actions/setup-python@v5
with:
python-version: '3.9'
🧰 Tools
🪛 actionlint (1.7.12)

[error] 327-327: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/push.yml around lines 327 - 329, Replace usages of the
actions/setup-python@v4 action with actions/setup-python@v5 wherever it's
referenced in the workflow (notably the step that sets python-version: '3.9' and
the analogous step in the prepare job); update both occurrences so the workflow
uses actions/setup-python@v5 to avoid the old runner/runtime issues flagged by
actionlint and keep the python-version input unchanged.

@ModerRAS ModerRAS merged commit da4b8c8 into master Apr 24, 2026
12 checks passed
@ModerRAS ModerRAS deleted the refactor/parallel-push-release branch April 24, 2026 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant