Skip to content

Commit

Permalink
CI build wheels and upload (#146)
Browse files Browse the repository at this point in the history
* build wheels

* should work for linux and maybe macos

* remove windows for now

* only linux for now

* test upload to pypi (test)

* add build dependencies

* add back macos

* trying something else for macos

* don't build for python 3.10 for now

* forgot to add to commit

* switching to oldest_supported_numpy

* skip pypy builds because of numpy issues

* getting started with windows build

* trying escaped double quotes

* try to install with conda

* forgot pyproject

* fix lib dir for windows

* clean up macos with symlinks

* another try

* back to what works

* Addressing Uwe's comments

* trying new windows formatting

* trying CXX flags

* jemalloc-local for linux and new syntax for windows

* using include for windows instead of CFLAGS

* focus on windows for now

* double backslash?

* backslash...

* now taking care of macos

* jemalloc cannot build docs when prefixed

* fix read-only error on macos and re-enable linux wheel build

* missed a comma

* new path for included headers

* use older linux image to improve compatibility

* added changelog and testpypi step before sending to pypi
  • Loading branch information
MarcAntoineSchmidtQC authored Nov 3, 2021
1 parent 0620786 commit 3c0de79
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 2 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build and upload to PyPI

on:
pull_request:
release:
types:
- published

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-10.15, windows-2019]

steps:
- uses: actions/checkout@v2

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

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

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.8'

- name: Install build dependencies
run: python -m pip install setuptools setuptools-scm wheel mako numpy Cython

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

- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz

upload_testpypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

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

upload_pypi:
needs: [build_wheels, build_sdist, upload_testpypi]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.GH_PYPI_UPLOAD }}
repository_url: https://pypi.org/legacy/
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
Changelog
=========

3.0.4 - 2021-11-03
------------------

**Other changes**

- tabmat is now available on PyPI and will be automatically updated when a new release is published.

3.0.3 - 2021-10-15
------------------

Expand Down
55 changes: 54 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ requires = [
'setuptools-scm',
'wheel',
'mako',
'numpy',
'oldest-supported-numpy',
'Cython',
]

Expand All @@ -27,3 +27,56 @@ line_length = 88
known_first_party = "tabmat"
skip_glob = '\.eggs/*,\.git/*,\.venv/*,build/*,dist/*'
default_section = 'THIRDPARTY'

[tool.cibuildwheel]
skip = ["cp310-*", "pp*"]
test-requires = ["pytest", "pytest-xdist"]

[tool.cibuildwheel.macos]
before-all = [
"brew install llvm libomp",
"cd ~/",
"git clone --branch 5.2.1 https://github.com/jemalloc/jemalloc.git",
"cd jemalloc",
"./autogen.sh --disable-cxx --with-jemalloc-prefix=local --with-install-suffix=local",
"make",
"make install_bin install_include install_lib",
"cd ~/",
"git clone --branch 7.6.0 https://github.com/xtensor-stack/xsimd.git",
"cd xsimd",
"mkdir build",
"cd build",
"cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..",
"make install"
]

[tool.cibuildwheel.macos.environment]
LDFLAGS="-L/usr/local/lib"
CFLAGS="-I/usr/local/include"
CXX="/usr/local/opt/llvm/bin/clang++"
CC="/usr/local/opt/llvm/bin/clang"

[tool.cibuildwheel.windows]
before-all = [
"C:\\Miniconda\\condabin\\conda install -c conda-forge xsimd",
]

[tool.cibuildwheel.windows.environment]
INCLUDE="C:\\\\Miniconda\\\\Library\\\\include"

[tool.cibuildwheel.linux]
before-all = [
"cd ~/",
"git clone --branch 5.2.1 https://github.com/jemalloc/jemalloc.git",
"cd jemalloc",
"./autogen.sh --disable-cxx --with-jemalloc-prefix=local --with-install-suffix=local",
"make",
"make install_bin install_include install_lib",
"cd ~/",
"git clone --branch 7.6.0 https://github.com/xtensor-stack/xsimd.git",
"cd xsimd",
"mkdir build",
"cd build",
"cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..",
"make install"
]
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
]
extra_link_args = ["-fopenmp"]


architecture = os.environ.get("GLM_ARCHITECTURE", "native")
if architecture != "default":
# Don't set "-march=native" on macOS arm64 as this doesn't exist there.
Expand Down

0 comments on commit 3c0de79

Please sign in to comment.