Skip to content

Commit 7e98e28

Browse files
committed
conda: python_version_independent
1 parent 55e506e commit 7e98e28

File tree

3 files changed

+37
-27
lines changed

3 files changed

+37
-27
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,42 +71,55 @@ jobs:
7171
runs-on: ${{ matrix.os }}-${{ matrix.os == 'windows' && '2022' || 'latest' }}
7272
strategy:
7373
matrix:
74-
python-version: ['3.10', 3.11, 3.12] # parallelise conda_build_config.yaml
7574
os: [ubuntu, windows]
76-
include:
77-
- {python-version: 3.13, os: ubuntu}
7875
steps:
7976
- uses: actions/checkout@v4
8077
with: {fetch-depth: 0, submodules: recursive}
8178
- if: matrix.os == 'windows'
8279
uses: ilammy/msvc-dev-cmd@v1
8380
- uses: conda-incubator/setup-miniconda@v3
8481
with:
85-
python-version: ${{ matrix.python-version }}
82+
python-version: 3.12
8683
mamba-version: "*"
8784
channels: conda-forge
8885
conda-remove-defaults: "true"
86+
- run: conda install 'conda-build>=25.3' conda-verify
8987
- name: conda build
90-
run: |
91-
if test ${{ matrix.python-version }} = 3.13; then
92-
BUILD_DEP=conda-build
93-
BUILD_CMD="conda build"
94-
else
95-
BUILD_DEP=boa
96-
BUILD_CMD="conda mambabuild"
97-
fi
98-
conda install $BUILD_DEP conda-verify
99-
$BUILD_CMD -c conda-forge --override-channels --output-folder dist recipe --python=${{ matrix.python-version }} --no-test
100-
$BUILD_CMD -c conda-forge --override-channels --test dist/*/ccpi-regulariser-*-cpu_*
88+
run: conda build -c conda-forge --override-channels --output-folder dist recipe --no-test
10189
- uses: actions/upload-artifact@v4
10290
with:
103-
name: ccpi-regulariser-py${{ matrix.python-version}}-${{ matrix.os }}
91+
name: ccpi-regulariser-${{ matrix.os }}
10492
path: dist/*/ccpi-regulariser-*
93+
conda-test:
94+
defaults: {run: {shell: 'bash -el {0}'}}
95+
runs-on: ${{ matrix.os }}-latest
96+
needs: conda-build
97+
strategy:
98+
matrix:
99+
python-version: ['3.10', 3.12] # min & max supported
100+
os: [ubuntu, windows]
101+
include:
102+
- {python-version: 3.13, os: ubuntu}
103+
steps:
104+
- uses: actions/checkout@v4
105+
- uses: conda-incubator/setup-miniconda@v3
106+
with:
107+
python-version: ${{ matrix.python-version }}
108+
mamba-version: "*"
109+
channels: conda-forge
110+
conda-remove-defaults: "true"
111+
- uses: actions/download-artifact@v4
112+
with:
113+
name: ccpi-regulariser-${{ matrix.os }}
114+
path: dist
115+
- run: conda install conda-build
116+
- name: conda test
117+
run: conda build -c conda-forge --override-channels --test dist/*/ccpi-regulariser-*-cpu_* --python=${{ matrix.python-version }}
105118
conda-upload:
106119
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
107120
defaults: {run: {shell: 'bash -el {0}', working-directory: dist}}
108121
runs-on: ubuntu-latest
109-
needs: conda-build
122+
needs: conda-test
110123
steps:
111124
- uses: actions/checkout@v4
112125
- uses: conda-incubator/setup-miniconda@v3
@@ -130,6 +143,6 @@ jobs:
130143
ssh -o StrictHostKeyChecking=no -i ./key ${{ secrets.STFC_SSH_HOST }} \
131144
'bash -lic "conda index --bz2 --zst --run-exports --channeldata --rss -n ccpi ${{ secrets.STFC_SSH_CONDA_DIR }}"'
132145
pass:
133-
needs: [test-cuda, test, conda-build]
146+
needs: [test-cuda, test, conda-test]
134147
runs-on: ubuntu-latest
135148
steps: [{run: echo success}]

recipe/conda_build_config.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
python:
2-
- 3.10
3-
- 3.11
4-
- 3.12
5-
- 3.13
61
cuda_compiler_version:
72
- None
83
- 12.9

recipe/meta.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# https://docs.conda.io/projects/conda-build/en/stable/resources/define-metadata.html#loading-data-from-other-files
22
# TODO: use scikit-build-core & setuptools_scm instead
33
{% set project = load_file_data('../src/Python/pyproject.toml', from_recipe_dir=True).get('project', {}) %}
4+
{% set python_min = "3.10" %}
45
{% set build_number = environ.get('GIT_DESCRIBE_NUMBER', 0) | int %}
56
{% if cuda_compiler_version != "None" %}
67
{% set build_number = build_number + 200 %}
@@ -13,6 +14,7 @@ package:
1314
build:
1415
preserve_egg_dir: False
1516
number: {{ build_number }}
17+
python_version_independent: true
1618
run_exports:
1719
- {{ pin_subpackage(project.get('name'), max_pin='x.x') }}
1820
- {{ project.get('name') }} =*=cuda* # [cuda_compiler_version != "None"]
@@ -24,8 +26,8 @@ build:
2426
script_env:
2527
- BUILD_CUDA=ON # [cuda_compiler_version != "None"]
2628
- BUILD_CUDA=OFF # [cuda_compiler_version == "None"]
27-
string: cuda{{ cuda_compiler_version | replace('.', '') }}_py{{ py }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda_compiler_version != "None"]
28-
string: cpu_py{{ py }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda_compiler_version == "None"]
29+
string: cuda{{ cuda_compiler_version | replace('.', '') }}_h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda_compiler_version != "None"]
30+
string: cpu_h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda_compiler_version == "None"]
2931

3032
source:
3133
path: ..
@@ -43,14 +45,14 @@ requirements:
4345
#- {{ compiler('cuda') }} # [cuda_compiler_version != "None"]
4446
- cuda-compiler ~={{ cuda_compiler_version }} # [cuda_compiler_version != "None"]
4547
host:
46-
- python
48+
- python {{ python_min }}
4749
- llvm-openmp
4850
- setuptools
4951
- pip
5052
- cuda-cccl # [cuda_compiler_version != "None"]
5153
- cuda-version {{ cuda_compiler_version }} # [cuda_compiler_version != "None"]
5254
run:
53-
- {{ pin_compatible('python', min_pin='x.x', max_pin='x') }}
55+
- python >={{ python_min }}
5456
{% for dep in project.get("dependencies") %}
5557
- {{ dep.lower() }}
5658
{% endfor %}

0 commit comments

Comments
 (0)