Skip to content

[Feature] Support padding for logits and unequal batch size for logits and bitmask #21

[Feature] Support padding for logits and unequal batch size for logits and bitmask

[Feature] Support padding for logits and unequal batch size for logits and bitmask #21

name: Build and upload to PyPI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
release:
types:
- published
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- {os: ubuntu-latest, arch: x86_64, build: 'cp*-manylinux*'}
- {os: ubuntu-24.04-arm, arch: aarch64, build: 'cp*-manylinux*'}
- {os: windows-latest, arch: AMD64, build: 'cp*'}
- {os: macos-14, arch: arm64, build: 'cp*'}
- {os: macos-13, arch: x86_64, build: 'cp*',}
steps:
- uses: astral-sh/setup-uv@v4
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_ARCHS_WINDOWS: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.build }}
CIBW_BUILD_VERBOSITY: 1
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: astral-sh/setup-uv@v4
- name: Build sdist
run: pipx run build --sdist
- name: Check metadata
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
attestations: write
if: github.event_name == 'release' && github.event.action == 'published'
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- name: Generate artifact attestation for sdist and wheels
uses: actions/attest-build-provenance@v1
with:
subject-path: dist/*
- uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
# repository-url: https://test.pypi.org/legacy/
# To test: repository-url: https://test.pypi.org/legacy/