Skip to content

Commit

Permalink
Experiment with a github action for publishing wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
fselmo committed Feb 16, 2024
1 parent 25cc606 commit 19c15ab
Showing 1 changed file with 93 additions and 0 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/build_and_publish_wheels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Build Wheels

on:
push:
# TODO: Turn on when done testing:
# branches:
# - main
# tags:
# - 'v*'
# TODO: Turn off when done testing:
branches:
- 'add-c-kzg-4844-dep'

jobs:
build-wheels:
name: Build wheels on ${{ matrix.os }} for Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Initialize and update c-kzg-4844 submodule
run: |
git submodule update --init --recursive c-kzg-4844
- name: install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install cibuildwheel
- name: Setup MSYS2 for make on Windows
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
update: true
install: make

- name: install blst, ckzg, and python bindings
run: |
make -C ./c-kzg-4844/src blst
make -C ./c-kzg-4844/src
python -m pip install ./c-kzg-4844/bindings/python
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-*
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux_i686" # Skip all i686 wheels
# For macOS, build Universal 2 binaries if needed
CIBW_ARCHS_MACOS: "auto universal2"
# Update the manylinux image to a more recent version for broader compatibility
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014

- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl

publish-wheels:
needs: build-wheels
runs-on: ubuntu-latest
# TODO: Turn on when done testing
# if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: wheelhouse

# - name: Publish to PyPI
# uses: pypa/gh-action-pypi-publish@v1.4.2
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}
# packages_dir: wheelhouse

- name: Mock Publish to PyPI
run: |
twine check wheelhouse/*
twine upload --skip-existing --verbose --repository-url https://localhost:9999/ wheelhouse/*
env:
TWINE_USERNAME: dummy
TWINE_PASSWORD: dummy

0 comments on commit 19c15ab

Please sign in to comment.