From 55e506ed745593ebecd4b69968e38c3a9774023c Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Wed, 22 Oct 2025 18:46:46 +0100 Subject: [PATCH 1/6] CI: fix conda upload *.conda <= *.tar.bz2 vis. https://docs.conda.io/projects/conda-build/en/latest/resources/package-spec.html --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 678bbbd..17b516d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -97,11 +97,11 @@ jobs: fi conda install $BUILD_DEP conda-verify $BUILD_CMD -c conda-forge --override-channels --output-folder dist recipe --python=${{ matrix.python-version }} --no-test - $BUILD_CMD -c conda-forge --override-channels --test dist/*/ccpi-regulariser-*-cpu_*.tar.bz2 + $BUILD_CMD -c conda-forge --override-channels --test dist/*/ccpi-regulariser-*-cpu_* - uses: actions/upload-artifact@v4 with: name: ccpi-regulariser-py${{ matrix.python-version}}-${{ matrix.os }} - path: dist/*/ccpi-regulariser-*.tar.bz2 + path: dist/*/ccpi-regulariser-* conda-upload: if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') defaults: {run: {shell: 'bash -el {0}', working-directory: dist}} @@ -120,13 +120,13 @@ jobs: - name: anaconda upload -c ccpi run: > anaconda -v -t ${{ secrets.CCPI_CONDA_TOKEN }} upload --force - --label ${{ startsWith(github.ref, 'refs/tags') && 'main' || 'dev' }} */ccpi-regulariser-*.tar.bz2 + --label ${{ startsWith(github.ref, 'refs/tags') && 'main' || 'dev' }} */ccpi-regulariser-* - if: startsWith(github.ref, 'refs/tags') name: conda upload -c tomography.stfc.ac.uk/conda run: | echo '${{ secrets.STFC_SSH_KEY }}' > ./key chmod 600 ./key - rsync -e 'ssh -o StrictHostKeyChecking=no -i ./key' -R */ccpi-regulariser-*.tar.bz2 '${{ secrets.STFC_SSH_HOST }}:${{ secrets.STFC_SSH_CONDA_DIR }}' + rsync -e 'ssh -o StrictHostKeyChecking=no -i ./key' -R */ccpi-regulariser-* '${{ secrets.STFC_SSH_HOST }}:${{ secrets.STFC_SSH_CONDA_DIR }}' ssh -o StrictHostKeyChecking=no -i ./key ${{ secrets.STFC_SSH_HOST }} \ 'bash -lic "conda index --bz2 --zst --run-exports --channeldata --rss -n ccpi ${{ secrets.STFC_SSH_CONDA_DIR }}"' pass: From ff8d25be739b6734004fbed933798a48c717df2c Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Wed, 22 Oct 2025 19:19:34 +0100 Subject: [PATCH 2/6] conda: python_version_independent --- .github/workflows/build.yml | 49 +++++++++++++++++++++------------- recipe/conda_build_config.yaml | 5 ---- recipe/meta.yaml | 10 ++++--- 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 17b516d..bf5a03b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,10 +71,7 @@ jobs: runs-on: ${{ matrix.os }}-${{ matrix.os == 'windows' && '2022' || 'latest' }} strategy: matrix: - python-version: ['3.10', 3.11, 3.12] # parallelise conda_build_config.yaml os: [ubuntu, windows] - include: - - {python-version: 3.13, os: ubuntu} steps: - uses: actions/checkout@v4 with: {fetch-depth: 0, submodules: recursive} @@ -82,31 +79,47 @@ jobs: uses: ilammy/msvc-dev-cmd@v1 - uses: conda-incubator/setup-miniconda@v3 with: - python-version: ${{ matrix.python-version }} + python-version: 3.13 mamba-version: "*" channels: conda-forge conda-remove-defaults: "true" + - run: conda install 'conda-build>=25.3' conda-verify - name: conda build - run: | - if test ${{ matrix.python-version }} = 3.13; then - BUILD_DEP=conda-build - BUILD_CMD="conda build" - else - BUILD_DEP=boa - BUILD_CMD="conda mambabuild" - fi - conda install $BUILD_DEP conda-verify - $BUILD_CMD -c conda-forge --override-channels --output-folder dist recipe --python=${{ matrix.python-version }} --no-test - $BUILD_CMD -c conda-forge --override-channels --test dist/*/ccpi-regulariser-*-cpu_* + run: conda build -c conda-forge --override-channels --output-folder dist recipe --no-test - uses: actions/upload-artifact@v4 with: - name: ccpi-regulariser-py${{ matrix.python-version}}-${{ matrix.os }} + name: ccpi-regulariser-${{ matrix.os }} path: dist/*/ccpi-regulariser-* + conda-test: + defaults: {run: {shell: 'bash -el {0}'}} + runs-on: ${{ matrix.os }}-latest + needs: conda-build + strategy: + matrix: + python-version: ['3.10', 3.12] # min & max supported + os: [ubuntu, windows] + include: + - {python-version: 3.13, os: ubuntu} + steps: + - uses: actions/checkout@v4 + - uses: conda-incubator/setup-miniconda@v3 + with: + python-version: ${{ matrix.python-version }} + mamba-version: "*" + channels: conda-forge + conda-remove-defaults: "true" + - uses: actions/download-artifact@v4 + with: + name: ccpi-regulariser-${{ matrix.os }} + path: dist + - run: conda install conda-build + - name: conda test + run: conda build -c conda-forge --override-channels --test dist/*/ccpi-regulariser-*-cpu_* --python=${{ matrix.python-version }} conda-upload: if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') defaults: {run: {shell: 'bash -el {0}', working-directory: dist}} runs-on: ubuntu-latest - needs: conda-build + needs: conda-test steps: - uses: actions/checkout@v4 - uses: conda-incubator/setup-miniconda@v3 @@ -130,6 +143,6 @@ jobs: ssh -o StrictHostKeyChecking=no -i ./key ${{ secrets.STFC_SSH_HOST }} \ 'bash -lic "conda index --bz2 --zst --run-exports --channeldata --rss -n ccpi ${{ secrets.STFC_SSH_CONDA_DIR }}"' pass: - needs: [test-cuda, test, conda-build] + needs: [test-cuda, test, conda-test] runs-on: ubuntu-latest steps: [{run: echo success}] diff --git a/recipe/conda_build_config.yaml b/recipe/conda_build_config.yaml index bd6b93c..176d25d 100644 --- a/recipe/conda_build_config.yaml +++ b/recipe/conda_build_config.yaml @@ -1,8 +1,3 @@ -python: - - 3.10 - - 3.11 - - 3.12 - - 3.13 cuda_compiler_version: - None - 12.9 diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 1fb6e61..72fcbe4 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,6 +1,7 @@ # https://docs.conda.io/projects/conda-build/en/stable/resources/define-metadata.html#loading-data-from-other-files # TODO: use scikit-build-core & setuptools_scm instead {% set project = load_file_data('../src/Python/pyproject.toml', from_recipe_dir=True).get('project', {}) %} +{% set python_min = "3.10" %} {% set build_number = environ.get('GIT_DESCRIBE_NUMBER', 0) | int %} {% if cuda_compiler_version != "None" %} {% set build_number = build_number + 200 %} @@ -13,6 +14,7 @@ package: build: preserve_egg_dir: False number: {{ build_number }} + python_version_independent: true run_exports: - {{ pin_subpackage(project.get('name'), max_pin='x.x') }} - {{ project.get('name') }} =*=cuda* # [cuda_compiler_version != "None"] @@ -24,8 +26,8 @@ build: script_env: - BUILD_CUDA=ON # [cuda_compiler_version != "None"] - BUILD_CUDA=OFF # [cuda_compiler_version == "None"] - string: cuda{{ cuda_compiler_version | replace('.', '') }}_py{{ py }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda_compiler_version != "None"] - string: cpu_py{{ py }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda_compiler_version == "None"] + string: cuda{{ cuda_compiler_version | replace('.', '') }}_h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda_compiler_version != "None"] + string: cpu_h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda_compiler_version == "None"] source: path: .. @@ -43,14 +45,14 @@ requirements: #- {{ compiler('cuda') }} # [cuda_compiler_version != "None"] - cuda-compiler ~={{ cuda_compiler_version }} # [cuda_compiler_version != "None"] host: - - python + - python {{ python_min }} - llvm-openmp - setuptools - pip - cuda-cccl # [cuda_compiler_version != "None"] - cuda-version {{ cuda_compiler_version }} # [cuda_compiler_version != "None"] run: - - {{ pin_compatible('python', min_pin='x.x', max_pin='x') }} + - python >={{ python_min }} {% for dep in project.get("dependencies") %} - {{ dep.lower() }} {% endfor %} From 6cf4f98b246928c6efa07df9960e9c1871c1a1d7 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Wed, 22 Oct 2025 20:52:00 +0100 Subject: [PATCH 3/6] try fix windows --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf5a03b..47b5e2f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,7 +68,7 @@ jobs: run: PYTHONPATH=./src/Python python -m unittest discover -v -s ./test conda-build: defaults: {run: {shell: 'bash -el {0}'}} - runs-on: ${{ matrix.os }}-${{ matrix.os == 'windows' && '2022' || 'latest' }} + runs-on: ${{ matrix.os }}-latest strategy: matrix: os: [ubuntu, windows] From 3892b5bc87547664aa74e05a1617e1c7670e8ac4 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Wed, 22 Oct 2025 21:51:43 +0100 Subject: [PATCH 4/6] CI: bump actions --- .github/workflows/build.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 47b5e2f..082df0e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: matrix: python-version: [3.12] # penultimate supported steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: {fetch-depth: 0, submodules: recursive} - id: reqs name: set requirements @@ -53,7 +53,7 @@ jobs: python-version: ['3.10', 3.13] # min & max supported os: [ubuntu-latest, windows-latest] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: {fetch-depth: 0, submodules: recursive} - uses: conda-incubator/setup-miniconda@v3 with: @@ -73,7 +73,7 @@ jobs: matrix: os: [ubuntu, windows] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: {fetch-depth: 0, submodules: recursive} - if: matrix.os == 'windows' uses: ilammy/msvc-dev-cmd@v1 @@ -83,7 +83,7 @@ jobs: mamba-version: "*" channels: conda-forge conda-remove-defaults: "true" - - run: conda install 'conda-build>=25.3' conda-verify + - run: mamba install 'conda-build>=25.3' conda-verify - name: conda build run: conda build -c conda-forge --override-channels --output-folder dist recipe --no-test - uses: actions/upload-artifact@v4 @@ -101,18 +101,18 @@ jobs: include: - {python-version: 3.13, os: ubuntu} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: conda-incubator/setup-miniconda@v3 with: python-version: ${{ matrix.python-version }} mamba-version: "*" channels: conda-forge conda-remove-defaults: "true" - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v5 with: name: ccpi-regulariser-${{ matrix.os }} path: dist - - run: conda install conda-build + - run: mamba install conda-build - name: conda test run: conda build -c conda-forge --override-channels --test dist/*/ccpi-regulariser-*-cpu_* --python=${{ matrix.python-version }} conda-upload: @@ -121,13 +121,13 @@ jobs: runs-on: ubuntu-latest needs: conda-test steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: conda-incubator/setup-miniconda@v3 with: mamba-version: "*" channels: conda-forge conda-remove-defaults: "true" - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v5 with: {pattern: ccpi-regulariser-*, path: dist, merge-multiple: true} - run: mamba install anaconda-client - name: anaconda upload -c ccpi From fa87afeab40cc74c6312ae11a992d79387a9e723 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Wed, 22 Oct 2025 21:51:59 +0100 Subject: [PATCH 5/6] try fix windows again --- .github/workflows/build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 082df0e..bd49d11 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,11 +75,9 @@ jobs: steps: - uses: actions/checkout@v5 with: {fetch-depth: 0, submodules: recursive} - - if: matrix.os == 'windows' - uses: ilammy/msvc-dev-cmd@v1 - uses: conda-incubator/setup-miniconda@v3 with: - python-version: 3.13 + python-version: 3.12 mamba-version: "*" channels: conda-forge conda-remove-defaults: "true" From 092ce523665308506395e66118e6b2b465eb90c2 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Fri, 24 Oct 2025 12:57:23 +0100 Subject: [PATCH 6/6] drop explicit mamba --- .github/workflows/build.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd49d11..50bc8a3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,10 +78,9 @@ jobs: - uses: conda-incubator/setup-miniconda@v3 with: python-version: 3.12 - mamba-version: "*" channels: conda-forge conda-remove-defaults: "true" - - run: mamba install 'conda-build>=25.3' conda-verify + - run: conda install 'conda-build>=25.3' conda-verify - name: conda build run: conda build -c conda-forge --override-channels --output-folder dist recipe --no-test - uses: actions/upload-artifact@v4 @@ -103,14 +102,13 @@ jobs: - uses: conda-incubator/setup-miniconda@v3 with: python-version: ${{ matrix.python-version }} - mamba-version: "*" channels: conda-forge conda-remove-defaults: "true" - uses: actions/download-artifact@v5 with: name: ccpi-regulariser-${{ matrix.os }} path: dist - - run: mamba install conda-build + - run: conda install conda-build - name: conda test run: conda build -c conda-forge --override-channels --test dist/*/ccpi-regulariser-*-cpu_* --python=${{ matrix.python-version }} conda-upload: @@ -122,12 +120,11 @@ jobs: - uses: actions/checkout@v5 - uses: conda-incubator/setup-miniconda@v3 with: - mamba-version: "*" channels: conda-forge conda-remove-defaults: "true" - uses: actions/download-artifact@v5 with: {pattern: ccpi-regulariser-*, path: dist, merge-multiple: true} - - run: mamba install anaconda-client + - run: conda install anaconda-client - name: anaconda upload -c ccpi run: > anaconda -v -t ${{ secrets.CCPI_CONDA_TOKEN }} upload --force