mirror of https://github.com/Nonannet/copapy.git
86 lines
2.1 KiB
YAML
86 lines
2.1 KiB
YAML
name: Build and Publish Wheels
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build_stencils:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ghcr.io/nonannet/cross_compiler_unix:2
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Build object files
|
|
run: bash tools/crosscompile.sh
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: stencil-object-files
|
|
path: src/copapy/obj/*.o
|
|
|
|
build_wheels:
|
|
if: contains(github.ref, '-beta') == false
|
|
needs: [build_stencils]
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: stencil-object-files
|
|
path: src/copapy/obj
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
# Only needed for Linux ARM builds
|
|
- name: Set up QEMU
|
|
if: runner.os == 'Linux'
|
|
uses: docker/setup-qemu-action@v2
|
|
with:
|
|
platforms: all
|
|
|
|
- name: Build wheels
|
|
uses: pypa/cibuildwheel@v3.3.0
|
|
env:
|
|
CIBW_ARCHS_LINUX: "x86_64 aarch64 armv7l" # i686
|
|
CIBW_ARCHS_MACOS: "x86_64 universal2"
|
|
CIBW_ARCHS_WINDOWS: "AMD64" # x86
|
|
CIBW_TEST_REQUIRES: "pytest"
|
|
CIBW_TEST_COMMAND: "pytest -m \"not runner\" {package}/tests/"
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: wheels-${{ matrix.os }}
|
|
path: wheelhouse/*.whl
|
|
|
|
publish:
|
|
if: contains(github.ref, '-beta') == false
|
|
needs: [build_wheels]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Install Twine
|
|
run: pip install --force-reinstall twine==6.2.0
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
path: wheelhouse
|
|
|
|
- name: Publish to PyPI
|
|
env:
|
|
TWINE_USERNAME: __token__
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
|
|
run: find wheelhouse -name "*.whl" -print0 | xargs -0 python -m twine upload
|