PyPI Packages #163
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PyPI Packages | |
on: | |
push: | |
tags: | |
- 'v*.*' | |
workflow_dispatch: | |
jobs: | |
build_wheels: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- uses: pypa/[email protected] | |
env: | |
CIBW_SKIP: "cp36-* cp37-* pp* *_ppc64le *_s390x" | |
CIBW_ARCHS_MACOS: "x86_64 universal2" | |
CIBW_BEFORE_ALL_LINUX: > | |
yum install -y wget || apk add qhull-dev; | |
wget https://github.com/qhull/qhull/archive/refs/tags/v8.0.2.tar.gz && | |
tar -xf v8.0.2.tar.gz && | |
cd qhull-8.0.2 && | |
cmake -S . -B build && | |
cmake --build build --target install | |
CIBW_BEFORE_ALL_MACOS: brew install qhull | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/gdstk*.whl | |
build_windows: | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
name: Build wheels for Windows (${{ matrix.python-version }}) | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- uses: ilammy/msvc-dev-cmd@v1 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install build dependencies (pip) | |
run: | | |
pip install --upgrade pip setuptools wheel | |
pip install pip-tools ninja conan==1.60 | |
python -m piptools compile --resolver=backtracking -o requirements.txt pyproject.toml | |
pip install -r requirements.txt | |
- name: Install build dependencies (conan) | |
run: | | |
conan install . -s compiler.version=16 | |
- name: Build Python ${{ matrix.python-version }} wheel | |
run: python setup.py bdist_wheel | |
env: | |
CMAKE_GENERATOR: "Ninja" | |
CMAKE_TOOLCHAIN_FILE: "conan_paths.cmake" | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: "dist/gdstk*.whl" | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
upload_pypi: | |
name: Upload wheel to PyPI | |
needs: [build_sdist, build_wheels, build_windows] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |