Skip to content

2023-11-22

2023-11-22 #31

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.
name: Build and upload Python Packages
# on: [push]
on:
workflow_dispatch:
release:
types:
- published
# env:
# CIBW_BUILD: cp38* cp39* cp310*
# CIBW_ARCHS_MACOS: auto universal2
# CIBW_TEST_SKIP: "*universal2:arm64"
jobs:
build_sdist:
name: Build source package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install numpy setuptools
- name: Build source package with setuptools
run: python setup.py sdist
- name: Store the source package
uses: actions/upload-artifact@v2
with:
name: python-package-distributions
path: dist
# build_wheels:
# name: Build wheels on ${{ matrix.os }}
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# python-version: ["3.8", "3.9", "3.10"]
# os: [ubuntu-latest, macos-latest, windows-latest]
# steps:
# - uses: actions/checkout@v2
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# - uses: pypa/[email protected]
# - uses: actions/upload-artifact@v2
# with:
# name: python-package-distributions
# path: ./wheelhouse/*.whl
build_wheels:
name: Build binary package for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
os: [macos-latest, windows-latest]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install numpy wheel
- name: Build wheel with setuptools for ${{matrix.os}}
run: python setup.py bdist_wheel
- name: Store the binary wheel
uses: actions/upload-artifact@v2
with:
name: python-package-distributions
path: dist
upload_pypi:
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
with:
name: python-package-distributions
path: dist
- name: Publish pypi packages
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_BLUESKY }}