Skip to content

Commit

Permalink
conda: upgrade to use scikit-build-core and GitHub Workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
tvandera committed Jun 20, 2024
1 parent 195af50 commit cc82a1c
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 38 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build

on:
pull_request:
push:
branches:
- master

jobs:
conda-build:
name: Build Conda Package on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: 3.8
channels: conda-forge
activate-environment: devtools
environment-file: conda-recipes/devtools.yml
- run: conda info
- run: conda list
- run: conda config --show
- name: Conda Info
run: |
conda info
- run: git describe --tags
- name: Run 'conda build'
run: |
conda build -c vanderaa smurff
working-directory: conda-recipes
19 changes: 8 additions & 11 deletions conda-recipes/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
CONDA_BUILD_SYSROOT:
- /opt/MacOSX10.9.sdk # [osx]

python:
- 3.7
- 3.8
- 3.9
- 3.10
- 3.11

blas_impl:
- openblas
- mkl

numpy:
- 1.16
blas_impl: # [linux64 or win64]
- openblas # [linux64 or win64]
- mkl # [linux64 or win64]

hdf5:
- 1.10.4
- 1.10.6

c_compiler: vs2022 # [win]
cxx_compiler: vs2022 # [win]

pin_run_as_build:
libboost: x.x
numpy: x.x
hdf5: x.x.x
6 changes: 6 additions & 0 deletions conda-recipes/devtools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: devtools
channels:
- defaults
- conda-forge
dependencies:
- conda-build
17 changes: 8 additions & 9 deletions conda-recipes/smurff/bld.bat
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
REM SET "CMAKE_ARGS=-DENABLE_MKL=ON -DBoost_COMPILER=-vc140 -DCMAKE_INSTALL_PREFIX=%PREFIX%"
SET "CMAKE_ARGS=-DENABLE_MKL=ON -DCMAKE_INSTALL_PREFIX=%PREFIX%"
if "%blas_impl%"=="mkl" (
set "SKBUILD_CMAKE_ARGS=-DENABLE_MKL=ON -DENABLE_OPENBLAS=OFF"
) else (
set "SKBUILD_CMAKE_ARGS=-DENABLE_OPENBLAS=ON -DENABLE_MKL=OFF"
)

REM conda build sets "Visual Studio 15 2017 Win64" generator
REM which is incompatible with "-A x64" that we add ourselves in setup.py,
REM hence we remove " Win64"
SET "CMAKE_GENERATOR=%CMAKE_GENERATOR: Win64=%"
echo extra CMAKE_ARGS: %SKBUILD_CMAKE_ARGS%

%PYTHON% setup.py install ^
--install-binaries ^
--single-version-externally-managed --record=record.txt
%PYTHON% -m pip install . --no-deps -vv
if errorlevel 1 exit 1
18 changes: 10 additions & 8 deletions conda-recipes/smurff/build.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/bin/bash

export CMAKE_ARGS="-DENABLE_MKL=ON -DCMAKE_INSTALL_PREFIX=$PREFIX -DENABLE_MPI=OFF"
if [ "$blas_impl" == "mkl" ]
then
SKBUILD_CMAKE_ARGS="-DENABLE_MKL=ON -DENABLE_OPENBLAS=OFF"
else
SKBUILD_CMAKE_ARGS="-DENABLE_OPENBLAS=ON -DENABLE_MKL=OFF"
fi

# make sure we use CONDA_BUILD_SYSROOT
# https://github.com/conda/conda-build/issues/3452#issuecomment-47539707
[[ ${target_platform} == "osx-64" ]] && \
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_OSX_SYSROOT=${CONDA_BUILD_SYSROOT}"
echo "extra CMAKE_ARGS: $SKBUILD_CMAKE_ARGS"

$PYTHON setup.py install \
--install-binaries \
--single-version-externally-managed --record=record.txt
export SKBUILD_CMAKE_ARGS

$PYTHON -m pip install . --no-deps -vv
19 changes: 9 additions & 10 deletions conda-recipes/smurff/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,29 @@ requirements:
- llvm-openmp # [osx]
host:
- llvm-openmp # [osx]
- intel-openmp
- mkl-devel
- eigen3
- libboost
- mkl-devel # [blas_impl == 'mkl']
- openblas # [blas_impl != 'mkl']
- eigen
- libboost-devel
- pybind11
- highfive >=2.2
- h5py
- python {{ python }}
- setuptools
- scikit-build-core
- setuptools_scm
- numpy
run:
- python {{ python }}
- intel-openmp # [not win]
- mkl
- libboost # [not win]
- mkl # [blas_impl == 'mkl']
- openblas # [blas_impl != 'mkl']
- libboost # [not win]
- numpy
- scipy
- pandas
- scikit-learn
- hdf5
- h5py
- h5sparse-tensor >=0.2.2

test:
requires:
- setuptools
Expand Down

0 comments on commit cc82a1c

Please sign in to comment.