Skip to content

Go CLI: add support for windows, linux, macos - #16082

Merged
JinHai-CN merged 3 commits into
infiniflow:mainfrom
Haruko386:mutex
Jun 18, 2026
Merged

JinHai-CN merged 3 commits into
infiniflow:mainfrom
Haruko386:mutex

Conversation

@Haruko386

Copy link
Copy Markdown
Member

What problem does this PR solve?

As title

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)

@Haruko386 Haruko386 added the ci Continue Integration label Jun 16, 2026
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 16, 2026
@Haruko386
Haruko386 marked this pull request as draft June 16, 2026 08:58
@Haruko386
Haruko386 marked this pull request as ready for review June 16, 2026 08:58
@coderabbitai

coderabbitai Bot commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 777ae058-2403-4282-9872-87e4cd0e7200

📥 Commits

Reviewing files that changed from the base of the PR and between 8776236 and 9894170.

📒 Files selected for processing (1)
  • .github/workflows/release.yml
💤 Files with no reviewable changes (1)
  • .github/workflows/release.yml

📝 Walkthrough

Walkthrough

The release workflow is refactored to introduce a matrix-driven build_cli job that builds the Go CLI across multiple OS/arch targets, and a publish_cli_assets job that aggregates and uploads all artifacts to the GitHub Release. The prepare job's output wiring is updated to expose release_tag and prerelease via a new step. Prior in-place CLI build logic is removed from the release job.

Changes

Release Pipeline Refactor

Layer / File(s) Summary
prepare job output wiring
.github/workflows/release.yml
prepare job gains release_tag and prerelease outputs from a new "Prepare release metadata" step (id: release) that includes Go setup and writes both values into ${GITHUB_OUTPUT}.
build_cli matrix job: cross-platform Go binary builds
.github/workflows/release.yml
New build_cli job runs across an OS/arch target matrix (Linux, macOS, Windows) on different runners, conditionally downloads the office_oxide native library per OS, builds the CGO-enabled ragflow_cli binary with embedded version/commit ldflags and OS-specific linker flags, performs Linux ldd runtime linkage verification, and uploads per-target CLI artifacts.
publish_cli_assets job and release job finalization
.github/workflows/release.yml
publish_cli_assets downloads all CLI artifacts from the matrix job, regenerates release_body.md and SHA256SUMS, and uploads the aggregated CLI binaries and install scripts to GitHub Release using prepare outputs for tag and prerelease metadata. The final release job depends on publish_cli_assets and sets RELEASE_TAG from prepare.outputs.release_tag; the existing uv build && uv publish step for Python packages remains unchanged.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • infiniflow/ragflow#16078: Both PRs modify the GitHub Actions release.yml CLI build steps to handle the office_oxide native dependency (the main PR restructures the CLI build pipeline into build_cli/publish_cli_assets, while the retrieved PR changes the office_oxide build configuration and validation).
  • infiniflow/ragflow#16160: Both PRs modify .github/workflows/release.yml's release-tag and prerelease wiring and the release job's publishing flow, so the main PR builds on the same release-job output/dependency logic.

Poem

🐇 A matrix of targets, each runner in line,
Building Go binaries, static and fine!
ldd checks Linux, no shared lib snuck in,
Windows gets .exe, with .lib for the win.
Artifacts uploaded, the release job's clean —
The freshest of pipelines a rabbit has seen! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete and lacks meaningful context. While it follows the template structure, the 'What problem does this PR solve?' section merely says 'As title' instead of providing substantive explanation or background information required for understanding the change. Replace 'As title' with a detailed explanation of what problem is being solved, why the change is needed, and any relevant background context that will help reviewers understand the purpose.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding platform support (Windows, Linux, macOS) for the Go CLI, which aligns with the primary objective of the changeset.
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.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (1)
.github/workflows/release.yml (1)

374-377: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

latest Docker tag is pushed even for nightly/prerelease builds.

The Docker push always tags as latest regardless of whether this is a stable release or nightly build. For nightly builds, this means users pulling latest get potentially unstable code.

🔧 Proposed fix to push `latest` only for stable releases
      - name: Build and push image
        run: |
          sudo docker login --username infiniflow --password-stdin <<< ${{ secrets.DOCKERHUB_TOKEN }}
          sudo docker build -t infiniflow/ragflow:${RELEASE_TAG} -f Dockerfile .
-         sudo docker tag infiniflow/ragflow:${RELEASE_TAG} infiniflow/ragflow:latest
          sudo docker push infiniflow/ragflow:${RELEASE_TAG}
-         sudo docker push infiniflow/ragflow:latest
+         if [[ "${RELEASE_TAG}" == v* ]]; then
+           sudo docker tag infiniflow/ragflow:${RELEASE_TAG} infiniflow/ragflow:latest
+           sudo docker push infiniflow/ragflow:latest
+         fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 374 - 377, The workflow
unconditionally pushes the `latest` tag regardless of build type, which means
nightly and prerelease builds overwrite the stable latest image. Add conditional
logic before the `sudo docker push infiniflow/ragflow:latest` command to only
execute it for stable releases. Determine if the build is stable by checking the
RELEASE_TAG variable against nightly/prerelease patterns (typically containing
keywords like "nightly", "pre", "alpha", "beta", or "-rc"). Only push the latest
tag when the RELEASE_TAG represents a stable release version.
🧹 Nitpick comments (1)
.github/workflows/release.yml (1)

137-142: 💤 Low value

Consider setting persist-credentials: false for improved security posture.

The checkout action persists credentials by default, which can lead to token leakage through artifacts or caches. Since this job only needs read access and doesn't push changes, disabling credential persistence is safer.

🔒 Proposed fix
      - name: Check out code
        uses: actions/checkout@v6
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          fetch-depth: 0
          fetch-tags: true
+         persist-credentials: false

Apply the same change to the checkout steps in publish_cli_assets (line 310) and release (line 365) jobs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 137 - 142, Add
`persist-credentials: false` to the checkout action configuration in
`.github/workflows/release.yml` to disable credential persistence and improve
security. Apply this change to all three checkout steps: the one at lines
137-142 (main location shown in the diff), the one in the publish_cli_assets job
at line 310, and the one in the release job at line 365. This prevents token
leakage through artifacts or caches since these jobs only require read access
and do not push changes.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release.yml:
- Around line 279-281: The CGO_CFLAGS and CGO_LDFLAGS environment variable
assignments in the Windows build configuration use backslash path separators
which can cause linker failures with Go's CGO toolchain. Replace the backslashes
with forward slashes in both the CGO_CFLAGS variable (which references
`\include\office_oxide_c`) and the CGO_LDFLAGS variable (which references
`\lib\office_oxide.lib`). This ensures the paths are properly formatted for the
linker regardless of the specific Windows toolchain being used.

---

Outside diff comments:
In @.github/workflows/release.yml:
- Around line 374-377: The workflow unconditionally pushes the `latest` tag
regardless of build type, which means nightly and prerelease builds overwrite
the stable latest image. Add conditional logic before the `sudo docker push
infiniflow/ragflow:latest` command to only execute it for stable releases.
Determine if the build is stable by checking the RELEASE_TAG variable against
nightly/prerelease patterns (typically containing keywords like "nightly",
"pre", "alpha", "beta", or "-rc"). Only push the latest tag when the RELEASE_TAG
represents a stable release version.

---

Nitpick comments:
In @.github/workflows/release.yml:
- Around line 137-142: Add `persist-credentials: false` to the checkout action
configuration in `.github/workflows/release.yml` to disable credential
persistence and improve security. Apply this change to all three checkout steps:
the one at lines 137-142 (main location shown in the diff), the one in the
publish_cli_assets job at line 310, and the one in the release job at line 365.
This prevents token leakage through artifacts or caches since these jobs only
require read access and do not push changes.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c6c53f6c-3a2e-4c0b-b2d1-9c5c31f9d33d

📥 Commits

Reviewing files that changed from the base of the PR and between 5bd0ed0 and 10366b0.

📒 Files selected for processing (1)
  • .github/workflows/release.yml

Comment thread .github/workflows/release.yml Resolved
@JinHai-CN JinHai-CN changed the title fix: add support for windows, linux, macos Go CLI: add support for windows, linux, macos Jun 16, 2026
@Haruko386 Haruko386 added the 🐞 bug Something isn't working, pull request that fix bug. label Jun 16, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

386-389: Migrate to PyPI trusted publishing instead of PYPI_API_TOKEN.

This workflow currently stores a long-lived PyPI credential. If trusted publishing is enabled on PyPI for both ragflow-cli and ragflow-sdk, the workflow should add id-token: write permission and publish without --token. This requires configuring trusted publishing on each PyPI package page first.

Current state uses:

  • uv publish --token ${{ secrets.PYPI_API_TOKEN }}
  • No id-token: write permission in the workflow

Target state (once PyPI trusted publishing is configured):

  • Add id-token: write to permissions
  • Remove --token ${{ secrets.PYPI_API_TOKEN }} from publish commands
Suggested workflow changes
 permissions:
   contents: write
+  id-token: write
   actions: read
   checks: read
   statuses: read
@@
       - name: Build and push ragflow-cli
         if: startsWith(github.ref, 'refs/tags/v')
         run: |
-          cd admin/client && uv build && uv publish --token ${{ secrets.PYPI_API_TOKEN }}
+          cd admin/client && uv build && uv publish

Note: Apply the same permission changes and publish command modifications to the ragflow-sdk build job at line 384.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 386 - 389, The workflow currently
uses a long-lived PYPI_API_TOKEN secret for publishing both ragflow-cli and
ragflow-sdk packages. Replace this with PyPI trusted publishing for better
security. Add id-token: write permission to the workflow permissions section at
the top. Then for both the ragflow-cli build job (lines 386-389) and the
ragflow-sdk build job (line 384), modify the uv publish commands by removing the
--token ${{ secrets.PYPI_API_TOKEN }} flag so the commands rely on OIDC-based
authentication instead. This assumes trusted publishing is already configured on
the PyPI package pages for both ragflow-cli and ragflow-sdk.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/release.yml:
- Around line 386-389: The workflow currently uses a long-lived PYPI_API_TOKEN
secret for publishing both ragflow-cli and ragflow-sdk packages. Replace this
with PyPI trusted publishing for better security. Add id-token: write permission
to the workflow permissions section at the top. Then for both the ragflow-cli
build job (lines 386-389) and the ragflow-sdk build job (line 384), modify the
uv publish commands by removing the --token ${{ secrets.PYPI_API_TOKEN }} flag
so the commands rely on OIDC-based authentication instead. This assumes trusted
publishing is already configured on the PyPI package pages for both ragflow-cli
and ragflow-sdk.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f679049f-ae95-48ac-8324-c04d49830db5

📥 Commits

Reviewing files that changed from the base of the PR and between 10366b0 and 8776236.

📒 Files selected for processing (1)
  • .github/workflows/release.yml

@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.16%. Comparing base (fad82fd) to head (8776236).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16082   +/-   ##
=======================================
  Coverage   93.16%   93.16%           
=======================================
  Files          10       10           
  Lines         717      717           
  Branches      118      118           
=======================================
  Hits          668      668           
  Misses         29       29           
  Partials       20       20           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@myf-bee myf-bee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There are no major issues

@JinHai-CN
JinHai-CN merged commit 351b61a into infiniflow:main Jun 18, 2026
1 check failed
@Haruko386
Haruko386 deleted the mutex branch June 18, 2026 07:22
This was referenced Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants