Skip to content

ci: add conda build and release workflows#3

Merged
Luohaothu merged 13 commits intomasterfrom
codex/amgcl-conda-workflow-release
Feb 15, 2026
Merged

ci: add conda build and release workflows#3
Luohaothu merged 13 commits intomasterfrom
codex/amgcl-conda-workflow-release

Conversation

@Luohaothu
Copy link
Collaborator

@Luohaothu Luohaothu commented Feb 15, 2026

Summary

  • Add Conda CI workflow to build and test recipe on master PR and push.
  • Add Conda release workflow to build, test, and upload packages on published GitHub Releases.
  • Use recipe build.sh explicitly to configure, build, and install headers/CMake artifacts into the conda prefix.

Validation

  • bash -n conda/recipe/build.sh
  • Local YAML parse check: python - <<'PY' with yaml.safe_load for both workflow files.

Notes

  • Release upload requires secret ANACONDA_API_TOKEN.
  • Optional secret ANACONDA_ORG can override target Anaconda organization (defaults to OpflowDev).

Summary by CodeRabbit

  • Chores
    • Implemented automated Conda package building and testing on pull requests and commits to master branch.
    • Implemented automated Conda package release workflow that builds and publishes packages to Anaconda upon new release events across multiple platforms.

@gemini-code-assist
Copy link

Summary of Changes

Hello @Luohaothu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the project's continuous integration and deployment capabilities for Conda packages. It introduces automated workflows for building and testing Conda recipes on every code change, and establishes a streamlined process for releasing packages upon new version publication. These changes improve reliability and efficiency in package distribution.

Highlights

  • CI Workflow for Conda: Added a CI workflow to build and test the conda recipe on pull requests and pushes to the master branch for Linux and macOS.
  • Conda Release Workflow: Implemented a release workflow to build, test, and upload conda packages automatically when a new release is published.
  • Conda Recipe Update: Modified the conda recipe to explicitly use build.sh for the install-oriented CMake build flow, ensuring consistent build behavior.
Changelog
  • conda/recipe/build.sh
    • Removed the 'x' option from 'set -euxo pipefail', disabling command tracing.
    • Introduced a BUILD_DIR variable and created the directory for isolated builds.
    • Removed the explicit 'export GIT_DESCRIBE_TAG' as it's not strictly necessary for the script's execution.
    • Updated CMake commands to use "$SRC_DIR" and the newly defined "$BUILD_DIR" for source and build directories, respectively.
  • conda/recipe/meta.yaml
    • Added 'script: build.sh' to the 'build' section, explicitly instructing conda to use the custom build script.
Ignored Files
  • Ignored by pattern: .github/workflows/** (2)
    • .github/workflows/conda-ci.yml
    • .github/workflows/conda-release.yml
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Feb 15, 2026

Warning

Rate limit exceeded

@Luohaothu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 4 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

Two GitHub Actions workflows are introduced to automate Conda package building and distribution. The CI workflow triggers on pull requests and pushes to master, building and testing packages on Ubuntu and macOS. The release workflow triggers on published releases, performing similar build and test steps, then uploading the final package to Anaconda Cloud.

Changes

Cohort / File(s) Summary
Conda CI/Release Workflows
.github/workflows/conda-ci.yml, .github/workflows/conda-release.yml
Adds two GitHub Actions workflows for conda package management. CI workflow builds and tests on pull requests and pushes to master across Ubuntu and macOS. Release workflow builds, tests, and uploads packages to Anaconda Cloud on published releases. Both resolve git tags and use Miniconda with mamba for package building from conda/recipe.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub as GitHub Actions
    participant Miniconda as Miniconda Setup
    participant Git as Git Tags
    participant CondaBuild as Conda Build
    participant Testing as Package Tests
    
    GitHub->>Miniconda: Set up Miniconda + Mamba
    Miniconda->>Miniconda: Install conda-build & anaconda-client
    Miniconda-->>GitHub: Ready
    GitHub->>Git: Resolve latest git tag
    Git-->>GitHub: Tag resolved
    GitHub->>CondaBuild: Build package from conda/recipe
    CondaBuild-->>GitHub: Package built
    GitHub->>Testing: Test built package
    Testing-->>GitHub: Tests passed
Loading
sequenceDiagram
    participant Release as Release Event
    participant GitHub as GitHub Actions
    participant Miniconda as Miniconda Setup
    participant CondaBuild as Conda Build
    participant Testing as Package Tests
    participant Anaconda as Anaconda Cloud
    
    Release->>GitHub: Trigger on publish
    GitHub->>Miniconda: Set up Miniconda + Mamba
    Miniconda->>Miniconda: Install conda-build & anaconda-client
    Miniconda-->>GitHub: Ready
    GitHub->>CondaBuild: Build package from conda/recipe
    CondaBuild-->>GitHub: Package built
    GitHub->>Testing: Test built package
    Testing-->>GitHub: Tests passed
    GitHub->>Anaconda: Upload package using token
    Anaconda-->>GitHub: Upload complete
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • Add conda recipe for amgcl headers #2: Modifies conda/recipe/meta.yaml and build.sh with strict GIT_DESCRIBE_TAG handling; directly related as this PR's workflows build packages using those recipe files.

Poem

🐰 Hop hop! CI workflows hop along,
Testing conda builds all day long,
From tag to package, smooth and clean,
The best CI flows you've ever seen!
📦✨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding two new GitHub Actions workflows (conda-ci.yml and conda-release.yml) for Conda package building and releasing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into master

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/amgcl-conda-workflow-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.

@Luohaothu
Copy link
Collaborator Author

已查看评审信息:当前仅有 Gemini Code Assist 的自动化摘要,未发现需要修正的人工评审意见。我已按需求补齐 PR/CI/Release 流程与上传 secret 说明。

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces Conda build infrastructure by adding a build script and updating the Conda recipe. The changes are a good step towards packaging the project with Conda. My review focuses on improving the robustness and maintainability of the build script to align with Conda best practices, ensuring it works reliably both within the conda-build environment and for local testing.

Comment on lines 13 to 18
cmake -S "$SRC_DIR" \
-B "$BUILD_DIR" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
-DAMGCL_BUILD_TESTS=OFF \
-DAMGCL_BUILD_EXAMPLES=OFF

Choose a reason for hiding this comment

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

high

This cmake command can be improved for robustness and adherence to conda-build best practices:

  1. Use CMAKE_ARGS: It's recommended to include ${CMAKE_ARGS} in your cmake call. conda-build populates this variable with essential arguments, such as toolchain configurations and the installation prefix (-DCMAKE_INSTALL_PREFIX=$PREFIX). This ensures your build is portable and correctly configured within the conda environment.
  2. Local build support: When running this script locally, $SRC_DIR will be unset. cmake -S "$SRC_DIR" would result in cmake -S "", which is likely not what you intend. Using "${SRC_DIR:-.}" provides a fallback to the current directory, making the script work correctly for local testing from the project root.

By incorporating these changes, the build script will be more robust for both conda builds and local execution.

Suggested change
cmake -S "$SRC_DIR" \
-B "$BUILD_DIR" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
-DAMGCL_BUILD_TESTS=OFF \
-DAMGCL_BUILD_EXAMPLES=OFF
cmake -S "${SRC_DIR:-.}" \
-B "$BUILD_DIR" \
${CMAKE_ARGS} \
-DCMAKE_BUILD_TYPE=Release \
-DAMGCL_BUILD_TESTS=OFF \
-DAMGCL_BUILD_EXAMPLES=OFF

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d1ea960fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

shell: bash -el {0}
run: |
set -euo pipefail
PKG_FILE="$(conda build --output conda/recipe)"

Choose a reason for hiding this comment

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

P1 Badge Export release tag before resolving upload artifact path

The upload step calls conda build --output conda/recipe, but unlike the build/test steps it does not set GIT_DESCRIBE_TAG. Since conda/recipe/meta.yaml uses environ['GIT_DESCRIBE_TAG'] to compute the package version, this command fails in the upload step on every release run, preventing package publication.

Useful? React with 👍 / 👎.

Copy link

@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

🤖 Fix all issues with AI agents
In @.github/workflows/conda-release.yml:
- Around line 66-74: The upload step's run block invokes `conda build --output
conda/recipe` but doesn't export GIT_DESCRIBE_TAG so meta.yaml cannot resolve
and the PKG_FILE path fails; update that GitHub Actions step to include the same
env entry for GIT_DESCRIBE_TAG (set from the existing GIT_DESCRIBE_TAG input or
computed value used earlier) so the `conda build --output conda/recipe` command
can read GIT_DESCRIBE_TAG when computing the package path.
- Around line 33-43: The Resolve release tag step (id: resolve_tag) currently
interpolates ${{ github.event.release.tag_name }} directly in the run script
which risks pre-run shell injection; change the step to pass the release tag via
an environment variable (e.g., env: RELEASE_TAG: ${{
github.event.release.tag_name }}) and in the run block assign TAG="$RELEASE_TAG"
(properly quoted) before using it (keep set -euo pipefail and the echo to
GITHUB_OUTPUT). This ensures the tag value is not expanded into the shell script
text and prevents injection while preserving the existing behavior.

In `@conda/recipe/build.sh`:
- Around line 13-14: The cmake invocation uses an unguarded $SRC_DIR which will
trigger "unbound variable" under set -u; change the cmake -S argument to use the
same fallback as earlier (use ${SRC_DIR:-${PWD}}) so cmake -S receives a valid
path even when SRC_DIR is unset, and leave -B "$BUILD_DIR" as-is (referencing
the cmake invocation and variables SRC_DIR and BUILD_DIR).
🧹 Nitpick comments (2)
.github/workflows/conda-ci.yml (1)

37-47: CI will fail on PRs to repos with no tags — consider a fallback for PR builds.

The Resolve release tag step hard-fails if no git tag exists (Line 45-46). This is fine for release workflows, but for CI on pull requests, it means the workflow is unusable until the first tag is created. Consider using a fallback version (e.g., 0.0.0) for PR builds so CI can validate the build even before the first release.

Suggested approach
          TAG="$(git describe --tags --abbrev=0 2>/dev/null || true)"
          if [ -z "$TAG" ]; then
-           echo "No git tag found. At least one tag is required for recipe versioning."
-           exit 1
+           echo "No git tag found; using fallback version for CI."
+           TAG="v0.0.0"
          fi
          echo "tag=$TAG" >> "$GITHUB_OUTPUT"
.github/workflows/conda-release.yml (1)

60-61: Redundant if condition — this workflow only triggers on release events.

The if: github.event_name == 'release' guard on Line 61 is always true since the workflow's on: trigger is exclusively release. It's harmless but adds no value. Could be removed for clarity, or kept as a safety net if you plan to add more triggers later.

@Luohaothu
Copy link
Collaborator Author

已处理评审意见:

  • 已修复(CodeRabbit actionable)

    1. conda-release.yml 上传步骤未设置 GIT_DESCRIBE_TAG:已补充 env: GIT_DESCRIBE_TAG: ${{ steps.resolve_tag.outputs.tag }}
    2. release tag 直接内嵌到 shell 脚本:已改为通过 env: RELEASE_TAG: ${{ github.event.release.tag_name }} 传入,再在脚本内 TAG="$RELEASE_TAG"
    3. build.shSRC_DIRset -u 风险:已改为 cmake -S "${SRC_DIR:-${PWD}}"
    4. if: github.event_name == 'release' 在仅 release 触发器下冗余:已移除。
  • 未执行(CI tags 回退到默认值)

    • 我保留现有“无 tag 即失败”的逻辑,不引入默认 v0.0.0,与“版本不使用默认值”的要求一致。

关联提交:887cc68

@Luohaothu
Copy link
Collaborator Author

已按你的要求更新:发布 workflow 的默认 Anaconda org 已从 OpflowDev 改为 OpFlow-dev

修改文件:.github/workflows/conda-release.yml

已推送到当前 PR 分支(commit: d72e039)。

@Luohaothu
Copy link
Collaborator Author

按你的更新,已将发布 workflow 的默认 Anaconda 组织名改为全小写 opflow-dev

修改文件:.github/workflows/conda-release.yml

最新 commit:f3f6f45

@Luohaothu
Copy link
Collaborator Author

按你的要求,已去掉 conda/recipe/meta.yaml 的显式 script: build.sh,改为依赖 conda-build 的默认脚本检测。

对应 commit:60d7f73

@Luohaothu
Copy link
Collaborator Author

我按你说的保留原始风格,已把 conda/recipe/build.sh 的构建目录回退为默认的 buildcmake -B build),去掉了自定义 build_conda

  • 这里的原始写法是可行的,CMake -B 会自动创建目录;不需要额外预建目录。
  • build 目录也没有额外约束问题,conda-build 的打包上下文一般单次干净环境下执行,本场景可直接使用。
  • 这次只移除了“提前创建 build_conda”这层实现细节,功能上无改变。

对应 commit: bfa971a

@Luohaothu
Copy link
Collaborator Author

按你的意见,conda/recipe/build.sh 已恢复为“无需额外变更版”(不再在本轮改动里调整构建目录行为)。

最新 commit:d60fba0

这样后续这文件在 PR 中保持稳定。

@Luohaothu
Copy link
Collaborator Author

已按你的要求处理:conda/recipe/build.sh 已恢复为提 PR 之前的版本(即 3d1ea96 基线时的内容),当前工作区无未提交改动。

如你要“彻底回到 PR 前状态(包含 workflow 等全部改动回滚)”,我可以另起一次提交把 PR 范围也清空,但你现在这条只涉及 build.sh 的回退已完成。

@Luohaothu
Copy link
Collaborator Author

已确认并处理:当前分支与 master 对比,conda/recipe/build.sh 已完全恢复为 master 一致版本。

新增差异现在仅为:

  • .github/workflows/conda-ci.yml
  • .github/workflows/conda-release.yml

对应 commit: 6418a3e

@Luohaothu Luohaothu merged commit 89d2c1a into master Feb 15, 2026
3 checks passed
@Luohaothu Luohaothu deleted the codex/amgcl-conda-workflow-release branch February 15, 2026 17:52
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