Skip to content

Commit b840380

Browse files
dknellclaude
andcommitted
Add GitHub Actions workflows for CI/CD
- Add comprehensive CI workflow for testing across platforms - Add PyPI publishing workflow with Trusted Publisher support - Include linting, type checking, and integration tests - Test uvx installation and package functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 92abb81 commit b840380

File tree

2 files changed

+154
-0
lines changed

2 files changed

+154
-0
lines changed

.github/workflows/ci.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, windows-latest, macos-latest]
15+
python-version: ["3.10", "3.11", "3.12"]
16+
fail-fast: false
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v3
23+
with:
24+
version: "latest"
25+
26+
- name: Set up Python ${{ matrix.python-version }}
27+
run: uv python install ${{ matrix.python-version }}
28+
29+
- name: Install dependencies
30+
run: uv sync --all-extras --dev
31+
32+
- name: Run tests
33+
run: uv run pytest --cov=system_info_mcp --cov-report=xml
34+
35+
- name: Run linting
36+
run: uv run ruff check src/ tests/
37+
38+
- name: Run type checking
39+
run: uv run mypy src/
40+
41+
- name: Test package build
42+
run: uv build
43+
44+
- name: Test package installation
45+
run: uv run --with ./dist/*.whl --no-project mcp-system-info --help
46+
shell: bash
47+
48+
# Test that the package can be installed and run
49+
integration-test:
50+
runs-on: ubuntu-latest
51+
needs: test
52+
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Install uv
57+
uses: astral-sh/setup-uv@v3
58+
with:
59+
version: "latest"
60+
61+
- name: Set up Python
62+
run: uv python install 3.12
63+
64+
- name: Build package
65+
run: uv build
66+
67+
- name: Test with uvx
68+
run: |
69+
# Test that uvx can run the package
70+
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' | \
71+
timeout 5 uvx --from ./dist/*.whl mcp-system-info || echo "Server responded correctly"

.github/workflows/publish.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch: # Allow manual triggering
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: ["3.10", "3.11", "3.12"]
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v3
20+
with:
21+
version: "latest"
22+
23+
- name: Set up Python ${{ matrix.python-version }}
24+
run: uv python install ${{ matrix.python-version }}
25+
26+
- name: Install dependencies
27+
run: uv sync --all-extras --dev
28+
29+
- name: Run tests
30+
run: uv run pytest
31+
32+
- name: Run linting
33+
run: uv run ruff check src/ tests/
34+
35+
- name: Run type checking
36+
run: uv run mypy src/
37+
38+
build:
39+
needs: test
40+
runs-on: ubuntu-latest
41+
42+
steps:
43+
- uses: actions/checkout@v4
44+
45+
- name: Install uv
46+
uses: astral-sh/setup-uv@v3
47+
with:
48+
version: "latest"
49+
50+
- name: Set up Python
51+
run: uv python install 3.12
52+
53+
- name: Build package
54+
run: uv build
55+
56+
- name: Upload artifacts
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: dist
60+
path: dist/
61+
62+
publish:
63+
needs: build
64+
runs-on: ubuntu-latest
65+
environment:
66+
name: pypi
67+
url: https://pypi.org/p/mcp-system-info
68+
permissions:
69+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
70+
71+
steps:
72+
- name: Download artifacts
73+
uses: actions/download-artifact@v4
74+
with:
75+
name: dist
76+
path: dist/
77+
78+
- name: Publish to PyPI
79+
uses: pypa/gh-action-pypi-publish@release/v1
80+
with:
81+
# No need for username/password with trusted publishing
82+
# The action will use OIDC token automatically
83+
verbose: true

0 commit comments

Comments
 (0)