Skip to content

Commit 3702d91

Browse files
committed
Merge remote-tracking branch 'origin/main' into adamtheturtle/flask-response-delay
# Conflicts: # CHANGELOG.rst
2 parents 3412446 + 0e2ef17 commit 3702d91

5 files changed

Lines changed: 69 additions & 49 deletions

File tree

.github/workflows/release.yml

Lines changed: 62 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,18 @@ name: Release
44
on: workflow_dispatch
55

66
jobs:
7-
build:
8-
name: Publish a release
7+
release:
8+
name: Create release
99
runs-on: ubuntu-latest
1010

11-
# Specifying an environment is strongly recommended by PyPI.
12-
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
13-
environment: release
14-
1511
permissions:
16-
# This is needed for PyPI publishing.
17-
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
18-
id-token: write
1912
# This is needed for https://github.com/stefanzweifel/git-auto-commit-action.
2013
contents: write
2114

15+
outputs:
16+
version: ${{ steps.calver.outputs.release }}
17+
tag: ${{ steps.tag_version.outputs.new_tag }}
18+
2219
steps:
2320
- uses: actions/checkout@v6
2421
with:
@@ -36,12 +33,6 @@ jobs:
3633
# The default GITHUB_TOKEN cannot bypass rulesets.
3734
token: ${{ secrets.RELEASE_PAT }}
3835

39-
- name: Install uv
40-
uses: astral-sh/setup-uv@v7
41-
with:
42-
enable-cache: true
43-
cache-dependency-glob: '**/pyproject.toml'
44-
4536
- name: Calver calculate version
4637
uses: StephaneBour/actions-calver@master
4738
id: calver
@@ -102,10 +93,37 @@ jobs:
10293
name: Release ${{ steps.tag_version.outputs.new_tag }}
10394
body: ${{ steps.tag_version.outputs.changelog }}
10495

96+
pypi:
97+
name: Publish to PyPI
98+
needs: release
99+
runs-on: ubuntu-latest
100+
101+
# Specifying an environment is strongly recommended by PyPI.
102+
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
103+
environment: release
104+
105+
permissions:
106+
# This is needed for PyPI publishing.
107+
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
108+
id-token: write
109+
110+
steps:
111+
- uses: actions/checkout@v6
112+
with:
113+
ref: ${{ needs.release.outputs.tag }}
114+
# Fetch all history including tags.
115+
# Needed for setuptools-scm version detection.
116+
fetch-depth: 0
117+
persist-credentials: false
118+
119+
- name: Install uv
120+
uses: astral-sh/setup-uv@v7
121+
with:
122+
enable-cache: true
123+
cache-dependency-glob: '**/pyproject.toml'
124+
105125
- name: Build a binary wheel and a source tarball
106126
run: |
107-
git fetch --tags
108-
git checkout ${{ steps.tag_version.outputs.new_tag }}
109127
uv build --sdist --wheel --out-dir dist/
110128
uv run --extra=release check-wheel-contents dist/*.whl
111129
@@ -116,6 +134,29 @@ jobs:
116134
with:
117135
verbose: true
118136

137+
docker:
138+
name: Publish Docker image (${{ matrix.image.target }})
139+
needs: release
140+
runs-on: ubuntu-latest
141+
142+
strategy:
143+
matrix:
144+
image:
145+
- target: target-manager
146+
repo: adamtheturtle/vuforia-target-manager-mock
147+
- target: vws
148+
repo: adamtheturtle/vuforia-vws-mock
149+
- target: vwq
150+
repo: adamtheturtle/vuforia-vwq-mock
151+
152+
permissions: {}
153+
154+
steps:
155+
- uses: actions/checkout@v6
156+
with:
157+
ref: ${{ needs.release.outputs.tag }}
158+
persist-credentials: false
159+
119160
- name: Login to DockerHub
120161
uses: docker/login-action@v3
121162
with:
@@ -128,35 +169,13 @@ jobs:
128169
- name: Set up QEMU
129170
uses: docker/setup-qemu-action@v3
130171

131-
- name: Build and push target manager Docker image
132-
uses: docker/build-push-action@v6.19.2
133-
with:
134-
file: src/mock_vws/_flask_server/Dockerfile
135-
platforms: linux/amd64,linux/arm64
136-
push: true
137-
target: target-manager
138-
tags: |
139-
adamtheturtle/vuforia-target-manager-mock:latest
140-
adamtheturtle/vuforia-target-manager-mock:${{ steps.calver.outputs.release }}
141-
142-
- name: Build and push VWS Docker image
143-
uses: docker/build-push-action@v6.19.2
144-
with:
145-
file: src/mock_vws/_flask_server/Dockerfile
146-
platforms: linux/amd64,linux/arm64
147-
push: true
148-
target: vws
149-
tags: |
150-
adamtheturtle/vuforia-vws-mock:latest
151-
adamtheturtle/vuforia-vws-mock:${{ steps.calver.outputs.release }}
152-
153-
- name: Build and push VWQ Docker image
172+
- name: Build and push Docker image
154173
uses: docker/build-push-action@v6.19.2
155174
with:
156175
file: src/mock_vws/_flask_server/Dockerfile
157176
platforms: linux/amd64,linux/arm64
158177
push: true
159-
target: vwq
178+
target: ${{ matrix.image.target }}
160179
tags: |-
161-
adamtheturtle/vuforia-vwq-mock:latest
162-
adamtheturtle/vuforia-vwq-mock:${{ steps.calver.outputs.release }}
180+
${{ matrix.image.repo }}:latest
181+
${{ matrix.image.repo }}:${{ needs.release.outputs.version }}

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ search_path = [
361361
".",
362362
"src",
363363
]
364+
errors.non-exhaustive-match = "error"
364365

365366
[tool.pyright]
366367
enableTypeIgnoreComments = false

src/mock_vws/_flask_server/target_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def to_target_rater(self) -> TargetTrackingRater:
4545
return HardcodedTargetTrackingRater(rating=5)
4646
case self.RANDOM:
4747
return RandomTargetTrackingRater()
48-
49-
raise ValueError # pragma: no cover
48+
case _: # pragma: no cover
49+
raise ValueError
5050

5151

5252
@beartype

src/mock_vws/_flask_server/vwq.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ def to_image_matcher(self) -> ImageMatcher:
4646
return ExactMatcher()
4747
case self.STRUCTURAL_SIMILARITY:
4848
return StructuralSimilarityMatcher()
49-
50-
raise ValueError # pragma: no cover
49+
case _: # pragma: no cover
50+
raise ValueError
5151

5252

5353
@beartype

src/mock_vws/_flask_server/vws.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def to_image_matcher(self) -> ImageMatcher:
6060
return ExactMatcher()
6161
case self.STRUCTURAL_SIMILARITY:
6262
return StructuralSimilarityMatcher()
63-
64-
raise ValueError # pragma: no cover
63+
case _: # pragma: no cover
64+
raise ValueError
6565

6666

6767
@beartype

0 commit comments

Comments
 (0)