Skip to content

Commit

Permalink
fresh changes for the CI
Browse files Browse the repository at this point in the history
  • Loading branch information
peekxc committed Dec 5, 2023
1 parent 39468a3 commit 386d705
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 54 deletions.
62 changes: 19 additions & 43 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,31 @@ jobs:
build_windows_wheels:
name: Build ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
cibw_arch: ["AMD64"]
cibw_python: ["cp38-*", "cp39-*", "cp310-*", "cp311-*"]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true

# - name: Check Python version
# run: |
# case "${{ matrix.cibw_python }}" in
# "cp38-") export PYTHON_VERSION="3.8" ;;
# "cp39-") export PYTHON_VERSION="3.9" ;;
# "cp310-") export PYTHON_VERSION="3.10" ;;
# "cp311-") export PYTHON_VERSION="3.11" ;;
# esac
# echo "PYTHON_VERSION=${PYTHON_VERSION}" >> $GITHUB_ENV

- uses: actions/setup-python@v4
name: Install Python
with:
Expand Down Expand Up @@ -56,8 +66,10 @@ jobs:
python -m cibuildwheel --output-dir dist
env:
# define CC, CXX so meson will use clang-cl instead of MSVC
CC: clang-cl
CXX: clang-cl
# CC: clang-cl
# CXX: clang-cl
CC: gcc
CXX: g++
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_arch }}
# -Wl,-S equivalent to gcc's -Wl,--strip-debug
Expand Down Expand Up @@ -99,53 +111,17 @@ jobs:
- name: Build wheels for CPython Mac OS
run: |
# Make sure to use a libomp version binary compatible with the oldest
# supported version of the macos SDK as libomp will be vendored into
# the scikit-image wheels for macos. The list of binaries are in
# https://packages.macports.org/libomp/. Currently, the oldest
# supported macos version is: High Sierra / 10.13. When upgrading
# this, be sure to update the MACOSX_DEPLOYMENT_TARGET environment
# variable accordingly. Note that Darwin_17 == High Sierra / 10.13.
#
# We need to set both MACOS_DEPLOYMENT_TARGET and MACOSX_DEPLOYMENT_TARGET
# until there is a new release with this commit:
# https://github.com/mesonbuild/meson-python/pull/309
if [[ "$CIBW_ARCHS_MACOS" == arm64 ]]; then
# SciPy requires 12.0 on arm to prevent kernel panics
# https://github.com/scipy/scipy/issues/14688
# so being conservative, we just do the same here
export MACOSX_DEPLOYMENT_TARGET=12.0
export MACOS_DEPLOYMENT_TARGET=12.0
OPENMP_URL="https://anaconda.org/conda-forge/llvm-openmp/11.1.0/download/osx-arm64/llvm-openmp-11.1.0-hf3c4609_1.tar.bz2"
else
export MACOSX_DEPLOYMENT_TARGET=10.9
export MACOS_DEPLOYMENT_TARGET=10.9
OPENMP_URL="https://anaconda.org/conda-forge/llvm-openmp/11.1.0/download/osx-64/llvm-openmp-11.1.0-hda6cdc1_1.tar.bz2"
fi
echo MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}
echo MACOS_DEPLOYMENT_TARGET=${MACOS_DEPLOYMENT_TARGET}
# use conda to install llvm-openmp
# Note that we do NOT activate the conda environment, we just add the
# library install path to CFLAGS/CXXFLAGS/LDFLAGS below.
sudo conda create -n build $OPENMP_URL
PREFIX="/usr/local/miniconda/envs/build"
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
export CPPFLAGS="$CPPFLAGS -Xpreprocessor -fopenmp"
export CFLAGS="$CFLAGS -Wno-implicit-function-declaration -I$PREFIX/include"
export CXXFLAGS="$CXXFLAGS -I$PREFIX/include"
export LDFLAGS="$LDFLAGS -Wl,-S -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -lomp"
python -m cibuildwheel --output-dir dist
env:
CC: /usr/local/opt/llvm/bin/clang
CXX: /usr/local/opt/llvm/bin/clang
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }}
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
CIBW_MANYLINUX_I686_IMAGE: manylinux1
CIBW_TEST_SKIP: "*-macosx_arm64"
CIBW_TEST_REQUIRES: pytest pytest-cov coverage
CIBW_TEST_COMMAND: coverage run --source={package} -m pytest {package}/tests && coverage report -m
CIBW_TEST_COMMAND: python -m pytest tests/ --cov={package} --benchmark-skip && coverage report -m

- uses: actions/upload-artifact@v3
with:
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ setup = ['--default-library=static']
before-build = "sh tools/cibw_macos.sh"
# environment = { CXX = "/usr/local/opt/llvm/bin/clang", CC = "/usr/local/opt/llvm/bin/clang" }


[tool.cibuildwheel.windows]
# before-build = "sh tools/cibw_windows.sh"
before-build = "choco install rtools -y --no-progress --force --version=4.0.0.20220206 && set PATH=C:\\rtools40\\ucrt64\\bin\\;%PATH%"
Expand Down
50 changes: 40 additions & 10 deletions tools/cibw_macos.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/usr/bin/env bash

brew install --force libomp llvm openblas
rm -rf /usr/local/bin/2to3/*
brew install --force libomp llvm openblas

export CC=/usr/local/opt/llvm/bin/clang
export CXX=/usr/local/opt/llvm/bin/clang++
export CPPFLAGS="$CPPFLAGS -Xpreprocessor -fopenmp"
export CFLAGS="$CFLAGS -I$PREFIX/include"
export CFLAGS="$CFLAGS -Wno-implicit-function-declaration -I$PREFIX/include"
export CXXFLAGS="$CXXFLAGS -I$PREFIX/include"
export LDFLAGS="$LDFLAGS -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -lomp"
export LDFLAGS="$LDFLAGS -Wl,-S -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -lomp"

if [[ $(uname -m) == "arm64" && "$CIBW_BUILD" == "cp38-macosx_arm64" ]]; then
# Enables native building and testing for macosx arm on Python 3.8. For details see:
Expand All @@ -18,11 +19,40 @@ if [[ $(uname -m) == "arm64" && "$CIBW_BUILD" == "cp38-macosx_arm64" ]]; then
sh "/Applications/Python 3.8/Install Certificates.command"
fi

echo CXX VARIABLE:
echo $CXX
rm /usr/bin/clang
rm /usr/bin/clang++
ln -s $CC /usr/bin/clang
ln -s $CXX /usr/bin/clang++
alias clang=/usr/local/opt/llvm/bin/clang
alias clang++=/usr/local/opt/llvm/bin/clang++
echo CXX VARIABLE: $CXX
clang --version


# # Make sure to use a libomp version binary compatible with the oldest
# # supported version of the macos SDK as libomp will be vendored into
# # the scikit-image wheels for macos. The list of binaries are in
# # https://packages.macports.org/libomp/. Currently, the oldest
# # supported macos version is: High Sierra / 10.13. When upgrading
# # this, be sure to update the MACOSX_DEPLOYMENT_TARGET environment
# # variable accordingly. Note that Darwin_17 == High Sierra / 10.13.
# #
# # We need to set both MACOS_DEPLOYMENT_TARGET and MACOSX_DEPLOYMENT_TARGET
# # until there is a new release with this commit:
# # https://github.com/mesonbuild/meson-python/pull/309
# if [[ "$CIBW_ARCHS_MACOS" == arm64 ]]; then
# # SciPy requires 12.0 on arm to prevent kernel panics
# # https://github.com/scipy/scipy/issues/14688
# # so being conservative, we just do the same here
# export MACOSX_DEPLOYMENT_TARGET=12.0
# export MACOS_DEPLOYMENT_TARGET=12.0
# OPENMP_URL="https://anaconda.org/conda-forge/llvm-openmp/11.1.0/download/osx-arm64/llvm-openmp-11.1.0-hf3c4609_1.tar.bz2"
# else
# export MACOSX_DEPLOYMENT_TARGET=10.9
# export MACOS_DEPLOYMENT_TARGET=10.9
# OPENMP_URL="https://anaconda.org/conda-forge/llvm-openmp/11.1.0/download/osx-64/llvm-openmp-11.1.0-hda6cdc1_1.tar.bz2"
# fi
# echo MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}
# echo MACOS_DEPLOYMENT_TARGET=${MACOS_DEPLOYMENT_TARGET}

# # use conda to install llvm-openmp
# # Note that we do NOT activate the conda environment, we just add the
# # library install path to CFLAGS/CXXFLAGS/LDFLAGS below.
# sudo conda create -n build $OPENMP_URL
# PREFIX="/usr/local/miniconda/envs/build"
# export CC=/usr/bin/clang
# export CXX=/usr/bin/clang++

0 comments on commit 386d705

Please sign in to comment.