Skip to content

Commit f4f7c30

Browse files
committed
feat(workflows): add GitHub Actions workflows for publishing and testing
- Create a publish workflow that triggers on version tag pushes, installs dependencies, runs tests, builds the package, and publishes to PyPI. - Create a test workflow that triggers on pushes and pull requests to main and develop branches, sets up Python, installs dependencies, runs linting, type checking, and tests with coverage.
1 parent 162af10 commit f4f7c30

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed

.github/workflows/publish.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Publish
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
strategy:
7+
matrix:
8+
python-version: ["3.11"]
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
21+
- name: Install uv
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install uv
25+
26+
- name: Install dev/test dependencies
27+
run: |
28+
pip install -e ".[dev]"
29+
pip install -e ".[test]"
30+
31+
- name: Run tests
32+
run: |
33+
make check
34+
35+
publish:
36+
needs: test
37+
runs-on: ubuntu-latest
38+
environment: release
39+
permissions:
40+
id-token: write
41+
42+
steps:
43+
- uses: actions/checkout@v4
44+
45+
- name: Update version from tag
46+
run: |
47+
# Strip 'v' prefix from tag and update version.py
48+
VERSION=${GITHUB_REF#refs/tags/v}
49+
echo "__version__ = \"${VERSION}\"" > mcp_shell_server/version.py
50+
51+
- name: Set up Python ${{ matrix.python-version }}
52+
uses: actions/setup-python@v5
53+
with:
54+
python-version: ${{ matrix.python-version }}
55+
56+
- name: Install uv
57+
run: |
58+
python -m pip install --upgrade pip
59+
pip install uv
60+
61+
- name: Build package
62+
run: |
63+
uv build
64+
65+
- name: Publish to PyPI
66+
env:
67+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
68+
run: |
69+
uv publish --token $PYPI_TOKEN

.github/workflows/test.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.11"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install uv
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install uv
28+
29+
- name: Install dev/test dependencies
30+
run: |
31+
pip install -e ".[dev]"
32+
pip install -e ".[test]"
33+
34+
- name: Run lint and typecheck
35+
run: |
36+
make lint typecheck
37+
38+
- name: Run tests with coverage
39+
run: |
40+
pytest --cov --cov-report=xml
41+
42+
- name: Upload coverage to Codecov
43+
uses: codecov/codecov-action@v5
44+
with:
45+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)