@@ -22,17 +22,35 @@ jobs:
2222 with :
2323 python-version : " 3.12"
2424
25- - name : Build package
25+ - name : Verify tag version
26+ run : |
27+ python - <<'PY'
28+ import os
29+ from bla.__version__ import __version__
30+ ref = os.environ.get("GITHUB_REF_NAME", "")
31+ if ref.startswith("v") and ref[1:] != __version__:
32+ raise SystemExit(f"Tag {ref} does not match package version {__version__}")
33+ PY
34+
35+ - name : Run validation
2636 run : |
27- python -m pip install --upgrade build
28- python -m build
37+ python -m pip install --upgrade build twine pytest
38+ python -m pytest -q
39+ python -m compileall -q bla bla_cli.py setup.py tests
40+ python bla_cli.py validate-rules --strict-metadata
41+ python bla_cli.py ssh --help
42+
43+ - name : Build package
44+ run : python -m build
2945
3046 - name : Check distribution metadata
3147 run : |
48+ python -m twine check dist/*
3249 python - <<'PY'
3350 from pathlib import Path
3451 import tarfile
3552 import zipfile
53+ from bla.__version__ import __version__
3654
3755 dist = Path("dist")
3856 wheels = sorted(dist.glob("*.whl"))
5371 raise SystemExit("Source distribution is missing bla/rules/web_attacks.yaml")
5472 if not any(name.endswith("/bla/remote/ssh_workspace.py") for name in names):
5573 raise SystemExit("Source distribution is missing bla/remote/ssh_workspace.py")
74+ required = [
75+ f"/docs/releases/v{__version__}.md",
76+ "/sample_logs/auth.log",
77+ "/sample_logs/windows_rdp_sample.xml",
78+ "/tests/fixtures/p0/hvv_chain.jsonl",
79+ ]
80+ for suffix in required:
81+ if not any(name.endswith(suffix) for name in names):
82+ raise SystemExit(f"Source distribution is missing {suffix}")
5683 PY
5784
85+ - name : Smoke test built wheel
86+ run : |
87+ python -m venv /tmp/bla-wheel-smoke
88+ /tmp/bla-wheel-smoke/bin/python -m pip install --upgrade pip
89+ /tmp/bla-wheel-smoke/bin/python -m pip install dist/*.whl
90+ /tmp/bla-wheel-smoke/bin/bla --version
91+ /tmp/bla-wheel-smoke/bin/bla validate-rules --strict-metadata
92+ /tmp/bla-wheel-smoke/bin/bla ssh --help
93+
5894 - name : Publish to PyPI
5995 uses : pypa/gh-action-pypi-publish@release/v1
6096 with :
0 commit comments