Experiment with a github action for publishing wheels #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
# 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 | |