Skip to content

Commit 2e5336b

Browse files
abrichrclaude
andauthored
ci: add release automation and CI workflows (#3)
- Add test.yml workflow (lint + pytest on Python 3.10-3.12) - Add release.yml workflow (python-semantic-release + PyPI publish via OIDC) - Add semantic_release config to pyproject.toml - Add project.urls metadata - Bump version to 0.3.0 to match latest PyPI release Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e001654 commit 2e5336b

4 files changed

Lines changed: 116 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Release and PyPI Publish
2+
3+
# Requires ADMIN_TOKEN secret (GitHub PAT with repo scope) to push release
4+
# commits to protected branches. Without it, the tag gets created but the
5+
# version bump commit is rejected by branch protection, orphaning the tag.
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
concurrency: release
16+
permissions:
17+
id-token: write
18+
contents: write
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
token: ${{ secrets.ADMIN_TOKEN }}
26+
27+
- name: Check if should skip
28+
id: check_skip
29+
run: |
30+
if [ "$(git log -1 --pretty=format:'%an')" = "semantic-release" ]; then
31+
echo "skip=true" >> $GITHUB_OUTPUT
32+
fi
33+
34+
- name: Set up Python
35+
if: steps.check_skip.outputs.skip != 'true'
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: '3.12'
39+
40+
- name: Install uv
41+
if: steps.check_skip.outputs.skip != 'true'
42+
uses: astral-sh/setup-uv@v4
43+
44+
- name: Python Semantic Release
45+
if: steps.check_skip.outputs.skip != 'true'
46+
id: release
47+
uses: python-semantic-release/python-semantic-release@v9.15.2
48+
with:
49+
github_token: ${{ secrets.ADMIN_TOKEN }}
50+
51+
- name: Build package
52+
if: steps.check_skip.outputs.skip != 'true' && steps.release.outputs.released == 'true'
53+
run: uv build
54+
55+
- name: Publish to PyPI
56+
if: steps.check_skip.outputs.skip != 'true' && steps.release.outputs.released == 'true'
57+
uses: pypa/gh-action-pypi-publish@release/v1
58+
59+
- name: Publish to GitHub Releases
60+
if: steps.check_skip.outputs.skip != 'true' && steps.release.outputs.released == 'true'
61+
uses: python-semantic-release/publish-action@v9.15.2
62+
with:
63+
github_token: ${{ secrets.ADMIN_TOKEN }}

.github/workflows/test.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.10", "3.11", "3.12"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
- uses: astral-sh/setup-uv@v4
24+
25+
- name: Install dependencies
26+
run: uv sync --extra dev
27+
28+
- name: Lint
29+
run: uv run ruff check src/ tests/
30+
31+
- name: Test
32+
run: uv run pytest tests/ -m "not live" -v --timeout=60

pyproject.toml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "consilium"
3-
version = "0.1.0"
3+
version = "0.3.0"
44
description = "Multi-LLM council for consensus-driven AI responses"
55
readme = "README.md"
66
requires-python = ">=3.10"
@@ -46,6 +46,25 @@ markers = [
4646
"live: integration tests that require real API keys (deselect with '-m \"not live\"')",
4747
]
4848

49+
[project.urls]
50+
Homepage = "https://github.com/OpenAdaptAI/openadapt-consilium"
51+
Repository = "https://github.com/OpenAdaptAI/openadapt-consilium"
52+
"Bug Tracker" = "https://github.com/OpenAdaptAI/openadapt-consilium/issues"
53+
4954
[tool.ruff]
5055
target-version = "py310"
5156
line-length = 88
57+
58+
[tool.semantic_release]
59+
version_toml = ["pyproject.toml:project.version"]
60+
version_variables = ["src/consilium/__init__.py:__version__"]
61+
commit_message = "chore: release {version}"
62+
major_on_zero = false
63+
64+
[tool.semantic_release.branches.main]
65+
match = "main"
66+
67+
[tool.semantic_release.commit_parser_options]
68+
allowed_tags = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "style", "test"]
69+
minor_tags = ["feat"]
70+
patch_tags = ["fix", "perf"]

src/consilium/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from consilium.model_registry import get_latest, list_models
2222
from consilium.sdk import council_query
2323

24-
__version__ = "0.1.0"
24+
__version__ = "0.3.0"
2525
__all__ = [
2626
"Council",
2727
"CouncilResult",

0 commit comments

Comments
 (0)