-
Notifications
You must be signed in to change notification settings - Fork 15
140 lines (131 loc) · 4.79 KB
/
Copy pathci.yml
File metadata and controls
140 lines (131 loc) · 4.79 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: CI
on:
push:
branches: [main, master]
pull_request:
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
pre-commit:
name: pre-commit hooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install development dependencies
run: python -m pip install --upgrade pip && python -m pip install -e ".[dev]"
- name: Run pre-commit hooks
run: python -m pre_commit run --all-files --show-diff-on-failure
test:
name: core tests (${{ matrix.os }} / py${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install package and dev dependencies
run: python -m pip install --upgrade pip && python -m pip install -e ".[dev]"
- name: Check declared SDK and Pydantic minimums
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'
run: python -m pip install "mcp==2.2.0" "pydantic==2.12.0"
- name: Run core test suite
run: >-
python -m pytest -p no:cacheprovider
--ignore=tests/test_nx_session.py --ignore=tests/test_registry.py
--ignore=tests/test_response.py --ignore=tests/test_tools
-m "not legacy and not real_nx"
legacy-test:
name: legacy mock-NX tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install package and dev dependencies
run: python -m pip install --upgrade pip && python -m pip install -e ".[dev]"
- name: Run legacy mock-NX tests
run: >-
python -m pytest -p no:cacheprovider -m legacy
tests/test_nx_session.py tests/test_registry.py tests/test_response.py tests/test_tools
coverage:
name: branch coverage (ubuntu / py3.12)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install package and dev dependencies
run: python -m pip install --upgrade pip && python -m pip install -e ".[dev]"
- name: Enforce branch coverage
run: >-
python -m pytest -p no:cacheprovider
-m "not real_nx"
--cov=nx_mcp --cov-branch --cov-report=xml --cov-report=term-missing
--cov-fail-under=78
- name: Upload coverage artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-ubuntu-py3.12
path: coverage.xml
if-no-files-found: warn
type-check:
name: mypy sidecar type check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install package and dev dependencies
run: python -m pip install --upgrade pip && python -m pip install -e ".[dev]"
- name: Run mypy
run: python -m mypy src/nx_mcp
wheel:
name: isolated wheel import (no NX)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Build wheel
run: python -m pip wheel . --no-deps -w dist
- name: Install wheel outside checkout
shell: pwsh
run: |
python -m venv "$env:RUNNER_TEMP/wheel-env"
$python = "$env:RUNNER_TEMP/wheel-env/bin/python"
& $python -m pip install (Get-Item dist/nx_mcp-*.whl).FullName
if ($LASTEXITCODE -ne 0) { throw "Wheel installation failed" }
Push-Location $env:RUNNER_TEMP
try {
& $python -c "import importlib.metadata as m; import nx_mcp.server, nx_mcp.nx_bridge; assert m.version('nx-mcp') == '0.2.0.dev0'; assert {e.name for e in m.distribution('nx-mcp').entry_points} >= {'nx-mcp', 'nx-mcp-smoke'}; assert all(callable(e.load()) for e in m.distribution('nx-mcp').entry_points)"
if ($LASTEXITCODE -ne 0) { throw "Wheel imports or entry points failed" }
& $python -m nx_mcp.real_smoke --help
if ($LASTEXITCODE -ne 0) { throw "Smoke CLI failed" }
} finally { Pop-Location }
- uses: actions/upload-artifact@v4
with:
name: wheel
path: dist/*.whl