Skip to content

Commit e261834

Browse files
infra: pypi trusted publishing ci
1 parent 1eefec4 commit e261834

File tree

3 files changed

+64
-1
lines changed

3 files changed

+64
-1
lines changed

.github/workflows/publish.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "Publish"
2+
3+
on:
4+
push:
5+
tags:
6+
# Publish on any tag starting with a `v`, e.g., v0.1.0
7+
- v*
8+
9+
jobs:
10+
run:
11+
runs-on: ubuntu-latest
12+
environment:
13+
name: pypi
14+
permissions:
15+
id-token: write
16+
contents: read
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v6
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v7
22+
- name: Install Python 3.12
23+
run: uv python install 3.12
24+
- name: Build
25+
run: uv build
26+
# Check that basic features work and we didn't miss to include crucial files
27+
- name: Smoke test (wheel)
28+
run: uv run --isolated --no-project --with dist/*.whl tests/smoke_test.py
29+
- name: Smoke test (source distribution)
30+
run: uv run --isolated --no-project --with dist/*.tar.gz tests/smoke_test.py
31+
- name: Publish
32+
run: uv publish

temoa/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import re
22

3-
__version__ = '4.0.0a1.dev20251201'
3+
__version__ = '4.0.0a1'
44

55
# Parse the version string to get major and minor versions
66
# We use a regex to be robust against versions like "4.1a1" or "4.0.0.dev1"

tests/smoke_test.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import subprocess
2+
import sys
3+
import temoa
4+
5+
def test_import() -> None:
6+
print(f"Importing temoa version: {temoa.__version__}")
7+
assert temoa.__version__ is not None
8+
9+
def test_cli() -> None:
10+
print("Running temoa --version CLI command...")
11+
result = subprocess.run(["temoa", "--version"], capture_output=True, text=True)
12+
print(f"CLI output: {result.stdout.strip()}")
13+
assert result.returncode == 0
14+
assert "Temoa Version:" in result.stdout
15+
assert temoa.__version__ in result.stdout
16+
17+
def test_help():
18+
print("Running temoa --help CLI command...")
19+
result = subprocess.run(["temoa", "--help"], capture_output=True, text=True)
20+
assert result.returncode == 0
21+
assert "The Temoa Project" in result.stdout
22+
23+
if __name__ == "__main__":
24+
try:
25+
test_import()
26+
test_cli()
27+
test_help()
28+
print("\n✅ Smoke test passed!")
29+
except Exception as e:
30+
print(f"\n❌ Smoke test failed: {e}")
31+
sys.exit(1)

0 commit comments

Comments
 (0)