Hotfix. Resolved wheel error. #96
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
# Build, test and publish sdist and wheels to PyPI | |
# Build and test run on every push | |
# Publish runs only on a tag push | |
name: Dists | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v1.* | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- name: Build wheels on Linux | |
os: ubuntu-latest | |
- name: Build wheels on MacOS | |
os: macos-latest | |
- name: Build wheels on Windows | |
os: windows-latest | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v3 | |
name: Install Python | |
with: | |
python-version: 3.9 | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
echo "::set-output name=dir::$(pip cache dir)" | |
- name: Get pip cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip | |
- name: Install cibuildwheel | |
run: | | |
python -m pip install cibuildwheel==2.12.1 | |
- name: Build wheels | |
env: | |
# Skip building on Python 2.7 | |
# Additionally, skip 32-bit Windows for now as MSVC needs seperate setup with different toolchain to do this | |
# Refer: https://cibuildwheel.readthedocs.io/en/stable/cpp_standards/#windows-and-python-27 | |
CIBW_SKIP: "*-win32" | |
CIBW_BEFORE_TEST: pip install -r tests/requirements.txt | |
CIBW_TEST_COMMAND: pytest {project}/tests | |
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64" # build on M1 chip | |
run: | | |
python -m cibuildwheel --output-dir dist | |
- uses: actions/upload-artifact@v3 | |
# All files are uploaded to the same location. Same-name files will be | |
# overwritten (fine for wheels, where same-name should mean same-data) | |
with: | |
name: dist | |
path: ./dist | |
build-sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v3 | |
name: Install Python | |
with: | |
python-version: 3.9 | |
- name: Build sdist | |
run: | | |
./setup.py sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: ./dist | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DoozyX/clang-format-lint-action@v0.12 | |
with: | |
source: "./include ./src" | |
clangFormatVersion: 12 | |
publish: | |
runs-on: ubuntu-latest | |
needs: [build] | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') | |
steps: | |
- uses: actions/download-artifact@v2 | |
with: | |
name: dist | |
path: dist/ | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} |