From cf3fad2223e6d7766fd760d7e91041640fa34ce1 Mon Sep 17 00:00:00 2001 From: Michael Warner Date: Fri, 25 Sep 2026 14:09:46 -0700 Subject: [PATCH 1/3] ci: add safe Conda publish dry run --- .conda/recipe/meta.yaml | 2 +- .github/workflows/conda-publish.yml | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.conda/recipe/meta.yaml b/.conda/recipe/meta.yaml index a2ede9c..6672a38 100644 --- a/.conda/recipe/meta.yaml +++ b/.conda/recipe/meta.yaml @@ -31,7 +31,7 @@ requirements: about: home: https://github.com/LSDOlab/CSDL_alpha license: LGPL-3.0-or-later - license_file: LICENSE + license_file: LICENSE.txt summary: Computational System Design Language. extra: diff --git a/.github/workflows/conda-publish.yml b/.github/workflows/conda-publish.yml index 6e110cf..f273f16 100644 --- a/.github/workflows/conda-publish.yml +++ b/.github/workflows/conda-publish.yml @@ -4,6 +4,12 @@ on: push: tags: ["v*"] workflow_dispatch: + inputs: + publish: + description: Upload the built package to Anaconda.org + required: true + default: false + type: boolean permissions: contents: read @@ -51,6 +57,7 @@ jobs: run: conda build .conda/recipe --channel conda-forge --output-folder "$RUNNER_TEMP/conda-bld" - name: Publish to Anaconda.org + if: github.event_name == 'push' || inputs.publish shell: bash -el {0} run: | test -n "$ANACONDA_API_TOKEN" || { echo "::error::ANACONDA_API_TOKEN is not configured"; exit 1; } From 6228655f944184f2d73a2341e851873533a7e606 Mon Sep 17 00:00:00 2001 From: Michael Warner Date: Fri, 25 Sep 2026 14:16:32 -0700 Subject: [PATCH 2/3] ci: build Conda packages with Rattler --- .github/workflows/conda-publish.yml | 57 +++++-------------- .conda/recipe/meta.yaml => recipe/recipe.yaml | 20 +++---- 2 files changed, 24 insertions(+), 53 deletions(-) rename .conda/recipe/meta.yaml => recipe/recipe.yaml (59%) diff --git a/.github/workflows/conda-publish.yml b/.github/workflows/conda-publish.yml index f273f16..be74180 100644 --- a/.github/workflows/conda-publish.yml +++ b/.github/workflows/conda-publish.yml @@ -1,3 +1,6 @@ +# Builds the Conda package with Rattler and publishes it to Anaconda.org. +# Manual runs build only unless the publish input is explicitly enabled. + name: Publish Conda package on: @@ -11,56 +14,24 @@ on: default: false type: boolean -permissions: - contents: read - jobs: publish: runs-on: ubuntu-latest - env: - ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} - ANACONDA_OWNER: LSDOlab steps: - uses: actions/checkout@v4 - - name: Set up Conda build tools - uses: conda-incubator/setup-miniconda@v3 - with: - activate-environment: conda-build - python-version: "3.12" - channels: conda-forge - channel-priority: strict - auto-update-conda: false - - - name: Install publishing tools - shell: bash -el {0} - run: conda install --yes --name base --channel conda-forge conda-build anaconda-client - - - name: Read normalized package version - id: package - shell: bash - run: | - python - <<'PY' >> "$GITHUB_OUTPUT" - from pathlib import Path - from packaging.version import Version - import re - text = Path("csdl_alpha/__init__.py").read_text() - match = re.search(r"^__version__\s*=\s*['\"]([^'\"]+)", text, re.M) - assert match, "version not found" - print(f"version={Version(match.group(1))}") - PY - - name: Build Conda package - shell: bash -el {0} - env: - PKG_VERSION: ${{ steps.package.outputs.version }} - run: conda build .conda/recipe --channel conda-forge --output-folder "$RUNNER_TEMP/conda-bld" + uses: prefix-dev/rattler-build-action@v0.2.39 + with: + recipe-path: recipe/recipe.yaml + build-args: -c conda-forge + upload-artifact: false - name: Publish to Anaconda.org - if: github.event_name == 'push' || inputs.publish - shell: bash -el {0} + if: github.event_name == "push" || inputs.publish + env: + ANACONDA_API_KEY: ${{ secrets.ANACONDA_API_TOKEN || secrets.ANACONDA_API_KEY }} run: | - test -n "$ANACONDA_API_TOKEN" || { echo "::error::ANACONDA_API_TOKEN is not configured"; exit 1; } - package_file="$(find "$RUNNER_TEMP/conda-bld/noarch" -maxdepth 1 -type f \( -name '*.conda' -o -name '*.tar.bz2' \) -print -quit)" - test -n "$package_file" || { echo "::error::Conda build did not produce a noarch package"; exit 1; } - anaconda --token "$ANACONDA_API_TOKEN" upload --user "$ANACONDA_OWNER" --label main "$package_file" + for pkg in $(find output -type f \( -name "*.conda" -o -name "*.tar.bz2" \)); do + rattler-build upload anaconda -o LSDOlab "${pkg}" + done diff --git a/.conda/recipe/meta.yaml b/recipe/recipe.yaml similarity index 59% rename from .conda/recipe/meta.yaml rename to recipe/recipe.yaml index 6672a38..58857fa 100644 --- a/.conda/recipe/meta.yaml +++ b/recipe/recipe.yaml @@ -1,16 +1,15 @@ -{% set version = environ["PKG_VERSION"] %} +schema_version: 1 package: name: csdl_alpha - version: {{ version }} + version: "0.0.0a2" source: - path: ../.. + path: .. build: - number: 0 noarch: python - script: "{{ PYTHON }} -m pip install . --no-deps --no-build-isolation -vv" + script: python -m pip install . --no-deps --no-build-isolation -vv requirements: host: @@ -28,12 +27,13 @@ requirements: - pydot - pytest +tests: + - python: + imports: + - csdl_alpha + about: - home: https://github.com/LSDOlab/CSDL_alpha + homepage: https://github.com/LSDOlab/csdl_alpha license: LGPL-3.0-or-later license_file: LICENSE.txt summary: Computational System Design Language. - -extra: - recipe-maintainers: - - LSDOlab From 8f7946fe7edb431bd310ca9e006fb13b9f49b31d Mon Sep 17 00:00:00 2001 From: Michael Warner Date: Fri, 25 Sep 2026 14:16:54 -0700 Subject: [PATCH 3/3] ci: fix Rattler publish condition syntax --- .github/workflows/conda-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conda-publish.yml b/.github/workflows/conda-publish.yml index be74180..127e803 100644 --- a/.github/workflows/conda-publish.yml +++ b/.github/workflows/conda-publish.yml @@ -28,7 +28,7 @@ jobs: upload-artifact: false - name: Publish to Anaconda.org - if: github.event_name == "push" || inputs.publish + if: github.event_name == 'push' || inputs.publish env: ANACONDA_API_KEY: ${{ secrets.ANACONDA_API_TOKEN || secrets.ANACONDA_API_KEY }} run: |