From 3d1ea960fa63ccf5f04dcb07b1039e8d8c93a72a Mon Sep 17 00:00:00 2001 From: Luohao Wang Date: Mon, 16 Feb 2026 01:08:38 +0800 Subject: [PATCH 01/13] ci: add conda build and release workflows --- .github/workflows/conda-ci.yml | 62 ++++++++++++++++++++++++ .github/workflows/conda-release.yml | 74 +++++++++++++++++++++++++++++ conda/recipe/build.sh | 15 +++--- conda/recipe/meta.yaml | 1 + 4 files changed, 146 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/conda-ci.yml create mode 100644 .github/workflows/conda-release.yml diff --git a/.github/workflows/conda-ci.yml b/.github/workflows/conda-ci.yml new file mode 100644 index 00000000..baa8ba02 --- /dev/null +++ b/.github/workflows/conda-ci.yml @@ -0,0 +1,62 @@ +name: Conda CI + +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + build-conda: + name: Build conda package (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + + steps: + - name: Checkout source + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Miniconda + uses: conda-incubator/setup-miniconda@v3 + with: + auto-update-conda: true + use-mamba: true + + - name: Install conda build tools + shell: bash -el {0} + run: | + mamba install -y -n base conda-build anaconda-client + + - name: Resolve release tag + id: resolve_tag + shell: bash + run: | + set -euo pipefail + 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 + fi + echo "tag=$TAG" >> "$GITHUB_OUTPUT" + + - name: Build conda package + env: + GIT_DESCRIBE_TAG: ${{ steps.resolve_tag.outputs.tag }} + shell: bash -el {0} + run: | + conda build conda/recipe --no-test + + - name: Test built package + env: + GIT_DESCRIBE_TAG: ${{ steps.resolve_tag.outputs.tag }} + shell: bash -el {0} + run: | + PKG_FILE="$(conda build --output conda/recipe)" + conda build --test "$PKG_FILE" -c local diff --git a/.github/workflows/conda-release.yml b/.github/workflows/conda-release.yml new file mode 100644 index 00000000..22d928aa --- /dev/null +++ b/.github/workflows/conda-release.yml @@ -0,0 +1,74 @@ +name: Conda Release + +on: + release: + types: [published] + +jobs: + release-conda: + name: Build and upload conda package (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + + steps: + - name: Checkout source + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Miniconda + uses: conda-incubator/setup-miniconda@v3 + with: + auto-update-conda: true + use-mamba: true + + - name: Install conda build tools + shell: bash -el {0} + run: | + mamba install -y -n base conda-build anaconda-client + + - name: Resolve release tag + id: resolve_tag + shell: bash + run: | + set -euo pipefail + TAG="${{ github.event.release.tag_name }}" + if [ -z "$TAG" ]; then + echo "No tag on release event." + exit 1 + fi + echo "tag=$TAG" >> "$GITHUB_OUTPUT" + + - name: Build conda package + env: + GIT_DESCRIBE_TAG: ${{ steps.resolve_tag.outputs.tag }} + shell: bash -el {0} + run: | + conda build conda/recipe --no-test + + - name: Test built package + env: + GIT_DESCRIBE_TAG: ${{ steps.resolve_tag.outputs.tag }} + shell: bash -el {0} + run: | + PKG_FILE="$(conda build --output conda/recipe)" + conda build --test "$PKG_FILE" -c local + + - name: Upload package to Anaconda + if: github.event_name == 'release' + env: + ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} + ANACONDA_ORG: ${{ secrets.ANACONDA_ORG }} + shell: bash -el {0} + run: | + set -euo pipefail + PKG_FILE="$(conda build --output conda/recipe)" + ANACONDA_ORG="${ANACONDA_ORG:-OpflowDev}" + if [ -z "${ANACONDA_API_TOKEN:-}" ]; then + echo "Missing ANACONDA_API_TOKEN secret." + exit 1 + fi + anaconda upload -u "$ANACONDA_ORG" "$PKG_FILE" diff --git a/conda/recipe/build.sh b/conda/recipe/build.sh index 358c04fb..71f5cb21 100755 --- a/conda/recipe/build.sh +++ b/conda/recipe/build.sh @@ -1,18 +1,21 @@ #!/usr/bin/env bash -set -euxo pipefail +set -euo pipefail + +BUILD_DIR="${SRC_DIR:-${PWD}}/build_conda" +mkdir -p "$BUILD_DIR" if [ -z "${GIT_DESCRIBE_TAG:-}" ]; then echo "ERROR: GIT_DESCRIBE_TAG is not set. Set it to the current release tag (e.g. v1.4.5)." >&2 echo "Run: export GIT_DESCRIBE_TAG=\"$(git -C \"${SRC_DIR:-$(pwd)}\" describe --tags --abbrev=0)\"" >&2 exit 1 fi -export GIT_DESCRIBE_TAG -cmake -S . -B build \ - -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ +cmake -S "$SRC_DIR" \ + -B "$BUILD_DIR" \ -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="$PREFIX" \ -DAMGCL_BUILD_TESTS=OFF \ -DAMGCL_BUILD_EXAMPLES=OFF -cmake --build build -- -j"${CPU_COUNT:-1}" -cmake --install build +cmake --build "$BUILD_DIR" -- -j"${CPU_COUNT:-1}" +cmake --install "$BUILD_DIR" diff --git a/conda/recipe/meta.yaml b/conda/recipe/meta.yaml index 9f70a47e..44e9b8c3 100644 --- a/conda/recipe/meta.yaml +++ b/conda/recipe/meta.yaml @@ -11,6 +11,7 @@ source: build: number: 0 skip: True # [win] + script: build.sh requirements: build: From 887cc6841b21a835a99a0c55183ce06e0d11c0bf Mon Sep 17 00:00:00 2001 From: Luohao Wang Date: Mon, 16 Feb 2026 01:15:55 +0800 Subject: [PATCH 02/13] ci: address review feedback in conda workflows --- .github/workflows/conda-release.yml | 6 ++++-- conda/recipe/build.sh | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/conda-release.yml b/.github/workflows/conda-release.yml index 22d928aa..d4752843 100644 --- a/.github/workflows/conda-release.yml +++ b/.github/workflows/conda-release.yml @@ -32,10 +32,12 @@ jobs: - name: Resolve release tag id: resolve_tag + env: + RELEASE_TAG: ${{ github.event.release.tag_name }} shell: bash run: | set -euo pipefail - TAG="${{ github.event.release.tag_name }}" + TAG="$RELEASE_TAG" if [ -z "$TAG" ]; then echo "No tag on release event." exit 1 @@ -58,10 +60,10 @@ jobs: conda build --test "$PKG_FILE" -c local - name: Upload package to Anaconda - if: github.event_name == 'release' env: ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} ANACONDA_ORG: ${{ secrets.ANACONDA_ORG }} + GIT_DESCRIBE_TAG: ${{ steps.resolve_tag.outputs.tag }} shell: bash -el {0} run: | set -euo pipefail diff --git a/conda/recipe/build.sh b/conda/recipe/build.sh index 71f5cb21..1a868465 100755 --- a/conda/recipe/build.sh +++ b/conda/recipe/build.sh @@ -10,7 +10,7 @@ if [ -z "${GIT_DESCRIBE_TAG:-}" ]; then exit 1 fi -cmake -S "$SRC_DIR" \ +cmake -S "${SRC_DIR:-${PWD}}" \ -B "$BUILD_DIR" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX="$PREFIX" \ From d72e03906d376d829a3766780b40cbfd69b9d8c5 Mon Sep 17 00:00:00 2001 From: Luohao Wang Date: Mon, 16 Feb 2026 01:17:25 +0800 Subject: [PATCH 03/13] ci: set default anaconda org to OpFlow-dev --- .github/workflows/conda-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conda-release.yml b/.github/workflows/conda-release.yml index d4752843..9effa3b3 100644 --- a/.github/workflows/conda-release.yml +++ b/.github/workflows/conda-release.yml @@ -68,7 +68,7 @@ jobs: run: | set -euo pipefail PKG_FILE="$(conda build --output conda/recipe)" - ANACONDA_ORG="${ANACONDA_ORG:-OpflowDev}" + ANACONDA_ORG="${ANACONDA_ORG:-OpFlow-dev}" if [ -z "${ANACONDA_API_TOKEN:-}" ]; then echo "Missing ANACONDA_API_TOKEN secret." exit 1 From f3f6f457a390a8f5b133bfcc9714ef78896b2e2e Mon Sep 17 00:00:00 2001 From: Luohao Wang Date: Mon, 16 Feb 2026 01:18:08 +0800 Subject: [PATCH 04/13] ci: use lowercase default anaconda org --- .github/workflows/conda-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conda-release.yml b/.github/workflows/conda-release.yml index 9effa3b3..1b80f7d7 100644 --- a/.github/workflows/conda-release.yml +++ b/.github/workflows/conda-release.yml @@ -68,7 +68,7 @@ jobs: run: | set -euo pipefail PKG_FILE="$(conda build --output conda/recipe)" - ANACONDA_ORG="${ANACONDA_ORG:-OpFlow-dev}" + ANACONDA_ORG="${ANACONDA_ORG:-opflow-dev}" if [ -z "${ANACONDA_API_TOKEN:-}" ]; then echo "Missing ANACONDA_API_TOKEN secret." exit 1 From 60d7f735de73112831b6a312cd7426ec0af24233 Mon Sep 17 00:00:00 2001 From: Luohao Wang Date: Mon, 16 Feb 2026 01:19:45 +0800 Subject: [PATCH 05/13] ci: rely on conda-build default build script detection --- conda/recipe/meta.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/conda/recipe/meta.yaml b/conda/recipe/meta.yaml index 44e9b8c3..9f70a47e 100644 --- a/conda/recipe/meta.yaml +++ b/conda/recipe/meta.yaml @@ -11,7 +11,6 @@ source: build: number: 0 skip: True # [win] - script: build.sh requirements: build: From bfa971a4343804928123b106a475327f40d73f2c Mon Sep 17 00:00:00 2001 From: Luohao Wang Date: Mon, 16 Feb 2026 01:21:42 +0800 Subject: [PATCH 06/13] ci: simplify conda build directory name in build.sh --- conda/recipe/build.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/conda/recipe/build.sh b/conda/recipe/build.sh index 1a868465..37ca49ee 100755 --- a/conda/recipe/build.sh +++ b/conda/recipe/build.sh @@ -1,9 +1,6 @@ #!/usr/bin/env bash set -euo pipefail -BUILD_DIR="${SRC_DIR:-${PWD}}/build_conda" -mkdir -p "$BUILD_DIR" - if [ -z "${GIT_DESCRIBE_TAG:-}" ]; then echo "ERROR: GIT_DESCRIBE_TAG is not set. Set it to the current release tag (e.g. v1.4.5)." >&2 echo "Run: export GIT_DESCRIBE_TAG=\"$(git -C \"${SRC_DIR:-$(pwd)}\" describe --tags --abbrev=0)\"" >&2 @@ -11,11 +8,11 @@ if [ -z "${GIT_DESCRIBE_TAG:-}" ]; then fi cmake -S "${SRC_DIR:-${PWD}}" \ - -B "$BUILD_DIR" \ + -B build \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX="$PREFIX" \ -DAMGCL_BUILD_TESTS=OFF \ -DAMGCL_BUILD_EXAMPLES=OFF -cmake --build "$BUILD_DIR" -- -j"${CPU_COUNT:-1}" -cmake --install "$BUILD_DIR" +cmake --build build -- -j"${CPU_COUNT:-1}" +cmake --install build From d60fba0dd1c4105b7ca266a855d81bf56ac8e6c6 Mon Sep 17 00:00:00 2001 From: Luohao Wang Date: Mon, 16 Feb 2026 01:22:41 +0800 Subject: [PATCH 07/13] ci: keep build.sh unchanged as prior form --- conda/recipe/build.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/conda/recipe/build.sh b/conda/recipe/build.sh index 37ca49ee..71f5cb21 100755 --- a/conda/recipe/build.sh +++ b/conda/recipe/build.sh @@ -1,18 +1,21 @@ #!/usr/bin/env bash set -euo pipefail +BUILD_DIR="${SRC_DIR:-${PWD}}/build_conda" +mkdir -p "$BUILD_DIR" + if [ -z "${GIT_DESCRIBE_TAG:-}" ]; then echo "ERROR: GIT_DESCRIBE_TAG is not set. Set it to the current release tag (e.g. v1.4.5)." >&2 echo "Run: export GIT_DESCRIBE_TAG=\"$(git -C \"${SRC_DIR:-$(pwd)}\" describe --tags --abbrev=0)\"" >&2 exit 1 fi -cmake -S "${SRC_DIR:-${PWD}}" \ - -B build \ +cmake -S "$SRC_DIR" \ + -B "$BUILD_DIR" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX="$PREFIX" \ -DAMGCL_BUILD_TESTS=OFF \ -DAMGCL_BUILD_EXAMPLES=OFF -cmake --build build -- -j"${CPU_COUNT:-1}" -cmake --install build +cmake --build "$BUILD_DIR" -- -j"${CPU_COUNT:-1}" +cmake --install "$BUILD_DIR" From 6418a3ec71a72d3d5d6574c332601cce70ac5457 Mon Sep 17 00:00:00 2001 From: Luohao Wang Date: Mon, 16 Feb 2026 01:25:23 +0800 Subject: [PATCH 08/13] chore: sync build.sh with master version --- conda/recipe/build.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/conda/recipe/build.sh b/conda/recipe/build.sh index 71f5cb21..358c04fb 100755 --- a/conda/recipe/build.sh +++ b/conda/recipe/build.sh @@ -1,21 +1,18 @@ #!/usr/bin/env bash -set -euo pipefail - -BUILD_DIR="${SRC_DIR:-${PWD}}/build_conda" -mkdir -p "$BUILD_DIR" +set -euxo pipefail if [ -z "${GIT_DESCRIBE_TAG:-}" ]; then echo "ERROR: GIT_DESCRIBE_TAG is not set. Set it to the current release tag (e.g. v1.4.5)." >&2 echo "Run: export GIT_DESCRIBE_TAG=\"$(git -C \"${SRC_DIR:-$(pwd)}\" describe --tags --abbrev=0)\"" >&2 exit 1 fi +export GIT_DESCRIBE_TAG -cmake -S "$SRC_DIR" \ - -B "$BUILD_DIR" \ +cmake -S . -B build \ + -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="$PREFIX" \ -DAMGCL_BUILD_TESTS=OFF \ -DAMGCL_BUILD_EXAMPLES=OFF -cmake --build "$BUILD_DIR" -- -j"${CPU_COUNT:-1}" -cmake --install "$BUILD_DIR" +cmake --build build -- -j"${CPU_COUNT:-1}" +cmake --install build From 5b0d0a6c5194f93ceb0654e384a023b4968cf25e Mon Sep 17 00:00:00 2001 From: Luohao Wang Date: Mon, 16 Feb 2026 01:27:12 +0800 Subject: [PATCH 09/13] ci: use conda binary instead of unavailable mamba --- .github/workflows/conda-ci.yml | 2 +- .github/workflows/conda-release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/conda-ci.yml b/.github/workflows/conda-ci.yml index baa8ba02..abb3c05c 100644 --- a/.github/workflows/conda-ci.yml +++ b/.github/workflows/conda-ci.yml @@ -32,7 +32,7 @@ jobs: - name: Install conda build tools shell: bash -el {0} run: | - mamba install -y -n base conda-build anaconda-client + conda install -y -n base conda-build anaconda-client - name: Resolve release tag id: resolve_tag diff --git a/.github/workflows/conda-release.yml b/.github/workflows/conda-release.yml index 1b80f7d7..f3ff7b7d 100644 --- a/.github/workflows/conda-release.yml +++ b/.github/workflows/conda-release.yml @@ -28,7 +28,7 @@ jobs: - name: Install conda build tools shell: bash -el {0} run: | - mamba install -y -n base conda-build anaconda-client + conda install -y -n base conda-build anaconda-client - name: Resolve release tag id: resolve_tag From 7ebbc6f8eb6a01437aa19482f0b4e98d8848fdfe Mon Sep 17 00:00:00 2001 From: Luohao Wang Date: Mon, 16 Feb 2026 01:35:08 +0800 Subject: [PATCH 10/13] ci: resolve latest tag for PR conda builds --- .github/workflows/conda-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/conda-ci.yml b/.github/workflows/conda-ci.yml index abb3c05c..c011aee5 100644 --- a/.github/workflows/conda-ci.yml +++ b/.github/workflows/conda-ci.yml @@ -39,7 +39,8 @@ jobs: shell: bash run: | set -euo pipefail - TAG="$(git describe --tags --abbrev=0 2>/dev/null || true)" + git fetch --tags --force + TAG="$(git tag --sort=-creatordate | head -n 1 || true)" if [ -z "$TAG" ]; then echo "No git tag found. At least one tag is required for recipe versioning." exit 1 From cdf9a1bc122b6213f1a00b58ea550d75a0850927 Mon Sep 17 00:00:00 2001 From: Luohao Wang Date: Mon, 16 Feb 2026 01:36:56 +0800 Subject: [PATCH 11/13] ci: resolve tags from repo or parent repo in PR workflow --- .github/workflows/conda-ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/conda-ci.yml b/.github/workflows/conda-ci.yml index c011aee5..5b748618 100644 --- a/.github/workflows/conda-ci.yml +++ b/.github/workflows/conda-ci.yml @@ -41,6 +41,14 @@ jobs: set -euo pipefail git fetch --tags --force TAG="$(git tag --sort=-creatordate | head -n 1 || true)" + if [ -z "$TAG" ]; then + REMOTE_REPO="${{ github.event.repository.full_name }}" + if [ -n "${{ github.event.repository.parent.full_name }}" ]; then + REMOTE_REPO="${{ github.event.repository.parent.full_name }}" + fi + TAG="$(git ls-remote --tags --refs --sort='v:refname' "https://github.com/$REMOTE_REPO.git" \ + refs/tags/* | awk '{print $2}' | sed 's#refs/tags/##' | head -n 1)" + fi if [ -z "$TAG" ]; then echo "No git tag found. At least one tag is required for recipe versioning." exit 1 From 8e3431355b451f5ba80fed3afbe9e419ec690fff Mon Sep 17 00:00:00 2001 From: Luohao Wang Date: Mon, 16 Feb 2026 01:44:42 +0800 Subject: [PATCH 12/13] ci: provide fallback tag when no git tags available --- .github/workflows/conda-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/conda-ci.yml b/.github/workflows/conda-ci.yml index 5b748618..c682870d 100644 --- a/.github/workflows/conda-ci.yml +++ b/.github/workflows/conda-ci.yml @@ -50,8 +50,7 @@ jobs: refs/tags/* | awk '{print $2}' | sed 's#refs/tags/##' | head -n 1)" fi if [ -z "$TAG" ]; then - echo "No git tag found. At least one tag is required for recipe versioning." - exit 1 + TAG="1.4.5" fi echo "tag=$TAG" >> "$GITHUB_OUTPUT" From f228021248815e55cb284ba7e315f3067080e058 Mon Sep 17 00:00:00 2001 From: Luohao Wang Date: Mon, 16 Feb 2026 01:47:24 +0800 Subject: [PATCH 13/13] ci: propagate GIT_DESCRIBE_TAG into recipe build script --- conda/recipe/meta.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conda/recipe/meta.yaml b/conda/recipe/meta.yaml index 9f70a47e..b1ff88aa 100644 --- a/conda/recipe/meta.yaml +++ b/conda/recipe/meta.yaml @@ -11,6 +11,8 @@ source: build: number: 0 skip: True # [win] + script_env: + - GIT_DESCRIBE_TAG requirements: build: