Skip to content

setup py project path in workspace #3

setup py project path in workspace

setup py project path in workspace #3

Workflow file for this run

name: Build and publish python wheels
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- ci/python-ci
tags:
- '*'
# TODO: Select the target package to build, based on the tag prefix
jobs:
build_wheels:
name: Build wheels on ${{ matrix.runner.os }}-${{ matrix.runner.arch }}
runs-on: ${{ matrix.runner.os }}
strategy:
matrix:
runner:
- os: ubuntu-latest
arch: x86_64
- os: ubuntu-latest
arch: aarch64
- os: ubuntu-latest
arch: i686
- os: ubuntu-latest
arch: ppc64le
- os: ubuntu-latest
arch: s390x
- os: windows-latest
arch: x86_64
- os: macos-13
arch: x86_64
- os: macos-latest
arch: arm64
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS_LINUX: ${{ matrix.runner.arch }}
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
CIBW_ARCHS_MACOS: 'x86_64 arm64'
CIBW_TEST_SKIP: '*-macosx_arm64'
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.runner.os }}-${{ matrix.runner.arch }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
strategy:
matrix:
# TODO: Auto-select targets packages to build
# And filter what gets build by cibuildwheel
package:
- 'quantinuum-hugr-py'
steps:
- uses: actions/checkout@v4
- name: Build sdist
run: |
cd ${{ matrix.package }}
pipx run build --sdist
- 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
if: github.event_name == 'push' && github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/py-v')
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
# TODO: Using a test endpoint
repository-url: https://test.pypi.org/legacy/