Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add workflow to build and upload Python wheels #262

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/build-wheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
on:
push:
tags:
- "v*"
branches:
- main

name: Create Python wheel and push to internal repo

jobs:
build-upload-hosted-wheels:
name: Build and upload wheels for hosted Github OSes
strategy:
matrix:
os: ['ubuntu-22.06']
runs-on: ${{ matrix.os }}

steps:

- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install cargo-edit (to update version number)
run: cargo install cargo-edit

- name: Cache poetry
uses: actions/[email protected]
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('**/poetry.lock') }}

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Set up Poetry
run: |
pip install poetry
poetry run pip install --upgrade pip
poetry install
- name: Update Cargo version based on tags
run: cargo set-version $(dunamai from any --style semver --bump)

- name: Build Python wheel for ${{ matrix.os }}
run: poetry run maturin build

- name: Upload Python wheel for ${{ matrix.os }}
run: poetry run maturin upload --repository-url "https://cqcpythonrepository.azurewebsites.net/"
env:
MATURIN_USERNAME: ${{ secrets.??? }}
MATURIN_PASSWORD: ${{ secrets.??? }}
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ readme = "README.md"
packages = [{ include = "tket2-py" }]

[tool.poetry.dependencies]
python = ">=3.10"
python = ">=3.10,<4.0"

[tool.poetry.dev-dependencies]
maturin = "^1.3.0"
pytket = "*"
pytest = "^7.1.2"
pytest-cov = "^4.1.0"
ruff = "^0.1.3"
dunamai = "^1.19.0"

[build-system]
requires = ["maturin~=1.3"]
Expand Down