fix(ci): smoke guard catches tagless builds; DEBUG import must hit the install; pin more workflow invariants
Review findings on PR #13: - release-branch-semver gives 0.1.0.devN without tags, so the 0.0 guard never fired; check_version() now requires >= 0.2 (unit-tested) - the APPSKELLINGTON_DEBUG child import could resolve the source tree from the cwd and false-pass; it now reports its location and must match - test_ci_workflow: no continue-on-error, matrix python drives container and UV_PYTHON, WIP gate compared whole (mutation-tested) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -60,10 +60,27 @@ def test_superseded_pr_runs_cancel_but_push_runs_never_do():
|
||||
|
||||
|
||||
def test_every_job_is_wip_gated():
|
||||
# Compared whole, not by substring: `&&` turned into `||` must fail.
|
||||
gate = "github.event_name != 'pull_request' || ( %s && %s )" % WIP_CLAUSES
|
||||
for name, job in load()["jobs"].items():
|
||||
cond = flat(job.get("if", ""))
|
||||
for clause in WIP_CLAUSES:
|
||||
assert clause in cond, "%s lacks WIP gate clause %s" % (name, clause)
|
||||
assert cond in (gate, "always() && ( %s )" % gate), name
|
||||
|
||||
|
||||
def test_no_gate_can_be_softened_by_continue_on_error():
|
||||
# continue-on-error makes needs.<job>.result read success, so ci-ok
|
||||
# would go green over a failure.
|
||||
for name, job in load()["jobs"].items():
|
||||
assert "continue-on-error" not in job, name
|
||||
for step in job.get("steps", []):
|
||||
assert "continue-on-error" not in step, name
|
||||
|
||||
|
||||
def test_each_lane_really_runs_its_matrix_python():
|
||||
test = load()["jobs"]["test"]
|
||||
assert test["container"] == "python:${{ matrix.python }}"
|
||||
assert test["env"]["UV_PYTHON"] == "${{ matrix.python }}"
|
||||
assert test["env"]["UV_PYTHON_DOWNLOADS"] == "never"
|
||||
|
||||
|
||||
def test_matrix_matches_requires_python():
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
"""Unit tests for scripts/smoke_import.py's version checks."""
|
||||
|
||||
import importlib.util
|
||||
import pathlib
|
||||
|
||||
import pytest
|
||||
|
||||
SCRIPT = pathlib.Path(__file__).resolve().parent.parent / "scripts" / "smoke_import.py"
|
||||
spec = importlib.util.spec_from_file_location("smoke_import", SCRIPT)
|
||||
smoke_import = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(smoke_import)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"version",
|
||||
[
|
||||
"0.0.0",
|
||||
"0.0.1.dev3+gabc1234",
|
||||
# release-branch-semver with no tags reachable (shallow clone):
|
||||
"0.1.0.dev1+g6bd717f23",
|
||||
],
|
||||
)
|
||||
def test_tagless_versions_are_rejected(version):
|
||||
with pytest.raises(SystemExit, match="no tags"):
|
||||
smoke_import.check_version(version, expected=None)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("version", ["0.2.3", "0.3.0.dev23+gc361b286c", "1.0.0"])
|
||||
def test_tag_derived_versions_pass(version):
|
||||
smoke_import.check_version(version, expected=None)
|
||||
|
||||
|
||||
def test_expected_version_must_match_exactly():
|
||||
with pytest.raises(SystemExit, match="expected version 0.2.3"):
|
||||
smoke_import.check_version("0.2.3.dev1", expected="0.2.3")
|
||||
Reference in New Issue
Block a user