diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..94cf9875 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,32 @@ +name: "Publish" + +on: + push: + tags: + # Publish on any tag starting with a `v`, e.g., v0.1.0 + - v* + +jobs: + run: + runs-on: ubuntu-latest + environment: + name: pypi + permissions: + id-token: write + contents: read + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Install uv + uses: astral-sh/setup-uv@v7 + - name: Install Python 3.12 + run: uv python install 3.12 + - name: Build + run: uv build + # Check that basic features work and we didn't miss to include crucial files + - name: Smoke test (wheel) + run: uv run --isolated --no-project --with dist/*.whl tests/smoke_test.py + - name: Smoke test (source distribution) + run: uv run --isolated --no-project --with dist/*.tar.gz tests/smoke_test.py + - name: Publish + run: uv publish diff --git a/temoa/__about__.py b/temoa/__about__.py index a8b1a2f0..7afb01ef 100644 --- a/temoa/__about__.py +++ b/temoa/__about__.py @@ -1,6 +1,6 @@ import re -__version__ = '4.0.0a1.dev20251201' +__version__ = '4.0.0a1' # Parse the version string to get major and minor versions # We use a regex to be robust against versions like "4.1a1" or "4.0.0.dev1" diff --git a/tests/smoke_test.py b/tests/smoke_test.py new file mode 100644 index 00000000..d1b1e6a0 --- /dev/null +++ b/tests/smoke_test.py @@ -0,0 +1,31 @@ +import subprocess +import sys +import temoa + +def test_import() -> None: + print(f"Importing temoa version: {temoa.__version__}") + assert temoa.__version__ is not None + +def test_cli() -> None: + print("Running temoa --version CLI command...") + result = subprocess.run(["temoa", "--version"], capture_output=True, text=True) + print(f"CLI output: {result.stdout.strip()}") + assert result.returncode == 0 + assert "Temoa Version:" in result.stdout + assert temoa.__version__ in result.stdout + +def test_help() -> None: + print("Running temoa --help CLI command...") + result = subprocess.run(["temoa", "--help"], capture_output=True, text=True) + assert result.returncode == 0 + assert "The Temoa Project" in result.stdout + +if __name__ == "__main__": + try: + test_import() + test_cli() + test_help() + print("\n✅ Smoke test passed!") + except Exception as e: + print(f"\n❌ Smoke test failed: {e}") + sys.exit(1)