-
Notifications
You must be signed in to change notification settings - Fork 4k
106 lines (90 loc) · 2.89 KB
/
Copy pathmcp-server.yml
File metadata and controls
106 lines (90 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Build & Publish (mcp-server)
# Build, test, and publish the Python MCP server (mcp-server/) to PyPI.
# Publishing uses PyPI Trusted Publishing (OIDC) — no API token required,
# only the GitHub→PyPI OIDC trust configured on the repo.
#
# Release tags: mcp-server-v* (e.g. mcp-server-v1.0.1)
on:
push:
branches: [main]
tags:
- "mcp-server-v*"
paths:
- "mcp-server/**"
- ".github/workflows/mcp-server.yml"
pull_request:
paths:
- "mcp-server/**"
- ".github/workflows/mcp-server.yml"
workflow_dispatch:
permissions:
contents: read
jobs:
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
defaults:
run:
working-directory: mcp-server
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies (test extras)
run: uv sync --python ${{ matrix.python-version }} --extra test
- name: Run tests
# unittest avoids pytest importing __init__.py as a broken package root.
run: uv run --python ${{ matrix.python-version }} python -m unittest discover -s . -p "test_*.py" -v
build:
name: Build sdist + wheel
needs: test
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/mcp-server-v')
defaults:
run:
working-directory: mcp-server
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Set up Python
run: uv python install 3.12
- name: Build package
run: uv build
- name: Verify wheel contains upload_paths.py (regression guard)
run: |
set -e
if ! python3 -c "import glob, zipfile, sys; whl=glob.glob('dist/*.whl')[0]; z=zipfile.ZipFile(whl); sys.exit(0 if 'upload_paths.py' in z.namelist() else 1)"; then
echo "::error::upload_paths.py is missing from the wheel — check py-modules in pyproject.toml/setup.py"
exit 1
fi
echo "upload_paths.py present in wheel ✓"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: mcp-server/dist/
publish:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/mcp-server-v')
permissions:
id-token: write
environment:
name: pypi
url: https://pypi.org/project/weknora-mcp/
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1