Build and Deploy Package #37
Workflow file for this run
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 and Deploy Package | |
on: workflow_dispatch | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, macos-13, windows-latest] | |
env: | |
CIBW_BUILD: "cp37-* cp38-* cp39-* cp310-* cp311-* cp312-* cp313-* pp37-* pp38-* pp39-* pp310-*" | |
CIBW_SKIP: "cp36-* pp* *-win_arm64 *-musllinux_aarch64" | |
CIBW_ARCHS_LINUX: "x86_64 i686 aarch64" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Setup QEMU # Needed to build aarch64 wheels | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Build wheels | |
uses: pypa/[email protected] | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-main | |
path: ./wheelhouse/*.whl | |
build_wheels_macos_arm64: | |
name: Build ARM64 wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest] | |
cibw_archs: ["arm64"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: ${{ matrix.cibw_build }} | |
CIBW_SKIP: "cp36-* pp*" | |
CIBW_ARCHS: ${{ matrix.cibw_archs }} | |
CIBW_REPAIR_WHEEL_COMMAND: | | |
echo "Target delocate archs: {delocate_archs}" | |
ORIGINAL_WHEEL={wheel} | |
echo "Running delocate-listdeps to list linked original wheel dependencies" | |
delocate-listdeps --all $ORIGINAL_WHEEL | |
echo "Renaming .whl file when architecture is 'macosx_arm64'" | |
RENAMED_WHEEL=${ORIGINAL_WHEEL//x86_64/arm64} | |
echo "Wheel will be renamed to $RENAMED_WHEEL" | |
mv $ORIGINAL_WHEEL $RENAMED_WHEEL | |
echo "Running delocate-wheel command on $RENAMED_WHEEL" | |
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v $RENAMED_WHEEL | |
echo "Running delocate-listdeps to list linked wheel dependencies" | |
WHEEL_SIMPLE_FILENAME="${RENAMED_WHEEL##*/}" | |
delocate-listdeps --all {dest_dir}/$WHEEL_SIMPLE_FILENAME | |
echo "DONE." | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-macos-arm64 | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Build sdist | |
run: | | |
pip install build | |
python -m build . --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-sdist | |
path: dist/*.tar.gz | |
upload_pypi: | |
needs: [build_wheels, build_wheels_macos_arm64, build_sdist] | |
runs-on: ubuntu-22.04 | |
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
pattern: wheels-* | |
merge-multiple: true | |
- uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_api_token }} |