Skip to content

chore: hatchling/hatch-vcs dynamic versioning, release CI, Makefile, and dev docs #1

chore: hatchling/hatch-vcs dynamic versioning, release CI, Makefile, and dev docs

chore: hatchling/hatch-vcs dynamic versioning, release CI, Makefile, and dev docs #1

Workflow file for this run

name: ci
on:
push:
branches: [main, master]
tags: ["v*.*.*"]
pull_request:
branches: [main, master]
env:
AWS_REGION: us-west-2
permissions:
contents: read
jobs:
build_package:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.build.outputs.VERSION }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- id: build
run: |
uv build
ls -1 dist/
echo "VERSION=$(uvx dunamai from git)" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: graphcore-build
path: dist/
if-no-files-found: error
tests:
needs: [build_package]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- uses: aws-actions/configure-aws-credentials@d979d5b3a71173a29b74b5b88418bfda9437d885 # v6.1.1
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
aws-region: ${{ env.AWS_REGION }}
- name: Authenticate to private PyPI
run: ./scripts/netrc_login.sh
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: graphcore-build
path: dist/
- name: Install from wheel
run: |
uv sync --group test --group ci
uv pip install --force-reinstall --no-deps dist/*.whl
- name: Run pytest
if: success() || failure()
run: make pytest
- name: Run pyright
if: success() || failure()
run: make pyright
codeartifact_pypi_upload:
name: AWS CodeArtifact PyPI Upload
needs: [build_package, tests]
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
- uses: aws-actions/configure-aws-credentials@d979d5b3a71173a29b74b5b88418bfda9437d885 # v6.1.1
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
aws-region: ${{ env.AWS_REGION }}
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: graphcore-build
path: dist/
- name: Upload package
env:
UV_PUBLISH_USERNAME: aws
run: |
export UV_PUBLISH_PASSWORD="$(aws codeartifact get-authorization-token --domain certora --domain-owner 092457480553 --region us-west-2 --query authorizationToken --output text)"
uv publish --index certora
- name: GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
with:
files: |
dist/*.whl
dist/*.tar.gz