Skip to content

Commit

Permalink
setup py project path in workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q committed Apr 2, 2024
1 parent 20ebf16 commit a05f46a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 31 deletions.
51 changes: 27 additions & 24 deletions .github/workflows/python-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,55 +11,58 @@ on:
- '*'

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
build:
name: Build source distribution
runs-on: ubuntu-latest
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
package:
# This should be the same list as in `jobs.upload_pypi`.
- 'quantinuum-hugr-py'

steps:
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/[email protected]
- name: Build sdist and wheels
run: |
mkdir -p dist
pipx run build ${{ matrix.package }} --outdir dist
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build sdist
run: pipx run build --sdist
name: build-${{ matrix.package }}-sdist
path: dist/*.tar.gz

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
name: build-${{ matrix.package }}-wheel
path: dist/*.whl

upload_pypi:
needs: [build_wheels, build_sdist]
needs: [build]
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')
if: github.event_name == 'push' && github.ref_type == 'tag'
strategy:
matrix:
package:
# This should be the same list as in `jobs.build`.
- 'quantinuum-hugr-py'

steps:
- uses: actions/download-artifact@v4
- name: Download artifacts
if: startsWith(github.ref, 'refs/tags/${{ matrix.package }}-v')
uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
pattern: build-${{ matrix.package }}-*
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(github.ref, 'refs/tags/${{ matrix.package }}-v')
with:
# TODO: Using a test endpoint
repository-url: https://test.pypi.org/legacy/
11 changes: 6 additions & 5 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ name: Release-please 🐍

on:
workflow_dispatch: {}
push:
branches:
- main
- ci/python-ci
# TODO: Re-enable
#push:
# branches:
# - main
# - ci/python-ci

permissions:
contents: write
Expand All @@ -17,7 +18,7 @@ jobs:
name: Create release PR
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
- uses: google-github-actions/release-please-action@v4.1
with:
#path: "quantinuum-hugr-py"
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ name = "hugr-project"
version = "0.0.0"
authors = ["TKET development team <[email protected]>"]
readme = "README.md"
packages = []

packages = [{ include = "quantunuum_hugr", from = "quantunuum-hugr-py" }]
package-mode = false

[tool.poetry.group.main.dependencies]
Expand Down

0 comments on commit a05f46a

Please sign in to comment.