Skip to content
Merged
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
68 changes: 48 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@ name: Release
on: workflow_dispatch

jobs:
build:
name: Publish a release
release:
name: Create release
runs-on: ubuntu-latest

# Specifying an environment is strongly recommended by PyPI.
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
environment: release

permissions:
# This is needed for PyPI publishing.
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
id-token: write
# This is needed for https://github.com/stefanzweifel/git-auto-commit-action.
contents: write

outputs:
version: ${{ steps.calver.outputs.release }}
tag: ${{ steps.tag_version.outputs.new_tag }}

steps:
- uses: actions/checkout@v6
with:
Expand All @@ -36,12 +33,6 @@ jobs:
# The default GITHUB_TOKEN cannot bypass rulesets.
token: ${{ secrets.RELEASE_PAT }}

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: '**/pyproject.toml'

- name: Calver calculate version
uses: StephaneBour/actions-calver@master
id: calver
Expand Down Expand Up @@ -102,10 +93,34 @@ jobs:
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}

pypi:
name: Publish to PyPI
needs: release
runs-on: ubuntu-latest

# Specifying an environment is strongly recommended by PyPI.
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
environment: release

permissions:
# This is needed for PyPI publishing.
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
id-token: write

steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.release.outputs.tag }}
persist-credentials: false

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: '**/pyproject.toml'

- name: Build a binary wheel and a source tarball
run: |
git fetch --tags
git checkout ${{ steps.tag_version.outputs.new_tag }}
uv build --sdist --wheel --out-dir dist/
uv run --extra=release check-wheel-contents dist/*.whl

Expand All @@ -116,6 +131,19 @@ jobs:
with:
verbose: true

docker:
name: Publish Docker images
needs: release
runs-on: ubuntu-latest

permissions: {}

steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.release.outputs.tag }}
persist-credentials: false

- name: Login to DockerHub
uses: docker/login-action@v3
with:
Expand All @@ -137,7 +165,7 @@ jobs:
target: target-manager
tags: |
adamtheturtle/vuforia-target-manager-mock:latest
adamtheturtle/vuforia-target-manager-mock:${{ steps.calver.outputs.release }}
adamtheturtle/vuforia-target-manager-mock:${{ needs.release.outputs.version }}

- name: Build and push VWS Docker image
uses: docker/build-push-action@v6.19.2
Expand All @@ -148,7 +176,7 @@ jobs:
target: vws
tags: |
adamtheturtle/vuforia-vws-mock:latest
adamtheturtle/vuforia-vws-mock:${{ steps.calver.outputs.release }}
adamtheturtle/vuforia-vws-mock:${{ needs.release.outputs.version }}

- name: Build and push VWQ Docker image
uses: docker/build-push-action@v6.19.2
Expand All @@ -159,4 +187,4 @@ jobs:
target: vwq
tags: |-
adamtheturtle/vuforia-vwq-mock:latest
adamtheturtle/vuforia-vwq-mock:${{ steps.calver.outputs.release }}
adamtheturtle/vuforia-vwq-mock:${{ needs.release.outputs.version }}
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ search_path = [
".",
"src",
]
errors.non-exhaustive-match = "error"

[tool.pyright]
enableTypeIgnoreComments = false
Expand Down
4 changes: 2 additions & 2 deletions src/mock_vws/_flask_server/target_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def to_target_rater(self) -> TargetTrackingRater:
return HardcodedTargetTrackingRater(rating=5)
case self.RANDOM:
return RandomTargetTrackingRater()

raise ValueError # pragma: no cover
case _: # pragma: no cover
raise ValueError


@beartype
Expand Down
4 changes: 2 additions & 2 deletions src/mock_vws/_flask_server/vwq.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def to_image_matcher(self) -> ImageMatcher:
return ExactMatcher()
case self.STRUCTURAL_SIMILARITY:
return StructuralSimilarityMatcher()

raise ValueError # pragma: no cover
case _: # pragma: no cover
raise ValueError


@beartype
Expand Down
4 changes: 2 additions & 2 deletions src/mock_vws/_flask_server/vws.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def to_image_matcher(self) -> ImageMatcher:
return ExactMatcher()
case self.STRUCTURAL_SIMILARITY:
return StructuralSimilarityMatcher()

raise ValueError # pragma: no cover
case _: # pragma: no cover
raise ValueError


@beartype
Expand Down