Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding cibuildwheel workflow to build and publish wheels #361

Merged
merged 39 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
852eb60
adding cibuildwheel workflow and attempting to fix macos builds
omar-h-omar Aug 26, 2023
b3f44d2
updating MACOSX_DEPLOYMENT_TARGET
omar-h-omar Aug 26, 2023
4547634
adding cmake setup step
omar-h-omar Aug 26, 2023
f1b3a9a
setting CIBW_ARCHS_WINDOWS to only target 64bit
omar-h-omar Aug 26, 2023
2c0cbd1
adding builds for macos arm and universal
omar-h-omar Aug 27, 2023
32a3ef3
adding a check for cmake version
omar-h-omar Aug 27, 2023
5b38596
requesting the latest cmake version and removing the CIBW_ARCHS_WINDOWS
omar-h-omar Aug 27, 2023
96d7022
removing step to install cmake and reverting to only 64bit windows build
omar-h-omar Aug 27, 2023
97e2521
trying to fix 32 bit builds
omar-h-omar Aug 28, 2023
d1779fc
testing CIBW_BEFORE_BUILD
omar-h-omar Aug 28, 2023
399cdbf
fixing syntax
omar-h-omar Aug 28, 2023
ed2da76
fixing syntax
omar-h-omar Aug 28, 2023
4341031
trying python instead python3
omar-h-omar Aug 28, 2023
6258471
fixing the CIBW_BEFORE_BUILD script
omar-h-omar Aug 28, 2023
2152801
changing command to be single line
omar-h-omar Aug 28, 2023
bfbd8e1
fix
omar-h-omar Aug 28, 2023
580aae6
revert
omar-h-omar Aug 28, 2023
195b24d
Merge branch 'devel' into cibuildwheel
omar-h-omar Aug 28, 2023
178e5b8
adding a job to build sdist and publish to pypi
omar-h-omar Sep 9, 2023
2045cb0
pointing to test pypi
omar-h-omar Sep 9, 2023
b74e70c
updating the python package name to match PyPi
omar-h-omar Sep 9, 2023
75c297d
fixing the upload of the source distribution
omar-h-omar Sep 9, 2023
d66c7b6
updating the version for testing
omar-h-omar Sep 9, 2023
f441a3b
Adding extra cmake args for windows 32 bit machines
omar-h-omar Sep 9, 2023
3d2a653
adding a simple test, configuring cibuildwheel to run test and pushin…
omar-h-omar Sep 10, 2023
b7845f7
adding numpy to test
omar-h-omar Sep 10, 2023
e7cfcd1
adding numpy as a test requirement
omar-h-omar Sep 10, 2023
41dfa51
fixing the path to the model
omar-h-omar Sep 10, 2023
374f371
replacing distutils's LooseVersion with packaging.version
omar-h-omar Sep 10, 2023
2585189
reverting the distutils changes and ignoring macosx tests on arm
omar-h-omar Sep 10, 2023
db65756
fixing yaml
omar-h-omar Sep 10, 2023
038c46a
adding flag to all numpy build without BLAS library
omar-h-omar Sep 27, 2023
d54d509
changing syntax to work with older pip versions
omar-h-omar Sep 27, 2023
75f03fe
skipping pypy
omar-h-omar Sep 30, 2023
bb66ed3
revert name change
omar-h-omar Sep 30, 2023
dc1e227
adding back numpy
omar-h-omar Sep 30, 2023
37d4a93
skip i686 build
omar-h-omar Sep 30, 2023
2e661b6
revert version
omar-h-omar Oct 1, 2023
21ae26c
building only only on master and removing the push to test pypi
omar-h-omar Oct 1, 2023
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
85 changes: 85 additions & 0 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: cibuildwheel build

on:
workflow_dispatch:
push:
branches:
- master
release:
types:
- published

jobs:
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel

- name: Build sdist
run: |
python setup.py sdist

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
path: dist/*.*

build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022, macOS-11]

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

# Used to host cibuildwheel
- uses: actions/setup-python@v3

- name: Use cmake
run: cmake --version

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.15.0

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
# to supply options, put them in 'env', like:
env:
MACOSX_DEPLOYMENT_TARGET: 10.15
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
CIBW_SKIP: pp* *i686
CIBW_TEST_REQUIRES: pytest numpy
CIBW_TEST_COMMAND: pytest {package}/tests
CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64"

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

upload_all:
needs: [build_wheels, make_sdist]
environment: pypi
permissions:
id-token: write
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def build_extension(self, ext):
build_args = ['--config', cfg]

if platform.system() == "Windows":
if platform.architecture()[0] == '32bit':
cmake_args += ['-A', 'Win32']
else:
cmake_args += ['-A', 'x64']
cmake_args += ['-G', 'Visual Studio 17 2022']
cmake_args += ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(cfg.upper(), extdir)]
build_args += ['--', '/m']
Expand Down
8 changes: 8 additions & 0 deletions tests/test_load_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import pytest
import eos
import numpy as np
from pathlib import Path

def test_load_model():
model = eos.morphablemodel.load_model(str(Path(__file__).resolve().parent.parent / 'share' / 'sfm_shape_3448.bin'))
assert model is not None