Skip to content

fix: prepare setup for windows #198

fix: prepare setup for windows

fix: prepare setup for windows #198

Workflow file for this run

name: Build, test
on:
[pull_request,workflow_dispatch,push]
jobs:
build_test:
name: Build and Test
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
os: ["ubuntu-latest", "macos-13", "macos-14",]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
# - name: Setup miniconda
# uses: conda-incubator/setup-miniconda@v3
# with:
# python-version: ${{ matrix.python-version }}
# mamba-version: "1.5"
# activate-environment: build_test_env
# channels: conda-forge
# channel-priority: true
- uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: 'latest'
# environment-file: environment.yml
# environment-name: build
init-shell: >-
bash
powershell
# cache-environment: true
# post-cleanup: 'all'
condarc: |
channels:
- conda-forge
- name: dependencies
shell: bash -el {0}
run: |
# conda install mamba -c conda-forge
micromamba create -n build python=${{matrix.python-version}} pip -c conda-forge
micromamba activate build
micromamba install boost-cpp 'gudhi>=3.10' 'numpy>=2' pot 'cython>=3' pytest scikit-learn matplotlib boost joblib tqdm scipy tbb tbb-devel -c conda-forge
pip install pykeops filtration-domination --upgrade
micromamba install c-compiler=1.6 cxx-compiler=1.6 -c conda-forge
# if [[ ${{ matrix.os }} =~ "ubuntu-".* ]]; then
# micromamba install cxx-compiler=1.6 -c conda-forge
# fi
# if [[ ${{ matrix.os }} =~ "windows-".* ]]; then
# micromamba install cxx-compiler=1.6 -c conda-forge
# fi
- name: Build package
shell: bash -el {0}
run: |
micromamba activate build
if [[ ${{ matrix.os }} =~ "macos-".* ]]; then
export CXXFLAGS="-fno-aligned-new" # Macos workaround
export CFLAGS="-fno-aligned-new" # Macos workaround
export MACOSX_DEPLOYMENT_TARGET="13.0"
fi
if [[ ${{ matrix.os }} =~ "ubuntu-".* ]]; then
export CXXFLAGS="-march=x86-64-v3" # post haswell, for avx
export CFLAGS="-march=x86-64-v3"
export CPPFLAGS="-isystem $CONDA_PREFIX/include"
fi
if [[ ${{ matrix.os }} =~ "windows-".* ]]; then
set LIBPATH=%LIBPATH%;C:\Miniconda\envs\build_test_env\Library\lib
fi
python setup.py build_ext -j4 --inplace bdist_wheel
- name: Fix wheels on Linux and Macos
shell: bash -el {0}
run: |
micromamba activate build
if [[ ${{ matrix.os }} =~ "ubuntu-".* ]]; then
cd dist
micromamba install auditwheel -c conda-forge
for wheel_file in multipers*linux*.whl; do
auditwheel show $wheel_file
auditwheel repair $wheel_file --plat manylinux_2_34_x86_64
rm $wheel_file
done
mv wheelhouse/*.whl . # retrieves repaired wheels
cd ..
fi
if [[ ${{ matrix.os }} == "macos-13" ]]; then
cd dist
micromamba install delocate -c conda-forge
for wheel_file in multipers*macosx*x86*.whl; do
delocate-listdeps $wheel_file
delocate-wheel --require-archs x86_64 -w wheelhouse -v $wheel_file
rm $wheel_file
done
mv wheelhouse/*.whl . # retrieves repaired wheels
cd ..
fi
if [[ ${{ matrix.os }} == "macos-14" ]]; then
cd dist
pip install delocate --upgrade
for wheel_file in multipers*macosx*arm64*.whl; do
delocate-listdeps $wheel_file
delocate-wheel --require-archs arm64 -w wheelhouse -v $wheel_file
rm $wheel_file
done
mv wheelhouse/*.whl . # retrieves repaired wheels
cd ..
fi
- name: Install and Test
shell: bash -el {0}
run: |
micromamba create -n test python=${{matrix.python-version}} pip pytest -c conda-forge
micromamba activate test
pip install dist/*.whl
pytest multipers/tests