Skip to content

Commit

Permalink
cleaned up wheels, still erroring?
Browse files Browse the repository at this point in the history
  • Loading branch information
sgsellan committed Jun 1, 2024
1 parent f113d31 commit d2e469e
Showing 1 changed file with 28 additions and 146 deletions.
174 changes: 28 additions & 146 deletions .github/workflows/ciwheels.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: Pip build

# Run on the main branch and on tags (note conditional below)
on:
push:
branches:
- main
# tags:
# - v*
pull_request:
branches:
- main
Expand All @@ -31,178 +28,63 @@ jobs:
path: dist/*.tar.gz

build_wheels:

# Only run if the commit message contains '[ci build]' OR always run if it's a tag
# This will not respect the tag if it appears in a pull request commit message. Those builds always show up as 'synchronize' events, and there is no easy way to get the corresponding commit messages. We instead pull the PR title to check for tags.
# More info here: https://github.community/t/accessing-commit-message-in-pull-request-event/17158/13
# if: "contains(toJSON(github.event.commits.*.message), '[ci build]') || contains(toJSON(github.event.pull_request.title), '[ci build]') || contains(github.ref, 'refs/tags')"

strategy:
fail-fast: false
matrix:
# Launch separate job for each python. The build is so much longer than
# machine configuration/setup, so parallel builds will be faster. More
# importantly, github times out after 6 hours _per job_.

# debugging
# cpversion: [ "cp39"]
# os: [ { runs-on: ubuntu-latest, cibw-arch: manylinux_x86_64}]
cpversion: ["cp36", "cp37", "cp38", "cp39", "cp310", "cp311", "cp312"]
os: [ { runs-on: ubuntu-latest, cibw-arch: manylinux_x86_64, cibw-platform: manylinux2014}, { runs-on: macos-latest, cibw-arch: macosx_x86_64}, { runs-on: macos-latest, cibw-arch: macosx_arm64}, { runs-on: windows-latest, cibw-arch: win_amd64} ]
# cpversion: ["cp36"]
# os: [ { runs-on: windows-latest, cibw-arch: win_amd64}]
os:
- runs-on: ubuntu-latest
cibw-arch: manylinux_x86_64
cibw-platform: manylinux2014
- runs-on: macos-latest
cibw-arch: macosx_x86_64
cibw-platform: macosx_x86_64
- runs-on: macos-latest
cibw-arch: macosx_arm64
cibw-platform: macosx_arm64
- runs-on: windows-latest
cibw-arch: win_amd64
cibw-platform: win_amd64
exclude:
- os: { runs-on: macos-latest, cibw-arch: macosx_arm64}
- os: { runs-on: macos-latest, cibw-arch: macosx_arm64 }
cpversion: "cp36"
- os: { runs-on: macos-latest, cibw-arch: macosx_arm64}
- os: { runs-on: macos-latest, cibw-arch: macosx_arm64 }
cpversion: "cp37"



name: Build wheels ${{ matrix.cpversion }}-${{ matrix.os.cibw-arch }}
runs-on: ${{ matrix.os.runs-on }}


env:
CIBW_BUILD_VERBOSITY: 3
# This is very dubious... It *may* work because these are just cpp libraries that should not depend on the python version. Still, super-dubious.
# CIBW_BEFORE_BUILD_WINDOWS: "python -m pip install delvewheel; $rootPath = Join-Path -Path (Get-Location) -ChildPath 'build'; $folders = Get-ChildItem -Path $rootPath -Recurse -Directory; foreach ($folder in $folders) { $env:Path += \";$($folder.FullName)\" }"

# CIBW_BEFORE_BUILD_WINDOWS: |
# python .github/workflows/update-path.py
# python -m pip install delvewheel
# CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: |
# python .github/workflows/update-path.py
# python -m delvewheel repair --no-mangle-all -w {dest_dir} {wheel}
# CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "python -m delvewheel repair --no-mangle-all --add-path build\\temp.win-amd64-3.6\\Release;build\\temp.win-amd64-3.6\\Release\\Release;build\\temp.win-amd64-3.6\\Release\\_deps\\gmp-src\\lib;build\\temp.win-amd64-3.6\\Release\\_deps\\mpfr-src\\lib -w {dest_dir} {wheel} "
# CIBW_TEST_COMMAND_WINDOWS: "python -m pip install tetgen && cd /d {project} && python -m unittest -v"
# CIBW_TEST_COMMAND_MACOS: "python -m pip install tetgen && cd {project} && python -m unittest -v"
# CIBW_TEST_COMMAND_LINUX: "python -m pip install tetgen && cd {project} && python -m unittest -v"
# CIBW_TEST_COMMAND: "python -m pip install tetgen && python -m unittest -v"
# CIBW_BEFORE_BUILD_LINUX : "yum remove -y cmake && python -m pip install\ cmake && yum -y install gmp-devel\ mpfr-devel && python -m pip install numpy"
CIBW_BEFORE_BUILD_LINUX : "yum install -y libXrandr libXrandr-devel libXinerama libXinerama-devel libXcursor libXcursor-devel libXi libXi-devel"
CIBW_BEFORE_BUILD_LINUX: "yum install -y libXrandr libXrandr-devel libXinerama libXinerama-devel libXcursor libXcursor-devel libXi libXi-devel"
CIBW_BUILD: "${{ matrix.cpversion }}-${{ matrix.os.cibw-arch }}"
# CIBW_TEST_SKIP: "*-macosx_arm64"
CIBW_ENVIRONMENT: "MAX_JOBS=2"
# Why universal2 here? It's not included above in CIBW_BUILD
CIBW_ARCHS_MACOS: "x86_64 arm64 universal2"
CIBW_ENVIRONMENT_MACOS: "CMAKE_OSX_ARCHITECTURES=\"${{ matrix.os.cibw-arch == 'macosx_x86_64' && 'x86_64' || matrix.os.cibw-arch == 'macosx_arm64' && 'arm64' || matrix.os.cibw-arch == 'macosx_universal2' && 'arm64;x86_64' || '' }}\""
CIBW_ENVIRONMENT_MACOS: "CMAKE_OSX_ARCHITECTURES='${{ matrix.os.cibw-arch == 'macosx_x86_64' && 'x86_64' || matrix.os.cibw-arch == 'macosx_arm64' && 'arm64' || matrix.os.cibw-arch == 'macosx_universal2' && 'arm64;x86_64' || '' }}'"
MACOSX_DEPLOYMENT_TARGET: 10.16
# CIBW_PRERELEASE_PYTHONS: True


# env:
# CIBW_BUILD: "${{ matrix.cpversion }}-${{ matrix.os.cibw-arch }}"
# # CIBW_BUILD: cp37-*
# CIBW_BUILD_VERBOSITY: 3
# CIBW_ENVIRONMENT: "MAX_JOBS=2"
# CIBW_BEFORE_BUILD_LINUX : "yum remove -y cmake && python -m pip install\ cmake && yum -y install gmp-devel\ mpfr-devel && python -m pip install numpy"
# # CIBW_BEFORE_BUILD_MACOS: "python -m pip install cython numpy"
# CIBW_BEFORE_BUILD_MACOS: "python -m pip install numpy"
# CIBW_BEFORE_BUILD_WINDOWS: "python -m pip install numpy && python -m pip install delvewheel"
# # This is very dubious... It *may* work because these are just cpp libraries that should not depend on the python version. Still, super-dubious.
# CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "python -m delvewheel repair --no-mangle-all --add-path build\\temp.win-amd64-3.6\\Release;build\\temp.win-amd64-3.6\\Release\\Release;build\\temp.win-amd64-3.6\\Release\\_deps\\gmp-src\\lib;build\\temp.win-amd64-3.6\\Release\\_deps\\mpfr-src\\lib -w {dest_dir} {wheel} "
# # CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "cd C: && cmd //c tree //F"
# # CIBW_SKIP: "*-win32 *-manylinux_i686 pp*"
# MACOSX_DEPLOYMENT_TARGET: 10.15

CIBW_PLATFORM: ${{ matrix.os.cibw-platform }}

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Build wheels
uses: pypa/[email protected]


# - uses: actions/setup-python@v4
# name: Install Python
# with:
# python-version: '3.7'

# - name: Install cibuildwheel
# run: |
# python -m pip install --upgrade pip
# python -m pip install cibuildwheel==2.16

# - name: Add build subdirectories to PATH
# shell: pwsh
# if: runner.os == 'Windows'
# run: |
# $folder = "build"
# Get-ChildItem -Path $folder -Directory -Recurse | ForEach-Object {
# $env:Path += ";$($_.FullName)"
# }


# - name: Test
# run: |
# python -m pip install .

# - name: Configure cibuildwheel
# shell: bash
# run: |
# CMAKE_ARCH="${{ matrix.cibw-arch == 'win32' && '-A Win32' || '' }}"
# CMAKE_OSX_ARCHITECTURES=${{ matrix.cibw-arch == 'macosx_x86_64' && 'x86_64' || matrix.cibw-arch == 'macosx_arm64' && 'arm64' || matrix.cibw-arch == 'macosx_universal2' && '"arm64;x86_64"' || '' }}
# echo "CIBW_ARCHS_MACOS=x86_64 arm64 universal2" >> $GITHUB_ENV
# echo "CIBW_BUILD=${{ matrix.cpversion }}-${{ matrix.cibw-arch }}" >> $GITHUB_ENV
# echo "CIBW_ENVIRONMENT_MACOS=CMAKE_OSX_ARCHITECTURES=\"$CMAKE_OSX_ARCHITECTURES\"" >> $GITHUB_ENV

# This shouldn't be necessary
# - name: Install dependencies (Ubuntu)
# shell: bash -l {0}
# if: runner.os == 'Linux'
# run: |
# sudo apt-get update
# sudo apt-get upgrade
# sudo apt-get install \
# libmpfr-dev \
# libgmp-dev \

# - name: Package source distribution
# if: runner.os == 'Linux'
# run: |
# python setup.py sdist -d wheelhouse --formats=gztar

# - name: Build wheels
# run: |
# python -m cibuildwheel --output-dir wheelhouse
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.cpversion }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install cibuildwheel==2.17.0
# - name: Fix Windows wheels
# run: |
# python -m pip install delvewheel
# cd wheelhouse
# ls
# delvewheel repair *.whl
# python -m delvewheel repair *.whl
- name: Build wheels
run: cibuildwheel --output-dir wheelhouse

# Upload binaries to github
- uses: actions/upload-artifact@v3
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: |
./wheelhouse/*.whl
./wheelhouse/*.tar.gz
# # Push the resulting binaries to pypi on a tag starting with 'v'
# upload_pypi:
# needs: [build_wheels]
# runs-on: ubuntu-latest
# # upload to PyPI on every tag starting with 'v'
# # if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# # alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
# steps:
# - uses: actions/download-artifact@v3
# with:
# name: artifact
# path: dist

# - uses: pypa/[email protected]
# with:
# user: __token__
# password: ${{ secrets.pypi_password }}
# skip_existing: true
# # To test: repository_url: https://test.pypi.org/legacy/

0 comments on commit d2e469e

Please sign in to comment.