mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-29 14:43:32 +01:00
Compare commits
No commits in common. "7e3921ad66a2e66c696b77709ab10ec25e0233c2" and "fd6c772eaf73408a85fc2810b334668b198b4595" have entirely different histories.
7e3921ad66
...
fd6c772eaf
@ -65,7 +65,7 @@ repos:
|
|||||||
types: [python]
|
types: [python]
|
||||||
|
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.17.0
|
rev: v0.16.7
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix, --unsafe-fixes, --exit-non-zero-on-fix, --show-fixes]
|
args: [--fix, --unsafe-fixes, --exit-non-zero-on-fix, --show-fixes]
|
||||||
|
|||||||
@ -8,5 +8,5 @@ pylint==4.1.2
|
|||||||
pytest==9.1.1
|
pytest==9.1.1
|
||||||
pytest-cov==7.1.0
|
pytest-cov==7.1.0
|
||||||
requests==2.34.2
|
requests==2.34.2
|
||||||
ruff==0.17.0
|
ruff==0.16.10
|
||||||
types-requests==2.33.0.20261006
|
types-requests==2.33.0.20260906
|
||||||
|
|||||||
@ -25,8 +25,6 @@ from dep_freshness.install_precommit_ci import (
|
|||||||
TEMPLATES = Path(__file__).resolve().parent / "templates"
|
TEMPLATES = Path(__file__).resolve().parent / "templates"
|
||||||
DELEGATE = Path("scripts/check_dependency_freshness.sh")
|
DELEGATE = Path("scripts/check_dependency_freshness.sh")
|
||||||
WORKFLOW = Path(".github/workflows/dependency-freshness.yml")
|
WORKFLOW = Path(".github/workflows/dependency-freshness.yml")
|
||||||
# Repo-root file that opts a repo out of WORKFLOW (see _needs_workflow).
|
|
||||||
NO_WORKFLOW_MARKER = Path(".dep-freshness-no-workflow")
|
|
||||||
PRECOMMIT = Path(".pre-commit-config.yaml")
|
PRECOMMIT = Path(".pre-commit-config.yaml")
|
||||||
HOOK_ID = "dependency-freshness"
|
HOOK_ID = "dependency-freshness"
|
||||||
|
|
||||||
@ -58,16 +56,6 @@ def _needs_delegate(repo: Path) -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def _needs_workflow(repo: Path) -> bool:
|
def _needs_workflow(repo: Path) -> bool:
|
||||||
"""True when the CI workflow is missing or drifted -- unless opted out.
|
|
||||||
|
|
||||||
A repo with NO_WORKFLOW_MARKER at its root runs the gate locally only
|
|
||||||
(teatr-pw: no GitHub Actions minutes on a private repo, its pre-push hook
|
|
||||||
runs `--all --strict`). Without the opt-out every fleet sweep would put
|
|
||||||
back the workflow that repo deleted on purpose. The local pieces are
|
|
||||||
still installed.
|
|
||||||
"""
|
|
||||||
if (repo / NO_WORKFLOW_MARKER).exists():
|
|
||||||
return False
|
|
||||||
target = repo / WORKFLOW
|
target = repo / WORKFLOW
|
||||||
return not target.is_file() or target.read_text(encoding="utf-8") != _template(
|
return not target.is_file() or target.read_text(encoding="utf-8") != _template(
|
||||||
"workflow.yml"
|
"workflow.yml"
|
||||||
|
|||||||
@ -1,53 +0,0 @@
|
|||||||
"""The per-repo opt-out from the CI workflow (`.dep-freshness-no-workflow`).
|
|
||||||
|
|
||||||
A repo that runs the gate only locally (teatr-pw: no GitHub Actions minutes)
|
|
||||||
deletes `.github/workflows/dependency-freshness.yml` on purpose. Without an
|
|
||||||
opt-out the next fleet sweep puts it back, so the marker must stop the
|
|
||||||
installer from creating OR rewriting it -- and must not stop anything else.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from dep_freshness import install as installer
|
|
||||||
from dep_freshness.tests.conftest import write
|
|
||||||
|
|
||||||
MARKER = ".dep-freshness-no-workflow"
|
|
||||||
WORKFLOW = ".github/workflows/dependency-freshness.yml"
|
|
||||||
|
|
||||||
|
|
||||||
def test_the_marker_path_is_the_documented_one():
|
|
||||||
assert str(installer.NO_WORKFLOW_MARKER) == MARKER
|
|
||||||
|
|
||||||
|
|
||||||
def test_an_opted_out_repo_gets_the_local_pieces_but_no_workflow(repo):
|
|
||||||
write(repo, MARKER, "# no GitHub Actions here\n")
|
|
||||||
|
|
||||||
assert installer.install(repo) == [
|
|
||||||
"scripts/check_dependency_freshness.sh",
|
|
||||||
".pre-commit-config.yaml (dependency-freshness hook)",
|
|
||||||
]
|
|
||||||
assert not (repo / WORKFLOW).exists()
|
|
||||||
assert not (repo / ".github").exists()
|
|
||||||
|
|
||||||
|
|
||||||
def test_plan_does_not_report_the_workflow_as_missing(repo):
|
|
||||||
write(repo, MARKER, "")
|
|
||||||
|
|
||||||
assert WORKFLOW not in installer.plan(repo)
|
|
||||||
installer.install(repo)
|
|
||||||
assert installer.plan(repo) == []
|
|
||||||
assert installer.install(repo) == []
|
|
||||||
|
|
||||||
|
|
||||||
def test_an_existing_drifted_workflow_is_left_as_it_is(repo):
|
|
||||||
"""Opted out means hands off: no create, no rewrite, no delete."""
|
|
||||||
write(repo, MARKER, "")
|
|
||||||
write(repo, WORKFLOW, "name: kept by hand\n")
|
|
||||||
|
|
||||||
assert WORKFLOW not in installer.install(repo)
|
|
||||||
assert (repo / WORKFLOW).read_text(encoding="utf-8") == "name: kept by hand\n"
|
|
||||||
|
|
||||||
|
|
||||||
def test_without_the_marker_the_workflow_is_still_installed(repo):
|
|
||||||
assert WORKFLOW in installer.install(repo)
|
|
||||||
assert (repo / WORKFLOW).is_file()
|
|
||||||
@ -25,6 +25,8 @@ ignore = [
|
|||||||
"COM812",
|
"COM812",
|
||||||
"ISC001",
|
"ISC001",
|
||||||
"S603",
|
"S603",
|
||||||
|
# personal repo, no copyright policy (ruff 0.17 made CPY001 stable under select=ALL)
|
||||||
|
"CPY001",
|
||||||
]
|
]
|
||||||
fixable = ["ALL"]
|
fixable = ["ALL"]
|
||||||
unfixable = []
|
unfixable = []
|
||||||
|
|||||||
@ -65,7 +65,7 @@ repos:
|
|||||||
types: [python]
|
types: [python]
|
||||||
|
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.17.0
|
rev: v0.16.7
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix, --unsafe-fixes, --exit-non-zero-on-fix, --show-fixes]
|
args: [--fix, --unsafe-fixes, --exit-non-zero-on-fix, --show-fixes]
|
||||||
|
|||||||
@ -7,4 +7,4 @@ pre-commit==4.6.2
|
|||||||
pylint==4.1.2
|
pylint==4.1.2
|
||||||
pytest==9.1.1
|
pytest==9.1.1
|
||||||
pytest-cov==7.1.0
|
pytest-cov==7.1.0
|
||||||
ruff==0.17.0
|
ruff==0.16.10
|
||||||
|
|||||||
@ -65,7 +65,7 @@ repos:
|
|||||||
types: [python]
|
types: [python]
|
||||||
|
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.17.0
|
rev: v0.16.7
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix, --unsafe-fixes, --exit-non-zero-on-fix, --show-fixes]
|
args: [--fix, --unsafe-fixes, --exit-non-zero-on-fix, --show-fixes]
|
||||||
|
|||||||
@ -7,4 +7,4 @@ pre-commit==4.6.2
|
|||||||
pylint==4.1.2
|
pylint==4.1.2
|
||||||
pytest==9.1.1
|
pytest==9.1.1
|
||||||
pytest-cov==7.1.0
|
pytest-cov==7.1.0
|
||||||
ruff==0.17.0
|
ruff==0.16.10
|
||||||
|
|||||||
@ -65,7 +65,7 @@ repos:
|
|||||||
types: [python]
|
types: [python]
|
||||||
|
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.17.0
|
rev: v0.15.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix, --unsafe-fixes, --exit-non-zero-on-fix, --show-fixes]
|
args: [--fix, --unsafe-fixes, --exit-non-zero-on-fix, --show-fixes]
|
||||||
|
|||||||
@ -8,4 +8,4 @@ pre-commit==4.6.2
|
|||||||
pylint==4.1.2
|
pylint==4.1.2
|
||||||
pytest==9.1.1
|
pytest==9.1.1
|
||||||
pytest-cov==7.1.0
|
pytest-cov==7.1.0
|
||||||
ruff==0.17.0
|
ruff==0.16.10
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user