Skip to content

build_deploy

build_deploy #81

Workflow file for this run

name: build_deploy
on:
release:
types: [published]
jobs:
build_extension:
name: Build extension
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Create virtual environment and install dependencies
run: |
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip setuptools Cython numpy
- name: Build Cython extensions
run: |
source venv/bin/activate
python setup.py build_ext --inplace
make_sdist:
needs: build_extension
name: Make source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create virtual environment and install dependencies
run: |
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip Cython numpy
- name: Build source distribution
run: |
source venv/bin/activate
python setup.py sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
build_wheels:
needs: make_sdist
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macos-12]
steps:
- uses: actions/checkout@v4
- name: Create virtual environment and install dependencies
run: |
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip Cython numpy
- name: Build wheels
run: |
source venv/bin/activate
python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
publish-to-pypi:
needs: [ build_wheels, make_sdist ]
name: Publish to PyPI
runs-on: ubuntu-latest
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Create virtual environment and install Twine
run: |
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip twine
- name: Publish distribution to PyPI
run: |
source venv/bin/activate
twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}