Skip to content

Commit 0b2e190

Browse files
committed
update lock
1 parent 13f0f06 commit 0b2e190

File tree

5 files changed

+250
-22
lines changed

5 files changed

+250
-22
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Mise Checksums Check
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- mise.toml
7+
- mise.lock
8+
9+
jobs:
10+
check-mise-checksums:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
15+
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@0c5e2b8115b80b4c7c5ddf6ffdd634974642d182 # v5.4.1
18+
19+
- name: Check mise.lock checksums
20+
run: uv run ci/check_mise_checksums.py

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
## Added
1010
- Added new `!concat` generator to the `templated_json` payload generator.
11+
- Use `mise` for tooling management
1112

1213
## [0.31.2]
1314
## Changed
@@ -28,7 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2829
- **Breaking Change**: Rename `lost_bytes` to `missed_bytes` in `logrotate_fs`.
2930
This reflects preexisting terminology.
3031
- **Breaking Change**: Replace `opentelemetry_traces` payload with a brand-new
31-
service topology-based configuration scheme. This allows for defining an
32+
service topology-based configuration scheme. This allows for defining an
3233
imaginary distributed system -- service type, operations, attributes, etc --
3334
which is then simulated to generate realistic-looking traces and spans.
3435
## Added

ci/check_mise_checksums.py

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
#!/usr/bin/env python3
2+
# /// script
3+
# requires-python = ">=3.11"
4+
# dependencies = ["tomlkit"]
5+
# ///
6+
"""Check that mise.lock has checksums for all tools on all required platforms.
7+
8+
Usage:
9+
uv run ci/check_mise_checksums.py # Report missing checksums
10+
uv run ci/check_mise_checksums.py --fix # Download and add missing checksums
11+
"""
12+
13+
import hashlib
14+
import sys
15+
import tempfile
16+
import urllib.request
17+
from dataclasses import dataclass
18+
from pathlib import Path
19+
20+
import tomlkit
21+
22+
REQUIRED_PLATFORMS = ("macos-arm64", "linux-arm64", "linux-x64")
23+
LOCK_FILE = Path(__file__).resolve().parent.parent / "mise.lock"
24+
25+
26+
@dataclass
27+
class MissingChecksum:
28+
tool: str
29+
platform: str
30+
url: str
31+
32+
33+
@dataclass
34+
class FixFailure:
35+
entry: MissingChecksum
36+
reason: str
37+
38+
39+
def fetch_checksum(url: str) -> str | None:
40+
"""Download a URL and return its sha256 checksum."""
41+
try:
42+
with tempfile.NamedTemporaryFile() as tmp:
43+
with urllib.request.urlopen(url) as resp:
44+
while chunk := resp.read(8192):
45+
tmp.write(chunk)
46+
tmp.seek(0)
47+
return hashlib.sha256(tmp.read()).hexdigest()
48+
except Exception as e:
49+
print(f" FAILED to fetch {url}: {e}", file=sys.stderr)
50+
return None
51+
52+
53+
def fix_lockfile(missing: list[MissingChecksum]) -> list[FixFailure]:
54+
"""Download artifacts and insert checksums into mise.lock."""
55+
doc = tomlkit.parse(LOCK_FILE.read_text())
56+
failures: list[FixFailure] = []
57+
58+
for entry in missing:
59+
print(f" Fetching {entry.tool} ({entry.platform})... ", end="", flush=True)
60+
checksum = fetch_checksum(entry.url)
61+
if checksum is None:
62+
failures.append(FixFailure(entry, "failed to download artifact"))
63+
continue
64+
print("done")
65+
66+
# Walk the parsed TOML to find the matching platform table and insert the checksum.
67+
tool_key = entry.tool.rsplit("@", 1)[0]
68+
platform_key = f"platforms.{entry.platform}"
69+
patched = False
70+
for tool_entry in doc["tools"][tool_key]:
71+
if platform_key in tool_entry and tool_entry[platform_key].get("url") == entry.url:
72+
tool_entry[platform_key]["checksum"] = f"sha256:{checksum}"
73+
patched = True
74+
break
75+
if not patched:
76+
failures.append(FixFailure(entry, "could not locate entry in lockfile"))
77+
78+
LOCK_FILE.write_text(tomlkit.dumps(doc))
79+
print(f"\nUpdated {LOCK_FILE.name}.")
80+
return failures
81+
82+
83+
def main() -> int:
84+
fix_mode = "--fix" in sys.argv
85+
86+
doc = tomlkit.parse(LOCK_FILE.read_text())
87+
88+
missing_platform: list[str] = []
89+
missing_checksum: list[MissingChecksum] = []
90+
91+
for tool_name, entries in doc.get("tools", {}).items():
92+
if not isinstance(entries, list):
93+
entries = [entries]
94+
95+
for entry in entries:
96+
version = entry.get("version", "unknown")
97+
label = f"{tool_name}@{version}"
98+
99+
for platform in REQUIRED_PLATFORMS:
100+
key = f"platforms.{platform}"
101+
if key not in entry:
102+
missing_platform.append(f"{label}: missing platform '{platform}'")
103+
elif "checksum" not in entry[key]:
104+
url = entry[key].get("url", "")
105+
missing_checksum.append(MissingChecksum(label, platform, url))
106+
107+
errors = missing_platform + [
108+
f"{m.tool}: missing checksum for '{m.platform}'" for m in missing_checksum
109+
]
110+
111+
if errors:
112+
print(f"Found {len(errors)} issue(s) in {LOCK_FILE.name}:\n")
113+
for err in errors:
114+
print(f" - {err}")
115+
print()
116+
117+
if missing_platform:
118+
print(
119+
"Note: missing platforms cannot be auto-fixed. "
120+
"Run `mise lock` to regenerate the lockfile."
121+
)
122+
123+
if fix_mode and missing_checksum:
124+
print(f"Fixing {len(missing_checksum)} missing checksum(s)...\n")
125+
failures = fix_lockfile(missing_checksum)
126+
if failures:
127+
print(f"\n{len(failures)} fix(es) failed:")
128+
for f in failures:
129+
print(f" - {f.entry.tool} ({f.entry.platform}): {f.reason}")
130+
return 1
131+
return 1 if missing_platform else 0
132+
133+
return 1 if errors else 0
134+
135+
136+
if __name__ == "__main__":
137+
sys.exit(main())

mise.lock

Lines changed: 87 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,113 @@
1+
# @generated - this file is auto-generated by `mise lock` https://mise.jdx.dev/dev-tools/mise-lock.html
2+
13
[[tools.actionlint]]
24
version = "1.7.3"
35
backend = "aqua:rhysd/actionlint"
4-
"platforms.linux-arm64" = { checksum = "sha256:5fd82142c39208bfdc51b929ff9bd84c38bcc10b4362ef2261a5d70d38e68e05", url = "https://github.com/rhysd/actionlint/releases/download/v1.7.3/actionlint_1.7.3_linux_arm64.tar.gz"}
5-
"platforms.linux-x64" = { checksum = "sha256:37252b4d440b56374b0fc1726e05fd7452d30d6d774f6e9b52e65bb64475f9db", url = "https://github.com/rhysd/actionlint/releases/download/v1.7.3/actionlint_1.7.3_linux_amd64.tar.gz"}
6-
"platforms.macos-arm64" = { checksum = "sha256:b4e8dab8dda48eceff6afea67d0fe4a14b8d4ea7191cf233c1e1af8a62f37c24", url = "https://github.com/rhysd/actionlint/releases/download/v1.7.3/actionlint_1.7.3_darwin_arm64.tar.gz"}
6+
7+
[tools.actionlint."platforms.linux-arm64"]
8+
checksum = "sha256:5fd82142c39208bfdc51b929ff9bd84c38bcc10b4362ef2261a5d70d38e68e05"
9+
url = "https://github.com/rhysd/actionlint/releases/download/v1.7.3/actionlint_1.7.3_linux_arm64.tar.gz"
10+
11+
[tools.actionlint."platforms.linux-x64"]
12+
checksum = "sha256:37252b4d440b56374b0fc1726e05fd7452d30d6d774f6e9b52e65bb64475f9db"
13+
url = "https://github.com/rhysd/actionlint/releases/download/v1.7.3/actionlint_1.7.3_linux_amd64.tar.gz"
14+
15+
[tools.actionlint."platforms.macos-arm64"]
16+
checksum = "sha256:b4e8dab8dda48eceff6afea67d0fe4a14b8d4ea7191cf233c1e1af8a62f37c24"
17+
url = "https://github.com/rhysd/actionlint/releases/download/v1.7.3/actionlint_1.7.3_darwin_arm64.tar.gz"
718

819
[[tools."aqua:EmbarkStudios/cargo-deny"]]
920
version = "0.19.0"
1021
backend = "aqua:EmbarkStudios/cargo-deny"
11-
"platforms.linux-arm64" = { checksum = "sha256:2b3567a60b7491c159d1cef8b7d8479d1ad2a31e29ef49462634ad4552fcc77d", url = "https://github.com/EmbarkStudios/cargo-deny/releases/download/0.19.0/cargo-deny-0.19.0-aarch64-unknown-linux-musl.tar.gz"}
12-
"platforms.linux-x64" = { checksum = "sha256:0e8c2aa59128612c90d9e09c02204e912f29a5b8d9a64671b94608cbe09e064f", url = "https://github.com/EmbarkStudios/cargo-deny/releases/download/0.19.0/cargo-deny-0.19.0-x86_64-unknown-linux-musl.tar.gz"}
13-
"platforms.macos-arm64" = { checksum = "sha256:a22f2023c06f3eefd099a5d42dd828fd4fa74d1e1c167bd1dbc3cf59ad62ded0", url = "https://github.com/EmbarkStudios/cargo-deny/releases/download/0.19.0/cargo-deny-0.19.0-aarch64-apple-darwin.tar.gz"}
22+
23+
[tools."aqua:EmbarkStudios/cargo-deny"."platforms.linux-arm64"]
24+
checksum = "sha256:2b3567a60b7491c159d1cef8b7d8479d1ad2a31e29ef49462634ad4552fcc77d"
25+
url = "https://github.com/EmbarkStudios/cargo-deny/releases/download/0.19.0/cargo-deny-0.19.0-aarch64-unknown-linux-musl.tar.gz"
26+
27+
[tools."aqua:EmbarkStudios/cargo-deny"."platforms.linux-x64"]
28+
checksum = "sha256:0e8c2aa59128612c90d9e09c02204e912f29a5b8d9a64671b94608cbe09e064f"
29+
url = "https://github.com/EmbarkStudios/cargo-deny/releases/download/0.19.0/cargo-deny-0.19.0-x86_64-unknown-linux-musl.tar.gz"
30+
31+
[tools."aqua:EmbarkStudios/cargo-deny"."platforms.macos-arm64"]
32+
checksum = "sha256:a22f2023c06f3eefd099a5d42dd828fd4fa74d1e1c167bd1dbc3cf59ad62ded0"
33+
url = "https://github.com/EmbarkStudios/cargo-deny/releases/download/0.19.0/cargo-deny-0.19.0-aarch64-apple-darwin.tar.gz"
1434

1535
[[tools."aqua:ast-grep/ast-grep"]]
1636
version = "0.39.5"
1737
backend = "aqua:ast-grep/ast-grep"
18-
"platforms.linux-arm64" = { checksum = "sha256:4b20d2032fec27d0863e9f58e2848861fd5b99bf71f56f271d636dc821056bbb", url = "https://github.com/ast-grep/ast-grep/releases/download/0.39.5/app-aarch64-unknown-linux-gnu.zip"}
19-
"platforms.linux-x64" = { checksum = "sha256:9a1cab3e7916c98c6fe0079cc2c3b44d98832ba3bdb9db492d04a4e60e41fd0f", url = "https://github.com/ast-grep/ast-grep/releases/download/0.39.5/app-x86_64-unknown-linux-gnu.zip"}
20-
"platforms.macos-arm64" = { checksum = "sha256:d672ef833d478423a54a57da6b937784e2fe9b768c89affa58d8ff6db3174d3d", url = "https://github.com/ast-grep/ast-grep/releases/download/0.39.5/app-aarch64-apple-darwin.zip"}
38+
39+
[tools."aqua:ast-grep/ast-grep"."platforms.linux-arm64"]
40+
checksum = "sha256:4b20d2032fec27d0863e9f58e2848861fd5b99bf71f56f271d636dc821056bbb"
41+
url = "https://github.com/ast-grep/ast-grep/releases/download/0.39.5/app-aarch64-unknown-linux-gnu.zip"
42+
43+
[tools."aqua:ast-grep/ast-grep"."platforms.linux-x64"]
44+
checksum = "sha256:9a1cab3e7916c98c6fe0079cc2c3b44d98832ba3bdb9db492d04a4e60e41fd0f"
45+
url = "https://github.com/ast-grep/ast-grep/releases/download/0.39.5/app-x86_64-unknown-linux-gnu.zip"
46+
47+
[tools."aqua:ast-grep/ast-grep"."platforms.macos-arm64"]
48+
checksum = "sha256:d672ef833d478423a54a57da6b937784e2fe9b768c89affa58d8ff6db3174d3d"
49+
url = "https://github.com/ast-grep/ast-grep/releases/download/0.39.5/app-aarch64-apple-darwin.zip"
2150

2251
[[tools."aqua:nextest-rs/nextest/cargo-nextest"]]
2352
version = "0.9.72"
2453
backend = "aqua:nextest-rs/nextest/cargo-nextest"
25-
"platforms.linux-arm64" = { url = "https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.72/cargo-nextest-0.9.72-aarch64-unknown-linux-gnu.tar.gz"}
26-
"platforms.linux-x64" = { url = "https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.72/cargo-nextest-0.9.72-x86_64-unknown-linux-musl.tar.gz"}
27-
"platforms.macos-arm64" = { url = "https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.72/cargo-nextest-0.9.72-universal-apple-darwin.tar.gz"}
54+
55+
[tools."aqua:nextest-rs/nextest/cargo-nextest"."platforms.linux-arm64"]
56+
url = "https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.72/cargo-nextest-0.9.72-aarch64-unknown-linux-gnu.tar.gz"
57+
58+
[tools."aqua:nextest-rs/nextest/cargo-nextest"."platforms.linux-x64"]
59+
url = "https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.72/cargo-nextest-0.9.72-x86_64-unknown-linux-musl.tar.gz"
60+
61+
[tools."aqua:nextest-rs/nextest/cargo-nextest"."platforms.macos-arm64"]
62+
url = "https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.72/cargo-nextest-0.9.72-universal-apple-darwin.tar.gz"
2863

2964
[[tools.buf]]
3065
version = "1.50.0"
3166
backend = "aqua:bufbuild/buf"
32-
"platforms.linux-arm64" = { checksum = "sha256:4c920c5f96eb99ad13eb6f25cf740fdb42963401faa267bee03fbd3e163730b2", url = "https://github.com/bufbuild/buf/releases/download/v1.50.0/buf-Linux-aarch64.tar.gz"}
33-
"platforms.linux-x64" = { checksum = "sha256:80c1211dfc4844499c6ddad341bb21206579883fd33cea0a2c40c82befd70602", url = "https://github.com/bufbuild/buf/releases/download/v1.50.0/buf-Linux-x86_64.tar.gz"}
34-
"platforms.macos-arm64" = { checksum = "sha256:c80f7f8a1d8ffd36c5db31a360c7e0b65c8cf671d60bd3c34e1558e54f84f4cc", url = "https://github.com/bufbuild/buf/releases/download/v1.50.0/buf-Darwin-arm64.tar.gz"}
67+
68+
[tools.buf."platforms.linux-arm64"]
69+
checksum = "sha256:4c920c5f96eb99ad13eb6f25cf740fdb42963401faa267bee03fbd3e163730b2"
70+
url = "https://github.com/bufbuild/buf/releases/download/v1.50.0/buf-Linux-aarch64.tar.gz"
71+
72+
[tools.buf."platforms.linux-x64"]
73+
checksum = "sha256:80c1211dfc4844499c6ddad341bb21206579883fd33cea0a2c40c82befd70602"
74+
url = "https://github.com/bufbuild/buf/releases/download/v1.50.0/buf-Linux-x86_64.tar.gz"
75+
76+
[tools.buf."platforms.macos-arm64"]
77+
checksum = "sha256:c80f7f8a1d8ffd36c5db31a360c7e0b65c8cf671d60bd3c34e1558e54f84f4cc"
78+
url = "https://github.com/bufbuild/buf/releases/download/v1.50.0/buf-Darwin-arm64.tar.gz"
3579

3680
[[tools."github:bnjbvr/cargo-machete"]]
3781
version = "0.9.1"
3882
backend = "github:bnjbvr/cargo-machete"
39-
"platforms.linux-arm64" = { checksum = "sha256:ec71436fb90acd8cb1e22ec1e9f9fe507abffcd66741b20b481a0d0f13ce4fa0", url = "https://github.com/bnjbvr/cargo-machete/releases/download/v0.9.1/cargo-machete-v0.9.1-aarch64-unknown-linux-gnu.tar.gz", url_api = "https://api.github.com/repos/bnjbvr/cargo-machete/releases/assets/282938034"}
40-
"platforms.linux-x64" = { checksum = "sha256:640b0814480b401e4e72201e52a13e1311b8eb8d7c27faa08bbe9886f252f26d", url = "https://github.com/bnjbvr/cargo-machete/releases/download/v0.9.1/cargo-machete-v0.9.1-x86_64-unknown-linux-musl.tar.gz", url_api = "https://api.github.com/repos/bnjbvr/cargo-machete/releases/assets/282938086"}
41-
"platforms.macos-arm64" = { checksum = "sha256:72355383848acb154060e6fea2d5b7d58a825ed49fef157b46a6fe25180f8638", url = "https://github.com/bnjbvr/cargo-machete/releases/download/v0.9.1/cargo-machete-v0.9.1-aarch64-apple-darwin.tar.gz", url_api = "https://api.github.com/repos/bnjbvr/cargo-machete/releases/assets/282938101"}
83+
84+
[tools."github:bnjbvr/cargo-machete"."platforms.linux-arm64"]
85+
checksum = "sha256:ec71436fb90acd8cb1e22ec1e9f9fe507abffcd66741b20b481a0d0f13ce4fa0"
86+
url = "https://github.com/bnjbvr/cargo-machete/releases/download/v0.9.1/cargo-machete-v0.9.1-aarch64-unknown-linux-gnu.tar.gz"
87+
url_api = "https://api.github.com/repos/bnjbvr/cargo-machete/releases/assets/282938034"
88+
89+
[tools."github:bnjbvr/cargo-machete"."platforms.linux-x64"]
90+
checksum = "sha256:640b0814480b401e4e72201e52a13e1311b8eb8d7c27faa08bbe9886f252f26d"
91+
url = "https://github.com/bnjbvr/cargo-machete/releases/download/v0.9.1/cargo-machete-v0.9.1-x86_64-unknown-linux-musl.tar.gz"
92+
url_api = "https://api.github.com/repos/bnjbvr/cargo-machete/releases/assets/282938086"
93+
94+
[tools."github:bnjbvr/cargo-machete"."platforms.macos-arm64"]
95+
checksum = "sha256:72355383848acb154060e6fea2d5b7d58a825ed49fef157b46a6fe25180f8638"
96+
url = "https://github.com/bnjbvr/cargo-machete/releases/download/v0.9.1/cargo-machete-v0.9.1-aarch64-apple-darwin.tar.gz"
97+
url_api = "https://api.github.com/repos/bnjbvr/cargo-machete/releases/assets/282938101"
4298

4399
[[tools.protoc]]
44-
version = "21.12"
100+
version = "33.2"
45101
backend = "aqua:protocolbuffers/protobuf/protoc"
102+
103+
[tools.protoc."platforms.linux-arm64"]
104+
checksum = "sha256:706662a332683aa2fffe1c4ea61588279d31679cd42d91c7d60a69651768edb8"
105+
url = "https://github.com/protocolbuffers/protobuf/releases/download/v33.2/protoc-33.2-linux-aarch_64.zip"
106+
107+
[tools.protoc."platforms.linux-x64"]
108+
checksum = "sha256:b24b53f87c151bfd48b112fe4c3a6e6574e5198874f38036aff41df3456b8caf"
109+
url = "https://github.com/protocolbuffers/protobuf/releases/download/v33.2/protoc-33.2-linux-x86_64.zip"
110+
111+
[tools.protoc."platforms.macos-arm64"]
112+
checksum = "sha256:5be1427127788c9f7dd7d606c3e69843dd3587327dea993917ffcb77e7234b44"
113+
url = "https://github.com/protocolbuffers/protobuf/releases/download/v33.2/protoc-33.2-osx-aarch_64.zip"

mise.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
# MISE_LOCKED=0 mise lock --platform linux-x64,macos-arm64,linux-arm64
1414
#
1515
# When those complete, run:
16-
# ./ci/validate
16+
# uv run ci/check_mise_checksums.py
17+
# mise install
18+
# ci/validate
1719
#
1820

1921
[settings]
@@ -43,4 +45,4 @@ actionlint = "1.7.3"
4345
buf = "1.50.0"
4446

4547
# Protocol buffer compiler
46-
protoc = "21.12"
48+
protoc = "33.2"

0 commit comments

Comments
 (0)