Skip to content

Commit 82ea186

Browse files
chore(deps): update jdx/mise-action action to v3.6.2 (#197)
1 parent 5e36182 commit 82ea186

File tree

9 files changed

+101
-135
lines changed

9 files changed

+101
-135
lines changed

.github/workflows/build-bin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6262

6363
- name: setup-mise
64-
uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
64+
uses: jdx/mise-action@e79ddf65a11cec7b0e882bedced08d6e976efb2d # v3.6.2
6565

6666
- name: verify-rust-toolchain
6767
# Workaround for Windows rustup bug: https://github.com/rust-lang/rustup/issues/3104

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1212

1313
- name: setup-mise
14-
uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
14+
uses: jdx/mise-action@e79ddf65a11cec7b0e882bedced08d6e976efb2d # v3.6.2
1515

1616
- name: setup-rust-toolchain
1717
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # stable

.github/workflows/publish-crates.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2121

2222
- name: setup-mise
23-
uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
23+
uses: jdx/mise-action@e79ddf65a11cec7b0e882bedced08d6e976efb2d # v3.6.2
2424

2525
- name: cache-publish
2626
env:

.github/workflows/publish-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4747

4848
- name: setup-mise
49-
uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
49+
uses: jdx/mise-action@e79ddf65a11cec7b0e882bedced08d6e976efb2d # v3.6.2
5050

5151
- name: verify-rust-toolchain
5252
# Workaround for Windows rustup bug: https://github.com/rust-lang/rustup/issues/3104

.github/workflows/security.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1515

1616
- name: run-trivy-dependency-scan
17-
uses: aquasecurity/trivy-action@e368e328979b113139d6f9068e03accaed98a518 # 0.34.1
17+
uses: aquasecurity/trivy-action@97e0b3872f55f89b95b2f65b3dbab56962816478 # 0.34.2
1818
with:
1919
scan-type: fs
2020
format: table
@@ -44,7 +44,7 @@ jobs:
4444
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4545

4646
- name: setup-mise
47-
uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
47+
uses: jdx/mise-action@e79ddf65a11cec7b0e882bedced08d6e976efb2d # v3.6.2
4848

4949
- name: run-cargo-audit
5050
run: |

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
run: echo "${{ matrix.python-version }}" > .python-version
4040

4141
- name: setup-mise
42-
uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
42+
uses: jdx/mise-action@e79ddf65a11cec7b0e882bedced08d6e976efb2d # v3.6.2
4343

4444
- name: verify-rust-toolchain
4545
# Workaround for Windows rustup bug: https://github.com/rust-lang/rustup/issues/3104
@@ -145,7 +145,7 @@ jobs:
145145
run: echo "${{ matrix.python-version }}" > .python-version
146146

147147
- name: setup-mise
148-
uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
148+
uses: jdx/mise-action@e79ddf65a11cec7b0e882bedced08d6e976efb2d # v3.6.2
149149

150150
- name: verify-rust-toolchain
151151
# Workaround for Windows rustup bug: https://github.com/rust-lang/rustup/issues/3104

Cargo.lock

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bakefile.py

Lines changed: 38 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
import shutil
2-
import subprocess
32
from pathlib import Path
4-
from typing import Annotated, get_args
3+
from typing import Annotated
54

65
import typer
76
import zerv
87
from bake import command, console
9-
from bakelib import PythonLibSpace as _PythonLibSpace
10-
from bakelib import RustLibSpace
11-
from bakelib.space.lib import BaseLibSpace, PublishResult
12-
from bakelib.space.python_lib import PyPIRegistry
13-
from bakelib.space.rust_lib import CratesRegistry
8+
from bakelib import PythonSpace, RustSpace
9+
from bakelib.publisher import Publisher
10+
from bakelib.publisher.crates import CratesPublisher
11+
from bakelib.publisher.pypi import PyPIPublisher as _PyPIPublisher
12+
from bakelib.space.lib import BaseLibSpace
13+
from bakelib.space.params import publish_token_option, publish_version_option
1414

1515
from tests.python.utils import symlink_zerv_to_venv_bin
1616

1717

18-
class PythonLibSpace(_PythonLibSpace):
18+
class PyPIPublisher(_PyPIPublisher):
19+
"""Custom PyPI publisher for zerv that uses maturin instead of uv build."""
20+
1921
_target: str | None = None
2022

21-
def _build_for_publish(self):
23+
def _build_for_publish(self) -> None:
2224
cmd = "maturin build --release --strip --out dist/"
2325

2426
if self._target:
@@ -27,31 +29,23 @@ def _build_for_publish(self):
2729
self.ctx.run(cmd)
2830

2931

30-
class MyBakebook(RustLibSpace, PythonLibSpace):
32+
class MyBakebook(RustSpace, PythonSpace, BaseLibSpace):
3133
zerv_test_native_git: bool = False
3234
zerv_test_docker: bool = True
3335
zerv_force_rust_log_off: bool = False
34-
__registry: CratesRegistry | PyPIRegistry | None = None
35-
36-
@property
37-
def _registry(self) -> CratesRegistry | PyPIRegistry:
38-
if self.__registry is None:
39-
raise RuntimeError("_registry not set")
40-
return self.__registry
41-
42-
@_registry.setter
43-
def _registry(self, value: str):
44-
self.__registry = self._validate_registry(value)
36+
_target: str | None = None
4537

46-
@property
47-
def _publish_impl(self) -> type[BaseLibSpace]:
48-
if self._registry in get_args(PyPIRegistry):
49-
return PythonLibSpace
50-
if self._registry in get_args(CratesRegistry):
51-
return RustLibSpace
52-
53-
valid = (*get_args(PyPIRegistry), *get_args(CratesRegistry))
54-
console.error(f"Invalid registry: {self._registry!r}. Expected one of {valid}.")
38+
def get_publisher(self, registry: str) -> PyPIPublisher | CratesPublisher:
39+
"""Return the appropriate publisher, using custom PyPIPublisher for maturin builds."""
40+
if registry in PyPIPublisher.valid_registries:
41+
publisher = PyPIPublisher(self.ctx, registry)
42+
publisher._target = self._target
43+
return publisher
44+
if registry in CratesPublisher.valid_registries:
45+
return CratesPublisher(self.ctx, registry)
46+
47+
valid = (*PyPIPublisher.valid_registries, *CratesPublisher.valid_registries)
48+
console.error(f"Invalid registry: {registry!r}. Expected one of {valid}.")
5549
raise typer.Exit(1)
5650

5751
def _update_config(self, **kwargs: bool | None) -> None:
@@ -145,54 +139,22 @@ def publish(
145139
str,
146140
typer.Option(help="Publish registry (test-pypi, pypi, or crates)"),
147141
] = "test-pypi",
148-
token: Annotated[str | None, typer.Option(help="Publish token")] = None,
149-
version: Annotated[str | None, typer.Option(help="Version to publish")] = None,
142+
token: publish_token_option = None,
143+
version: publish_version_option = None,
150144
target: Annotated[
151145
str | None,
152146
typer.Option(
153147
help="Rust target triple (e.g., aarch64-apple-darwin, x86_64-pc-windows-msvc)"
154148
),
155149
] = None,
156150
):
157-
self._registry = registry
158151
self._target = target
159-
return self._publish_impl.publish(
160-
self, registry=self._registry, token=token, version=version
161-
)
162-
163-
def _validate_registry(self, registry: str) -> CratesRegistry | PyPIRegistry: # type: ignore[invalid-method-override]
164-
if registry in get_args(PyPIRegistry):
165-
impl = PythonLibSpace
166-
elif registry in get_args(CratesRegistry):
167-
impl = RustLibSpace
168-
else:
169-
valid = (*get_args(PyPIRegistry), *get_args(CratesRegistry))
170-
console.error(f"Invalid registry: {registry!r}. Expected one of {valid}.")
171-
raise typer.Exit(1)
172-
173-
valid_registry = impl._validate_registry(self, registry)
174-
175-
return valid_registry
176-
177-
def _get_publish_token_from_remote(self, registry: str) -> str | None:
178-
return self._publish_impl._get_publish_token_from_remote(self, registry)
179-
180-
def _build_for_publish(self):
181-
return self._publish_impl._build_for_publish(self)
182-
183-
def _publish_with_token(self, token: str | None, registry: str) -> PublishResult:
184-
return self._publish_impl._publish_with_token(self, token, registry)
185-
186-
def _is_auth_failure(self, result: subprocess.CompletedProcess[str]) -> bool:
187-
return self._publish_impl._is_auth_failure(self, result)
188-
189-
def _is_already_exists_error(self, result: subprocess.CompletedProcess[str]) -> bool:
190-
return self._publish_impl._is_already_exists_error(self, result)
152+
return super().publish(registry=registry, token=token, version=version)
191153

192154
@property
193155
def _version(self) -> str:
194-
cargo_raw = RustLibSpace._version.fget(self)
195-
pyproject_raw = PythonLibSpace._version.fget(self)
156+
cargo_raw = RustSpace._version.fget(self)
157+
pyproject_raw = PythonSpace._version.fget(self)
196158

197159
pyproject_semver = zerv.render(version=pyproject_raw, output_format="semver")
198160
cargo_semver = zerv.render(version=cargo_raw, output_format="semver")
@@ -207,17 +169,21 @@ def _version(self) -> str:
207169

208170
@_version.setter
209171
def _version(self, value: str) -> None:
210-
RustLibSpace._version.fset(self, value)
211-
PythonLibSpace._version.fset(self, value)
172+
RustSpace._version.fset(self, value)
173+
PythonSpace._version.fset(self, value)
174+
175+
def _pre_publish_setup(self, publisher: Publisher) -> None:
176+
"""Custom pre-publish setup for zerv - handles both Rust and Python."""
177+
_ = publisher
212178

213-
def _pre_publish_setup(self):
214179
# zerv uses itself for versioning in _version_bump_context, so build and symlink it first
215180
self.ctx.run("maturin develop")
216181
if not self.ctx.dry_run:
217182
symlink_zerv_to_venv_bin()
218183

219-
RustLibSpace._pre_publish_setup(self)
220-
PythonLibSpace._pre_publish_setup(self)
184+
# Call BOTH publishers' setup (zerv is multi-lang)
185+
CratesPublisher._pre_publish_setup(self.ctx) # removes target/package
186+
PyPIPublisher._pre_publish_setup(self.ctx) # removes dist
221187

222188
# maturin
223189
for p in Path("python").glob("*.data"):

0 commit comments

Comments
 (0)