copapy/.github/workflows/build_wheels.yml

88 lines
2.3 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
# run: cibuildwheel --output-dir wheelhouse
uses: pypa/cibuildwheel@v2.11.4
env:
# Multi-arch builds
CIBW_ARCHS_LINUX: ${{ matrix.os == 'ubuntu-latest' && 'x86_64' || '' }} # aarch64
CIBW_ARCHS_MACOS: ${{ matrix.os == 'macos-latest' && 'universal2' || '' }}
CIBW_ARCHS_WINDOWS: ${{ matrix.os == 'windows-latest' && '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/*