Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 40 additions & 32 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -68,68 +68,76 @@ 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:
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
- 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: ${{ matrix.python-version }}
mamba-version: "*"
python-version: 3.12
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_*.tar.bz2
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 }}
path: dist/*/ccpi-regulariser-*.tar.bz2
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@v5
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge
conda-remove-defaults: "true"
- uses: actions/download-artifact@v5
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: 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
- run: conda install anaconda-client
- 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:
needs: [test-cuda, test, conda-build]
needs: [test-cuda, test, conda-test]
runs-on: ubuntu-latest
steps: [{run: echo success}]
5 changes: 0 additions & 5 deletions recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
python:
- 3.10
- 3.11
- 3.12
- 3.13
cuda_compiler_version:
- None
- 12.9
10 changes: 6 additions & 4 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -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 %}
Expand All @@ -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"]
Expand All @@ -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: ..
Expand All @@ -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 %}
Expand Down
Loading