CI-18 review: --head needs B checked out; guard the CI image against CI_ONLY
The selector reads the graph, and run-affected.sh runs the tests, from the working tree, so a --base/--head range is only right with the head checked out. The CI image is built from the merged tree, so an ENV CI_ONLY in its Dockerfile would make the gate partial; test_affected_tests.py now fails on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b2d3066966
commit
22ef89bf10
@@ -2,7 +2,7 @@
|
||||
"""CI-18: which test_*.py files does a diff affect? For DEV and REVIEW rounds only.
|
||||
|
||||
python3 .gitea/ci/affected_tests.py # merge-base(origin/release/1.0) .. working tree
|
||||
python3 .gitea/ci/affected_tests.py --base A --head B # a committed range
|
||||
python3 .gitea/ci/affected_tests.py --base A --head B # a committed range (the graph is read from the working tree: check out B)
|
||||
python3 .gitea/ci/affected_tests.py --files f1 f2 # explicit changed paths (no git)
|
||||
... --names # only the file names, one per line
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# round. NOT the merge gate: `checks / unit (pull_request)` runs all of them.
|
||||
#
|
||||
# sh .gitea/ci/run-affected.sh # merge-base(origin/release/1.0) .. working tree
|
||||
# sh .gitea/ci/run-affected.sh --base A --head B
|
||||
# sh .gitea/ci/run-affected.sh --base A --head B # with B checked out: the tests run from the working tree
|
||||
# INFRA_DIR=/path/to/admin-goodwe@pin sh .gitea/ci/run-affected.sh
|
||||
#
|
||||
# Arguments go to affected_tests.py (which prints what it chose and why). It
|
||||
|
||||
@@ -117,7 +117,7 @@ The pin tracks `admin/goodwe` **release/1.0**, not master. Two non-required chec
|
||||
|
||||
```bash
|
||||
INFRA_DIR=~/path/to/admin-goodwe-at-the-pin sh .gitea/ci/run-affected.sh # release/1.0 .. working tree
|
||||
sh .gitea/ci/run-affected.sh --base origin/release/1.0 --head my-branch # a committed range
|
||||
sh .gitea/ci/run-affected.sh --base origin/release/1.0 --head my-branch # a committed range, with my-branch checked out (the tests run from the working tree)
|
||||
python3 .gitea/ci/affected_tests.py --files goodwe_controller/app/price.py # only list, with the reasons
|
||||
```
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ here are the ones whose failure would be a missed test:
|
||||
run-tests.sh select ALL, a changed test file is chosen.
|
||||
4. THE MUTANT: break a real module in a private copy of the tree; the
|
||||
selector must choose a test that goes red, and the unbroken copy is green.
|
||||
5. The merge gate cannot be partial: checks.yml never mentions CI_ONLY and
|
||||
still runs the unfiltered run-tests.sh line.
|
||||
5. The merge gate cannot be partial: checks.yml and the CI image never
|
||||
mention CI_ONLY, and checks.yml still runs the unfiltered run-tests.sh line.
|
||||
Read MUTATION.md before you report a survivor.
|
||||
"""
|
||||
|
||||
@@ -256,6 +256,11 @@ with open(os.path.join(REPO, ".gitea", "ci", "run-tests.sh"),
|
||||
rt = fh.read()
|
||||
check("run-tests.sh takes CI_ONLY from the environment only and says PARTIAL",
|
||||
"PARTIAL RUN" in rt and 'set -- test_*.py' in rt)
|
||||
with open(os.path.join(REPO, ".gitea", "ci", "Dockerfile"),
|
||||
encoding="utf-8") as fh:
|
||||
df = fh.read()
|
||||
check("the CI image (built from the merged tree) never sets CI_ONLY",
|
||||
"CI_ONLY" not in df)
|
||||
|
||||
for d in tmps:
|
||||
shutil.rmtree(d, ignore_errors=True)
|
||||
|
||||
Reference in New Issue
Block a user