-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Add workflow to build and upload Python wheels
Changes: * New workflow runs when a tag is created, and when there's a push to main. * Workflow builds Python wheels using maturin, and uses dunamai to make sure that wheels for non-tag pushes have sensible versions (with 'dev' in them as appropriate). * Workflow also uploads the wheels to our private Python repo. Still to do: * Sort out the credentials for the uploads.
- Loading branch information
1 parent
5d213b7
commit c4ee567
Showing
2 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
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
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.??? }} |
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