Skip to content

Commit 97856db

Browse files
authored
ci: wip now using hatch build system and updating github actions (#11)
- Migrated to the Hatch build system and updated GitHub Actions for PyPI/TestPyPI publishing. - Prepared GitHub Actions for PyPI OIDC (credential-free) publishing. - Added a TestPyPI environment. - Renamed and refined GitHub Actions workflows, especially `tests.yml`. - Incrementally updated and fixed `tests.yml`. - Added application version logic. - Fixed typos. - Updated CI documentation and removed the `develop`/`testing` branches from workflows.
1 parent d3a2eba commit 97856db

File tree

13 files changed

+450
-919
lines changed

13 files changed

+450
-919
lines changed

.github/workflows/publish.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This workflow publishes the package to TestPyPI when a tag is pushed.
2+
name: Publish
3+
4+
on:
5+
release:
6+
types:
7+
- created
8+
jobs:
9+
test-publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
id-token: write
14+
environment:
15+
name: pypi
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.10'
21+
22+
- uses: astral-sh/setup-uv@v5
23+
with:
24+
enable-cache: true
25+
- run: uv build
26+
27+
- uses: pypa/gh-action-pypi-publish@release/v1
28+
- run: gh release upload $GITHUB_REF_NAME dist/*
29+
env:
30+
GH_TOKEN: ${{ github.token }}

.github/workflows/release.yml

Lines changed: 0 additions & 162 deletions
This file was deleted.

.github/workflows/test-publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This workflow publishes the package to TestPyPI when a tag is pushed.
2+
name: Test Publish
3+
4+
on:
5+
push:
6+
tags:
7+
- 'v[0-9]+.[0-9]+.[0-9]' # Matches semantic versioning tags like v1.0.0
8+
jobs:
9+
test-publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
environment:
15+
name: testpypi
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.10'
21+
- uses: astral-sh/setup-uv@v5
22+
with:
23+
enable-cache: true
24+
- run: uv build
25+
- uses: pypa/gh-action-pypi-publish@release/v1
26+
with:
27+
repository-url: https://test.pypi.org/legacy/

.github/workflows/test-pypi-publish.yml

Lines changed: 0 additions & 108 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Tests
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches: [ main ]
66
paths-ignore:
77
- '**/*.md'
88
- '**/*.jpg'
@@ -32,32 +32,10 @@ permissions:
3232
jobs:
3333
test:
3434
runs-on: ubuntu-latest
35-
3635
steps:
37-
- uses: actions/checkout@v4
38-
with:
39-
fetch-depth: 0 # Important for setuptools_scm to work correctly
40-
41-
- name: Install uv
42-
uses: astral-sh/setup-uv@v4
43-
44-
- name: Set up Python
45-
run: uv python install 3.10
46-
47-
- name: Install dependencies
48-
run: |
49-
uv sync --extra test
50-
51-
- name: Run unit tests
52-
run: |
53-
uv run pytest tests/test_unit.py -v
54-
55-
- name: Test imports and basic functionality
56-
run: |
57-
uv run python -c "from src.ollama_mcp_bridge.mcp_manager import MCPManager; print('✓ MCPManager import works')"
58-
uv run python -c "from src.ollama_mcp_bridge.api import app; print('✓ FastAPI app import works')"
59-
60-
- name: Test version detection
61-
run: |
62-
uv pip install -e .
63-
uv run python -c "from ollama_mcp_bridge import __version__; print(f'Detected version: {__version__}')"
36+
- uses: actions/checkout@v4
37+
- uses: actions/setup-python@v5
38+
- uses: astral-sh/setup-uv@v5
39+
- run: uv sync --dev
40+
- name: Run unit tests
41+
run: uv run pytest tests/test_unit.py -v

0 commit comments

Comments
 (0)