Skip to content

WIP: binary builds

WIP: binary builds #7

Workflow file for this run

name: example
on:
push:
branches: [ "master" ]
jobs:
build-sdist:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install build
run: |
python -m pip install --upgrade pip
pip install build cibuildwheel
- name: Create source dist
run: python -m build -s
- name: Publish source dist to github
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.tar.*
build-wheels-matrix:
runs-on: ubuntu-latest
outputs:
include: ${{ steps.set-matrix.outputs.include }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- run: pip install cibuildwheel==2.16.2
- id: set-matrix
run: |
MATRIX_INCLUDE=$(
{
cibuildwheel --print-build-identifiers --platform linux --arch x86_64,aarch64 | grep cp | jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \
&& cibuildwheel --print-build-identifiers --platform macos --arch x86_64,arm64 | grep cp | jq -nRc '{"only": inputs, "os": "macos-latest"}' \
&& cibuildwheel --print-build-identifiers --platform windows --arch x86,AMD64 | grep cp | jq -nRc '{"only": inputs, "os": "windows-latest"}'
} | jq -sc
)
echo "include=$MATRIX_INCLUDE" >> $GITHUB_OUTPUT
build-wheels:
needs: build-wheels-matrix
runs-on: ${{ matrix.os }}
name: Build ${{ matrix.only }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.build-wheels-matrix.outputs.include) }}
defaults:
run:
shell: bash
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 50
submodules: true
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
# with:
# platforms: arm64
# - name: Install macOS deps
# if: startsWith(matrix.os, 'macos')
# run: |
# brew install gnu-sed libtool autoconf automake
- name: Build wheels
uses: pypa/[email protected]
with:
only: ${{ matrix.only }}
env:
CIBW_BUILD_VERBOSITY: 1
- uses: actions/upload-artifact@v3
with:
name: dist
path: wheelhouse/*.whl
publish:
needs: [build-sdist, build-wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 5
submodules: false
- uses: actions/download-artifact@v3
with:
name: dist
path: dist/
#
# - name: Extract Release Version
# id: relver
# run: |
# set -e
# echo version=$(cat dist/VERSION) >> $GITHUB_OUTPUT
# rm dist/VERSION
#
# - name: Publish Github Release
# uses: elprans/gh-action-create-release@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: v${{ steps.relver.outputs.version }}
# release_name: v${{ steps.relver.outputs.version }}
# target: ${{ github.event.pull_request.base.ref }}
# body: ${{ github.event.pull_request.body }}
# draft: false
#
- run: |
ls -al dist/
# - name: Upload to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# # user: __token__
# # password: ${{ secrets.PYPI_TOKEN }}
# # password: ${{ secrets.TEST_PYPI_TOKEN }}
# repository_url: https://test.pypi.org/legacy/