Extend galaxy.yml build_ignore (extensions, role molecule scenarios, CLAUDE.md, tool directories, tests/scripts) and add scripts/check_tarball.py, an allow-list check run by the Build workflow after the Collection build and before galaxy-importer. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
# SPDX-FileCopyrightText: Defame1297 and contributors
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
"""Run with: python3 -m unittest discover -s tests/scripts"""
|
|
import pathlib
|
|
import sys
|
|
import unittest
|
|
|
|
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2] / "scripts"))
|
|
import check_tarball # noqa: E402
|
|
|
|
|
|
class TarballTest(unittest.TestCase):
|
|
def test_clean(self):
|
|
self.assertEqual(check_tarball.problems(
|
|
["README.md", "roles/", "roles/a/tasks/main.yml", "LICENSES/MIT.txt", "tests/sanity/x.txt"]), [])
|
|
|
|
def test_stray_top_level(self):
|
|
for name in (".venv/lib/a.py", "CLAUDE.md", ".claude/settings.json", "importer_result.json", "extensions/m.yml"):
|
|
self.assertEqual(len(check_tarball.problems([name])), 1, name)
|
|
|
|
def test_forbidden_inside_allowed(self):
|
|
self.assertEqual(len(check_tarball.problems(["roles/a/molecule/default/molecule.yml"])), 1)
|
|
self.assertEqual(len(check_tarball.problems(["roles/a/files/k.pem"])), 1)
|
|
self.assertEqual(len(check_tarball.problems(["tests/scripts/t.py"])), 1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|