Skip to content

Commit 410e6df

Browse files
authored
Merge branch 'main' into main
2 parents 875c50c + eb36967 commit 410e6df

File tree

30 files changed

+648
-187
lines changed

30 files changed

+648
-187
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ max_line_length = 110
1616
[*.py]
1717
# checked by black
1818
indent_size = 4
19+
max_line_length = 120

.github/workflows/acceptance-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
1616
- uses: jdx/mise-action@be3be2260bc02bc3fbf94c5e2fed8b7964baf074 # v3.4.0
1717
with:
18-
version: v2025.10.18
19-
sha256: 3790805b8041fdd831c904ffeb9c11a9b5ddaaea85f8cba775d4f344a61d5014
18+
version: v2025.11.1
19+
sha256: d4bec11aeb5b13180c596b70abf59716acda20131dbc3df8b9146f97cecf645c
2020
- name: Run acceptance tests
2121
run: mise run acceptance-test

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
persist-credentials: false
1515
- uses: jdx/mise-action@be3be2260bc02bc3fbf94c5e2fed8b7964baf074 # v3.4.0
1616
with:
17-
version: v2025.10.18
18-
sha256: 3790805b8041fdd831c904ffeb9c11a9b5ddaaea85f8cba775d4f344a61d5014
17+
version: v2025.11.1
18+
sha256: d4bec11aeb5b13180c596b70abf59716acda20131dbc3df8b9146f97cecf645c
1919
- name: Cache local Maven repository
2020
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
2121
with:

.github/workflows/github-pages.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ jobs:
3939
fetch-depth: 0
4040
- uses: jdx/mise-action@be3be2260bc02bc3fbf94c5e2fed8b7964baf074 # v3.4.0
4141
with:
42-
version: v2025.10.18
43-
sha256: 3790805b8041fdd831c904ffeb9c11a9b5ddaaea85f8cba775d4f344a61d5014
42+
version: v2025.11.1
43+
sha256: d4bec11aeb5b13180c596b70abf59716acda20131dbc3df8b9146f97cecf645c
4444
cache: "false"
4545
- name: Setup Pages
4646
id: pages

.github/workflows/lint-rest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1616
- uses: jdx/mise-action@be3be2260bc02bc3fbf94c5e2fed8b7964baf074 # v3.4.0
1717
with:
18-
version: v2025.10.18
19-
sha256: 3790805b8041fdd831c904ffeb9c11a9b5ddaaea85f8cba775d4f344a61d5014
18+
version: v2025.11.1
19+
sha256: d4bec11aeb5b13180c596b70abf59716acda20131dbc3df8b9146f97cecf645c
2020
- name: Lint
2121
run: mise run lint-rest

.github/workflows/native-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
1616
- uses: jdx/mise-action@be3be2260bc02bc3fbf94c5e2fed8b7964baf074 # v3.4.0
1717
with:
18-
version: v2025.10.18
19-
sha256: 3790805b8041fdd831c904ffeb9c11a9b5ddaaea85f8cba775d4f344a61d5014
18+
version: v2025.11.1
19+
sha256: d4bec11aeb5b13180c596b70abf59716acda20131dbc3df8b9146f97cecf645c
2020
env:
2121
MISE_ENV: native
2222
- name: Run native tests

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ jobs:
2424
with:
2525
persist-credentials: false
2626

27-
- name: Set Up JDK
28-
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5
27+
- uses: jdx/mise-action@be3be2260bc02bc3fbf94c5e2fed8b7964baf074 # v3.4.0
2928
with:
30-
java-version: 21
31-
distribution: temurin
29+
version: v2025.11.1
30+
sha256: d4bec11aeb5b13180c596b70abf59716acda20131dbc3df8b9146f97cecf645c
31+
cache: false
3232

33-
- name: Build with Maven
34-
run: ./scripts/build-release.sh
33+
- name: Build release version
34+
run: mise run build-release
3535
env:
3636
TAG: ${{ github.ref_name }}
3737

.github/workflows/test-release-build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ jobs:
1818
persist-credentials: false
1919
- uses: jdx/mise-action@be3be2260bc02bc3fbf94c5e2fed8b7964baf074 # v3.4.0
2020
with:
21-
version: v2025.10.18
22-
sha256: 3790805b8041fdd831c904ffeb9c11a9b5ddaaea85f8cba775d4f344a61d5014
21+
version: v2025.11.1
22+
sha256: d4bec11aeb5b13180c596b70abf59716acda20131dbc3df8b9146f97cecf645c
2323
- name: Cache local Maven repository
2424
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
2525
with:
2626
path: ~/.m2/repository
2727
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
2828
restore-keys: |
2929
${{ runner.os }}-maven-
30-
- name: Run the Maven verify phase
31-
run: ./scripts/build-release.sh
30+
- name: Build release version
31+
run: mise run build-release
3232
env:
33-
# don't ues the current snapshot version, to test a more realistic release
33+
# don't use the current snapshot version, to test a more realistic release
3434
TAG: ${{ github.run_number }}

.mise/tasks/build-release.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
#MISE description="Build release package"
4+
#USAGE arg "<tag>" env="TAG" default="1.5.0-SNAPSHOT"
5+
6+
set -euo pipefail
7+
8+
# shellcheck disable=SC2154 # is set by mise
9+
VERSION=${usage_tag#v}
10+
11+
mise run set-version "$VERSION"
12+
mvn -B package -P 'release,!default' -Dmaven.test.skip=true

.mise/tasks/lint-bom.py

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#!/usr/bin/env python3
2+
3+
# [MISE] description="Make sure the BOM has all necessary modules"
4+
5+
import difflib
6+
import re
7+
import sys
8+
from fnmatch import fnmatch
9+
from pathlib import Path
10+
from typing import List
11+
12+
ROOT = Path(__file__).resolve().parents[2] # repo root (.. from .mise/tasks)
13+
IGNORE_DIRS = {"prometheus-metrics-parent"}
14+
MODULE_PREFIX = "prometheus-metrics"
15+
BOM_POM = ROOT / "prometheus-metrics-bom" / "pom.xml"
16+
17+
18+
def first_artifact_id(pom_file: Path) -> str:
19+
"""Return the second <artifactId> value from the given pom.xml (matches original script).
20+
21+
The original shell function greps all <artifactId> lines and returns the second one
22+
(head -n 2 | tail -n 1). We replicate that behavior exactly.
23+
"""
24+
if not pom_file.is_file():
25+
raise FileNotFoundError(f"File {pom_file} does not exist.")
26+
27+
text = pom_file.read_text(encoding="utf-8")
28+
matches = re.findall(r"<artifactId>\s*(.*?)\s*</artifactId>", text)
29+
if len(matches) < 2:
30+
return ""
31+
return matches[1].strip()
32+
33+
34+
def add_dir(dir_path: Path, want: List[str]):
35+
if not dir_path.is_dir():
36+
raise FileNotFoundError(f"Directory {dir_path} does not exist.")
37+
38+
if any(dir_path.name == ig for ig in IGNORE_DIRS):
39+
print(f"Skipping {dir_path}")
40+
return
41+
42+
pom = dir_path / "pom.xml"
43+
if not pom.is_file():
44+
raise FileNotFoundError(f"File {pom} does not exist.")
45+
46+
artifact_id = first_artifact_id(pom)
47+
if not artifact_id:
48+
raise RuntimeError(f"No artifactId found in {pom}")
49+
50+
print(f"Found artifactId '{artifact_id}' in {pom}")
51+
want.append(artifact_id)
52+
53+
54+
def collect_want(root: Path) -> List[str]:
55+
want: List[str] = []
56+
# top-level prometheus-metrics*
57+
for entry in sorted(root.iterdir()):
58+
if entry.is_dir() and fnmatch(entry.name, f"{MODULE_PREFIX}*"):
59+
add_dir(entry, want)
60+
61+
# prometheus-metrics-tracer/prometheus-metrics*
62+
tracer_dir = root / "prometheus-metrics-tracer"
63+
if tracer_dir.is_dir():
64+
for entry in sorted(tracer_dir.iterdir()):
65+
if entry.is_dir() and fnmatch(entry.name, f"{MODULE_PREFIX}*"):
66+
add_dir(entry, want)
67+
68+
# deduplicate and sort
69+
want_unique = sorted(set(want))
70+
return want_unique
71+
72+
73+
def collect_have(bom_pom: Path) -> List[str]:
74+
if not bom_pom.is_file():
75+
raise FileNotFoundError(f"BOM file {bom_pom} does not exist.")
76+
77+
text = bom_pom.read_text(encoding="utf-8")
78+
# find artifactId values that start with MODULE_PREFIX
79+
matches = re.findall(
80+
r"<artifactId>\s*(%s[^<\s]*)\s*</artifactId>" % re.escape(MODULE_PREFIX), text
81+
)
82+
return sorted(matches)
83+
84+
85+
def main() -> int:
86+
try:
87+
want = collect_want(ROOT)
88+
have = collect_have(BOM_POM)
89+
90+
want_text = "\n".join(want)
91+
have_text = "\n".join(have)
92+
93+
if want_text != have_text:
94+
print(
95+
"The BOM file prometheus-metrics-bom/bom.xml does not match the current directory contents."
96+
)
97+
print("Expected:")
98+
print(want_text)
99+
print("Found:")
100+
print(have_text)
101+
print()
102+
diff = difflib.unified_diff(
103+
have_text.splitlines(keepends=True),
104+
want_text.splitlines(keepends=True),
105+
fromfile="found",
106+
tofile="expected",
107+
)
108+
sys.stdout.writelines(diff)
109+
return 1
110+
else:
111+
print("BOM file is up to date.")
112+
return 0
113+
114+
except Exception as e:
115+
print(e, file=sys.stderr)
116+
return 1
117+
118+
119+
if __name__ == "__main__":
120+
sys.exit(main())

0 commit comments

Comments
 (0)