mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-24 16:06:17 +01:00
Compare commits
3 Commits
0f8a55e752
...
1351a1460f
| Author | SHA1 | Date | |
|---|---|---|---|
| 1351a1460f | |||
| 12058a4201 | |||
| 32de221550 |
12
.github/workflows/pre-commit.yml
vendored
12
.github/workflows/pre-commit.yml
vendored
@ -15,6 +15,10 @@ jobs:
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
# See the note in python-tests.yml: caches the pip download cache,
|
||||
# keyed on the real meta/ path rather than the root symlink.
|
||||
cache: pip
|
||||
cache-dependency-path: meta/requirements.txt
|
||||
|
||||
# zsh backs the zsh-syntax hook. apt does not let a patch release be
|
||||
# selected, so this is pinned only to what the runner image provides;
|
||||
@ -96,6 +100,14 @@ jobs:
|
||||
fi
|
||||
echo "prettier ${prettier_installed} and shfmt ${shfmt_installed} pinned and on PATH"
|
||||
|
||||
# pre-commit builds a virtualenv per hook repo on first use, which is
|
||||
# slower than the pip install itself. Keyed on the hook definitions, so
|
||||
# it invalidates exactly when a hook's repo or rev changes.
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pre-commit
|
||||
key: pre-commit-${{ runner.os }}-py3.12-${{ hashFiles('.pre-commit-config.yaml') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
|
||||
20
.github/workflows/python-tests.yml
vendored
20
.github/workflows/python-tests.yml
vendored
@ -9,7 +9,13 @@ on:
|
||||
- "tests/**"
|
||||
- "linux_configuration/scripts/periodic_background/system-maintenance/bin/**"
|
||||
- "linux_configuration/tests/**"
|
||||
# Both spellings: the root requirements.txt is a SYMLINK into meta/,
|
||||
# and GitHub matches path filters against the changed path as git
|
||||
# records it. Editing meta/requirements.txt therefore did NOT match
|
||||
# "requirements.txt", so a dependency fix silently skipped this
|
||||
# workflow and the red run stayed on an older commit.
|
||||
- "requirements.txt"
|
||||
- "meta/requirements.txt"
|
||||
- ".github/workflows/python-tests.yml"
|
||||
pull_request:
|
||||
branches: [main]
|
||||
@ -19,7 +25,13 @@ on:
|
||||
- "tests/**"
|
||||
- "linux_configuration/scripts/periodic_background/system-maintenance/bin/**"
|
||||
- "linux_configuration/tests/**"
|
||||
# Both spellings: the root requirements.txt is a SYMLINK into meta/,
|
||||
# and GitHub matches path filters against the changed path as git
|
||||
# records it. Editing meta/requirements.txt therefore did NOT match
|
||||
# "requirements.txt", so a dependency fix silently skipped this
|
||||
# workflow and the red run stayed on an older commit.
|
||||
- "requirements.txt"
|
||||
- "meta/requirements.txt"
|
||||
- ".github/workflows/python-tests.yml"
|
||||
workflow_dispatch: {}
|
||||
|
||||
@ -31,6 +43,14 @@ jobs:
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
# Cache the pip DOWNLOAD cache, keyed on the requirements file, so a
|
||||
# run that changes nothing about dependencies reuses the wheels
|
||||
# instead of re-fetching ~80 packages from PyPI. Points at
|
||||
# meta/requirements.txt, not the root symlink: the cache key is
|
||||
# hashed from the file at this path, and hashing a symlink is not
|
||||
# the same as hashing its target.
|
||||
cache: pip
|
||||
cache-dependency-path: meta/requirements.txt
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
{
|
||||
"intent": "Stop the two Python CI workflows re-downloading ~80 packages from PyPI on every run, which was the single slowest step in both.",
|
||||
"scope": [
|
||||
".github/workflows/python-tests.yml",
|
||||
".github/workflows/pre-commit.yml",
|
||||
"Non-goal: pinning dependencies or trimming the requirements list"
|
||||
],
|
||||
"changes": [
|
||||
"Added cache: pip with cache-dependency-path: meta/requirements.txt to actions/setup-python in both workflows. The path is the real file, not the root requirements.txt symlink, because the cache key is hashed from the file at the given path.",
|
||||
"Added an actions/cache@v4 step for ~/.cache/pre-commit in pre-commit.yml, keyed on .pre-commit-config.yaml, so hook virtualenvs are not rebuilt when no hook changed.",
|
||||
"The Node workflows (poker-stakes, reverse-survivors) already cached npm; the Python ones were the outliers."
|
||||
],
|
||||
"verification": [
|
||||
{
|
||||
"command": "gh api .../actions/runs/32645134828/jobs -- per-step timings for Pre-commit checks",
|
||||
"result": "pass",
|
||||
"evidence": "Install dependencies = 63s, the dominant step; every other step 16s or less. This is the step the cache targets."
|
||||
},
|
||||
{
|
||||
"command": "gh api .../actions/runs/32645075080/jobs -- per-step timings for Python tests",
|
||||
"result": "pass",
|
||||
"evidence": "Install dependencies = 49s vs 35s actually running pytest; same dominant step"
|
||||
},
|
||||
{
|
||||
"command": "python3 -c \"import yaml; yaml.safe_load(...)\" on both workflow files",
|
||||
"result": "pass",
|
||||
"evidence": "both parse as valid YAML"
|
||||
},
|
||||
{
|
||||
"command": "pre-commit run --files .github/workflows/python-tests.yml .github/workflows/pre-commit.yml",
|
||||
"result": "pass",
|
||||
"evidence": "no hook reported a failure (prettier, check-yaml included)"
|
||||
}
|
||||
],
|
||||
"risks": [
|
||||
"A stale pip cache could in principle serve an old wheel; mitigated because the key is a hash of the requirements file, so any dependency change invalidates it.",
|
||||
"The first run after this lands is a cache MISS and will be no faster; the saving appears from the second run onward."
|
||||
],
|
||||
"rollback": [
|
||||
"Remove the cache lines from both setup-python blocks and delete the actions/cache step.",
|
||||
"After rollback, confirm the Install dependencies step returns to ~50-60s."
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
{
|
||||
"intent": "Turn the Python tests CI workflow green. It has failed since ~2026-08-19 in 'Install dependencies' with pip's resolution-too-deep error, so no Python test has actually run in CI for days.",
|
||||
"scope": [
|
||||
"meta/requirements.txt (root requirements.txt is a symlink to it)",
|
||||
"Non-goal: pinning the other 78 unpinned dependencies, which would be a much larger change"
|
||||
],
|
||||
"changes": [
|
||||
"Removed mitmproxy>=10.0. The CI log shows the resolver backtracking endlessly through Brotli 1.0.6/1.0.4/1.0.1 and asgiref 3.8.0/3.7.1/3.6.0, all pulled in by mitmproxy, before giving up.",
|
||||
"It is safe to remove: nothing under python_pkg/ imports mitmproxy, and `git grep mitmproxy` finds it only in a pacman whitelist and a docs file. check_requirements_sync.py passes without it."
|
||||
],
|
||||
"verification": [
|
||||
{
|
||||
"command": "python3.11 -m venv; pip install --dry-run -r <requirements WITH mitmproxy>",
|
||||
"result": "fail",
|
||||
"evidence": "exit 1, 'error: resolution-too-deep' -- the CI failure reproduced locally on Python 3.11.11 with pip 26.2.1, the same versions CI uses"
|
||||
},
|
||||
{
|
||||
"command": "pip install --dry-run -r <requirements WITHOUT mitmproxy> in the same venv",
|
||||
"result": "pass",
|
||||
"evidence": "exit 0, resolution completes"
|
||||
},
|
||||
{
|
||||
"command": "python3 meta/scripts/check_requirements_sync.py --package python_pkg",
|
||||
"result": "pass",
|
||||
"evidence": "exit 0 -- no python_pkg import needs the dropped package"
|
||||
}
|
||||
],
|
||||
"risks": [
|
||||
"If a future script wants mitmproxy it must be re-added, and the resolver problem returns. Pinning it to an exact version would be the way back in.",
|
||||
"The underlying fragility remains: 78 of 80 requirements are unpinned >= ranges, so another wide-dependency package could reintroduce this."
|
||||
],
|
||||
"rollback": [
|
||||
"Re-add 'mitmproxy>=10.0' to meta/requirements.txt in sorted position.",
|
||||
"Expect Python tests CI to go red again at the Install dependencies step."
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
{
|
||||
"intent": "Make the Python tests workflow actually trigger when the dependency list changes, so a requirements fix cannot silently skip the workflow it is meant to repair.",
|
||||
"scope": [
|
||||
".github/workflows/python-tests.yml (push and pull_request path filters)",
|
||||
"Non-goal: changing the symlink layout, which the repo documents deliberately"
|
||||
],
|
||||
"changes": [
|
||||
"Added meta/requirements.txt alongside requirements.txt in both path filters. The root file is a symlink into meta/, and GitHub matches filters against the path as git records it, so editing the real file did not match the symlink's name."
|
||||
],
|
||||
"verification": [
|
||||
{
|
||||
"command": "Observed on commit 32de2215, which changed meta/requirements.txt",
|
||||
"result": "fail",
|
||||
"evidence": "Dependency Graph, Shell tests and Pre-commit checks all ran; Python tests did NOT trigger at all, leaving the last Python tests result on the older red commit 5ba2cbd4"
|
||||
},
|
||||
{
|
||||
"command": "python3 -c \"import yaml; yaml.safe_load(open('.github/workflows/python-tests.yml'))\"",
|
||||
"result": "pass",
|
||||
"evidence": "YAML valid; both the push and pull_request filter lists were patched (2 occurrences)"
|
||||
},
|
||||
{
|
||||
"command": "gh workflow run 'Python tests' --ref main",
|
||||
"result": "pass",
|
||||
"evidence": "Dispatched run 32645075080 to confirm the dependency fix itself, since the filter bug prevented an automatic run"
|
||||
}
|
||||
],
|
||||
"risks": [
|
||||
"The other root symlinks (pyproject.toml, run.sh, lint_python.sh, .fvmrc) are not referenced by any workflow path filter today, so they carry the same latent trap if one is ever added."
|
||||
],
|
||||
"rollback": [
|
||||
"Remove the meta/requirements.txt lines from both filters.",
|
||||
"After rollback, a change to meta/requirements.txt will once again skip this workflow."
|
||||
]
|
||||
}
|
||||
@ -46,7 +46,6 @@ lxml>=5.0
|
||||
markdownify>=1.2.0
|
||||
matplotlib>=3.0
|
||||
mccabe>=0.7.0
|
||||
mitmproxy>=10.0
|
||||
mypy>=1.8.0
|
||||
numpy>=1.20
|
||||
opencv-python>=4.0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user