chore: package env example in skill releases
All checks were successful
Publish Python Package to Gitea / publish (push) Successful in 31s
All checks were successful
Publish Python Package to Gitea / publish (push) Successful in 31s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
42
tests/test_release_workflow.py
Normal file
42
tests/test_release_workflow.py
Normal file
@@ -0,0 +1,42 @@
|
||||
"""Text-level checks that reusable-release-skill packages .env.example at package root."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
_REPO_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
||||
_WORKFLOW_PATH = os.path.join(
|
||||
_REPO_ROOT, ".github", "workflows", "reusable-release-skill.yaml"
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def workflow_text() -> str:
|
||||
with open(_WORKFLOW_PATH, encoding="utf-8") as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
def test_workflow_packages_env_example_at_root(workflow_text: str) -> None:
|
||||
assert ".env.example" in workflow_text
|
||||
assert "Copied .env.example" in workflow_text
|
||||
assert "env_example_src = os.path.abspath('.env.example')" in workflow_text
|
||||
assert "env_example_dst = os.path.join(PACKAGE, '.env.example')" in workflow_text
|
||||
assert (
|
||||
"raise RuntimeError('.env.example exists in skill root but was not packaged')"
|
||||
in workflow_text
|
||||
)
|
||||
|
||||
|
||||
def test_workflow_does_not_package_dot_env(workflow_text: str) -> None:
|
||||
# Must not copy live .env to package root (only .env.example).
|
||||
assert not re.search(
|
||||
r"shutil\.copy2\([^)]*['\"]\.env['\"]",
|
||||
workflow_text,
|
||||
)
|
||||
assert not re.search(
|
||||
r"os\.path\.join\(PACKAGE,\s*['\"]\.env['\"]\)",
|
||||
workflow_text,
|
||||
)
|
||||
Reference in New Issue
Block a user