Skip to content

Build wheels and deploy #103

Build wheels and deploy

Build wheels and deploy #103

name: Build wheels and deploy
on:
# this workflow can only be manually triggered for now.
workflow_dispatch:
inputs:
deploy:
description: 'Where to deploy the artifacts? Only build (build), deploy to test PyPI (test), or deploy to PyPI (prod).'
required: true
type: choice
default: 'build'
options:
- build
- test
- prod
jobs:
build-wheels:
name: Build wheels ${{ matrix.os }} | ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest, ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- python-version: "3.8"
cibw_build: "cp38-*"
- python-version: "3.9"
cibw_build: "cp39-*"
- python-version: "3.10"
cibw_build: "cp310-*"
- python-version: "3.11"
cibw_build: "cp311-*"
- python-version: "3.12"
cibw_build: "cp312-*"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: |
python3 -m pip install --upgrade pip
- name: Install cibuildwheel
run: |
python3 -m pip install cibuildwheel
- name: Build wheels for CPython
run: |
CMAKE_BUILD_PARALLEL_LEVEL=4 python3 -m cibuildwheel --output-dir dist
env:
CIBW_BUILD_VERBOSITY: 3
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_SKIP: "*-manylinux_i686 *-musllinux_*"
MACOSX_DEPLOYMENT_TARGET: '12'
- uses: actions/upload-artifact@v2
with:
name: python-package-distributions
path: dist
publish-to-pypi:
runs-on: ubuntu-latest
needs:
- build-wheels
steps:
- name: Download wheels from previous jobs
# by default this will download all artifacts
uses: actions/download-artifact@v3
with:
name: python-package-distributions
# PyPI publish action uploads everything under dist/* by default
path: dist
- name: Display the list of artifacts
run: ls -R dist
- name: Publish to Test PyPI
if: github.event.inputs.deploy == 'test'
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN_PROJECTARIA_TOOLS }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
verbose: true
- name: Publish to PyPI
if: github.event.inputs.deploy == 'prod'
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN_PROJECTARIA_TOOLS_DEV }}
skip_existing: true
verbose: true