Skip to content

Commit 649021b

Browse files
authored
fix: Exercise package table generation in PR CI (#237)
1 parent 372456f commit 649021b

5 files changed

Lines changed: 152 additions & 4 deletions

File tree

‎.github/workflows/checks.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
persist-credentials: false
1616
- uses: prefix-dev/setup-pixi@9936258fee697aff89b3fed6ca1f80a382ef694e # v0.11.3
1717
- run: pixi run lint
18+
- run: pixi run test-scripts
19+
- run: pixi run update-tables
1820
- run: pixi run build-docs
1921

2022
dependabot:

‎pixi.lock‎

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

‎pixi.toml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,13 @@ lint = {
8484
pyyaml = ">=6.0.3,<7"
8585
py-rattler = ">=0.28.1,<0.29"
8686
niquests = ">=3.21.2,<4"
87+
pytest = ">=9.2.0,<10"
8788

8889
[feature.scripts.tasks]
90+
test-scripts = {
91+
cmd = "pytest scripts",
92+
description = "Test package table generation",
93+
}
8994
check-dependabot-merge = {
9095
cmd = "python scripts/check_dependabot_merge.py",
9196
description = "Check whether every Dependabot update qualifies for auto-merge",

‎scripts/compare_pkg_completeness.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
import niquests
6060
import yaml
61-
from rattler import MatchSpec, PackageRecord
61+
from rattler import BuildString, MatchSpec, PackageRecord
6262
from urllib3.util.retry import Retry
6363

6464
# The distro list and the platform list are shared with the site through
@@ -289,7 +289,7 @@ def collect_mutexes(repos: dict[str, list[Artifact]]) -> tuple[str, MutexRecords
289289
PackageRecord(
290290
name=artifact["name"],
291291
version=artifact["version"],
292-
build=artifact["build"],
292+
build=BuildString(artifact["build"]),
293293
build_number=artifact.get("build_number", 0),
294294
subdir=platform,
295295
)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""Regression tests for package availability across mutex builds."""
2+
3+
from compare_pkg_completeness import collect_mutexes, mutex_matcher
4+
5+
6+
def test_matches_version_and_build_across_platforms() -> None:
7+
name, records = collect_mutexes(
8+
{
9+
"linux-64": [
10+
{"name": "ros-distro-mutex", "version": "0.6.0", "build": "noetic_0"},
11+
{"name": "ros-distro-mutex", "version": "0.7.0", "build": "noetic_2"},
12+
],
13+
"osx-arm64": [
14+
{"name": "ros-distro-mutex", "version": "0.6.0", "build": "noetic_1"},
15+
],
16+
}
17+
)
18+
match = mutex_matcher(records)
19+
assert name == "ros-distro-mutex"
20+
assert match(f"{name} 0.6.* noetic_0") == {"0.6.0"}
21+
assert match(f"{name} 0.6.* noetic_1") == {"0.6.0"}
22+
assert match(f"{name} >=0.6.0,<0.8.0a0") == {"0.6.0", "0.7.0"}
23+
assert match(f"{name} 0.6.* noetic_2") == set()

0 commit comments

Comments
 (0)