Skip to content

Commit

Permalink
ci: setup release-please and build wheels in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q committed Apr 2, 2024
1 parent 8111375 commit 20ebf16
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 7 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/python-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build and publish python wheels

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- ci/python-ci
tags:
- '*'

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ubuntu-latest, windows-latest, macos-13, macos-14]

steps:
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/[email protected]

- 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

- 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/
24 changes: 24 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Automatic changelog and version bumping with release-please for python projects
name: Release-please 🐍

on:
workflow_dispatch: {}
push:
branches:
- main
- ci/python-ci

permissions:
contents: write
pull-requests: write

jobs:
release-please:
name: Create release PR
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
with:
#path: "quantinuum-hugr-py"
token: ${{ secrets.GITHUB_TOKEN }}
target-branch: ${{ github.event.ref }}
3 changes: 2 additions & 1 deletion .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Release-plz
# Automatic changelog, version bumping, and semver-checks with release-plz for rust projects
name: Release-plz 🦀

permissions:
pull-requests: write
Expand Down
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"quantinuum-hugr-py": "0.1.0a1"
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description = "Namespace for the python packages in the HUGR repository. See the individual packages for more information."
name = "hugr-project"
version = "0.0.0"
authors = []
authors = ["TKET development team <[email protected]>"]
readme = "README.md"
packages = []

Expand Down
22 changes: 17 additions & 5 deletions quantinuum-hugr-py/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
[tool.poetry]
classifiers = [
"Environment :: Console",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: Apache Software License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
]
name = "quantinuum_hugr"
version = "0.0.0"
version = "0.1.0a1"
description = "Quantinuum's common representation for quantum programs"
classifiers = [] # TODO
keywords = [] # TODO
authors = [] # TODO
maintainers = [] # TODO
#keywords = []
authors = ["TKET development team <[email protected]>"]
maintainers = ["Agustín Borgna <[email protected]>"]
license = "Apache-2.0"
readme = "README.md"
homepage = "https://github.com/CQCL/hugr"
Expand Down
57 changes: 57 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"include-component-in-tag": true,
"packages": {
"quantinuum-hugr-py": {
"release-type": "python",
"package-name": "quantinuum_hugr"
}
},
"changelog-sections": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "style",
"section": "Styling",
"hidden": true
},
{
"type": "chore",
"section": "Miscellaneous Chores",
"hidden": true
},
{
"type": "refactor",
"section": "Code Refactoring",
"hidden": true
},
{
"type": "test",
"section": "Tests",
"hidden": true
},
{
"type": "ci",
"section": "Continuous Integration",
"hidden": true
}
]
}
2 changes: 2 additions & 0 deletions release-plz.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Automatic changelog generation for rust projects

[workspace]
changelog_config = "cliff.toml" # use a custom git-cliff configuration
# disable the changelog for all packages
Expand Down

0 comments on commit 20ebf16

Please sign in to comment.