ci(molecule): stop running every scenario for files no scenario reads #299
No files matched your search
@@ -38,8 +38,8 @@ nothing tested. A role whose directory is gone (the role was deleted) selects no
|
||||
|
||||
The workflow runs this script from the base branch's copy, not the pull request's, so a pull
|
||||
request cannot edit the rules it is judged by (the same reason lint.yml runs
|
||||
check_bot_pr_diff.py from origin/main). A change to this file therefore selects everything
|
||||
under the base copy's rules, because the file is not on the IGNORED list.
|
||||
check_bot_pr_diff.py from origin/main). No scenario runs the pull request's copy, so this file
|
||||
is on the IGNORED list: its unit tests test it, and the push run after the merge runs it.
|
||||
|
||||
Exit codes: 0 ok (an empty selection from an all-ignored diff is ok), 1 no scenario exists at
|
||||
all, or a changed role has none, 2 bad usage. Notices go to stderr as `::notice::` lines, with
|
||||
@@ -63,7 +63,8 @@ IGNORED = (
|
||||
"SECURITY.md",
|
||||
"GLOSSARY.md",
|
||||
"AGENTS.md",
|
||||
"roles/AGENTS.md",
|
||||
"*/AGENTS.md",
|
||||
"roles/*/README.md",
|
||||
"CODEOWNERS",
|
||||
"CHANGELOG.rst",
|
||||
"COPYING",
|
||||
@@ -75,6 +76,7 @@ IGNORED = (
|
||||
".ansible-lint",
|
||||
".ansible-lint-ignore",
|
||||
".pre-commit-config.yaml",
|
||||
".python-version",
|
||||
"requirements-dev.txt",
|
||||
"requirements-dev.lock",
|
||||
"ruff.toml",
|
||||
@@ -100,6 +102,8 @@ IGNORED = (
|
||||
"scripts/ansible-test-sanity.sh",
|
||||
"scripts/dev-setup.sh",
|
||||
"scripts/reuse_lint.py",
|
||||
"scripts/lock-requirements.sh",
|
||||
"scripts/select_molecule_scenarios.py",
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -162,6 +162,32 @@ class SelectTest(unittest.TestCase):
|
||||
chosen, _reason = sel.select(ALL, ["AGENTS.md"])
|
||||
self.assertEqual(chosen, [])
|
||||
|
||||
def test_nested_agent_guidance_selects_nothing(self):
|
||||
chosen, _reason = self.select(
|
||||
[
|
||||
".gitea/workflows/AGENTS.md",
|
||||
"scripts/AGENTS.md",
|
||||
"roles/docker/AGENTS.md",
|
||||
],
|
||||
)
|
||||
self.assertEqual(chosen, [])
|
||||
|
||||
def test_role_readme_selects_nothing(self):
|
||||
# A role's README is documentation; its scenarios and its users' do not read it.
|
||||
chosen, _reason = self.select(["roles/docker/README.md"])
|
||||
self.assertEqual(chosen, [])
|
||||
|
||||
def test_selector_and_dev_python_select_nothing(self):
|
||||
# Molecule runs the base copy of the selector and the runner's own venv.
|
||||
chosen, _reason = self.select(
|
||||
[
|
||||
"scripts/select_molecule_scenarios.py",
|
||||
"scripts/lock-requirements.sh",
|
||||
".python-version",
|
||||
],
|
||||
)
|
||||
self.assertEqual(chosen, [])
|
||||
|
||||
def test_issue_and_pull_request_templates_select_nothing(self):
|
||||
# Gitea reads them for its web forms; no scenario does, and they are not shipped.
|
||||
chosen, _reason = self.select(
|
||||
@@ -184,7 +210,6 @@ class SelectTest(unittest.TestCase):
|
||||
"plugins/modules/x.py",
|
||||
"extensions/molecule/image-smoke/molecule.yml",
|
||||
".gitea/workflows/molecule.yml",
|
||||
"scripts/select_molecule_scenarios.py",
|
||||
"tests/unit/x.py",
|
||||
"new_top_level_file",
|
||||
"roles/README.md",
|
||||
|
||||
Reference in new issue
Block a user