copapy/.github/workflows/build_wheels.yml

102 lines
2.6 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:1
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:
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: Install dependencies
# run: python -m pip install --upgrade pip cibuildwheel setuptools wheel pytest
- name: Build wheels (Linux)
if: matrix.os == 'ubuntu-latest'
uses: pypa/cibuildwheel@v2.11.4
env:
CIBW_ARCHS_LINUX: "x86_64 aarch64"
CIBW_TEST_REQUIRES: "pytest"
CIBW_TEST_COMMAND: "pytest {package}/tests/test_coparun_module.py"
- name: Build wheels (macOS)
if: matrix.os == 'macos-latest'
uses: pypa/cibuildwheel@v2.11.4
env:
CIBW_ARCHS_MACOS: "universal2"
CIBW_TEST_REQUIRES: "pytest"
CIBW_TEST_COMMAND: "pytest {package}/tests/test_coparun_module.py"
- name: Build wheels (Windows)
if: matrix.os == 'windows-latest'
uses: pypa/cibuildwheel@v2.11.4
env:
CIBW_ARCHS_WINDOWS: "AMD64 x86"
CIBW_TEST_REQUIRES: "pytest"
CIBW_TEST_COMMAND: "pytest {package}/tests/test_coparun_module.py"
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: wheelhouse/*.whl
# publish:
# needs: [build_wheels]
# runs-on: ubuntu-latest
# steps:
# - name: Install Twine
# run: pip install twine
# - uses: actions/download-artifact@v4
# with:
# path: wheelhouse
# - name: Publish to PyPI
# env:
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
#
# run: python -m twine upload wheelhouse/*