Skip to content

Commit 2d02c54

Browse files
committed
refactor: optimize CI workflow with path filters and dependency installation
- Added path filters to only trigger tests when Python source or workflow files change - Split dependency installation into sync and dev install steps for better clarity - Fixed YAML indentation for improved readability
1 parent c7208ea commit 2d02c54

File tree

1 file changed

+39
-32
lines changed

1 file changed

+39
-32
lines changed

.github/workflows/python-tests.yml

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,49 @@
11
name: Python Tests
22

33
on:
4-
push:
5-
branches: ["**"]
6-
pull_request:
7-
workflow_dispatch: {}
4+
push:
5+
branches: ["**"]
6+
paths:
7+
- MCPForUnity/UnityMcpServer~/src/**
8+
- .github/workflows/python-tests.yml
9+
pull_request:
10+
paths:
11+
- MCPForUnity/UnityMcpServer~/src/**
12+
- .github/workflows/python-tests.yml
13+
workflow_dispatch: {}
814

915
jobs:
10-
test:
11-
name: Run Python Tests
12-
runs-on: ubuntu-latest
13-
steps:
14-
- name: Checkout repository
15-
uses: actions/checkout@v4
16+
test:
17+
name: Run Python Tests
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
1622

17-
- name: Install uv
18-
uses: astral-sh/setup-uv@v4
19-
with:
20-
version: "latest"
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v4
25+
with:
26+
version: "latest"
2127

22-
- name: Set up Python
23-
run: uv python install 3.10
28+
- name: Set up Python
29+
run: uv python install 3.10
2430

25-
- name: Install dependencies
26-
run: |
27-
cd MCPForUnity/UnityMcpServer~/src
28-
uv sync --dev
31+
- name: Install dependencies
32+
run: |
33+
cd MCPForUnity/UnityMcpServer~/src
34+
uv sync
35+
uv pip install -e ".[dev]"
2936
30-
- name: Run tests
31-
run: |
32-
cd MCPForUnity/UnityMcpServer~/src
33-
uv run pytest tests/ -v --tb=short
37+
- name: Run tests
38+
run: |
39+
cd MCPForUnity/UnityMcpServer~/src
40+
uv run pytest tests/ -v --tb=short
3441
35-
- name: Upload test results
36-
uses: actions/upload-artifact@v4
37-
if: always()
38-
with:
39-
name: pytest-results
40-
path: |
41-
MCPForUnity/UnityMcpServer~/src/.pytest_cache/
42-
tests/
42+
- name: Upload test results
43+
uses: actions/upload-artifact@v4
44+
if: always()
45+
with:
46+
name: pytest-results
47+
path: |
48+
MCPForUnity/UnityMcpServer~/src/.pytest_cache/
49+
tests/

0 commit comments

Comments
 (0)