Skip to content

Commit 6452f28

Browse files
authored
Remove examples drom default CI for speedup (#359)
1 parent 0552d8a commit 6452f28

3 files changed

Lines changed: 41 additions & 4 deletions

File tree

.github/workflows/python-app.yaml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,40 @@ jobs:
8585

8686
- name: Install dependencies
8787
run: |
88-
uv pip install --system .[dev] "pytest-xdist==3.*"
88+
uv pip install --system .[dev]
8989
9090
- name: Run tests
9191
run: pytest -v -p no:warnings --numprocesses=auto
9292

93+
test-examples:
94+
runs-on: ubuntu-24.04
95+
timeout-minutes: 45
96+
needs: lint
97+
# Only run examples on releases (tags)
98+
if: startsWith(github.ref, 'refs/tags/v')
99+
100+
steps:
101+
- name: Check out code
102+
uses: actions/checkout@v5
103+
104+
- name: Set up uv
105+
uses: astral-sh/setup-uv@v6
106+
with:
107+
version: "0.8.19"
108+
enable-cache: true
109+
110+
- name: Set up Python ${{ env.PYTHON_VERSION }}
111+
uses: actions/setup-python@v6
112+
with:
113+
python-version: ${{ env.PYTHON_VERSION }}
114+
115+
- name: Install dependencies
116+
run: |
117+
uv pip install --system .[dev]
118+
119+
- name: Run example tests
120+
run: pytest -v -p no:warnings -m examples
121+
93122
security:
94123
name: Security Scan
95124
runs-on: ubuntu-24.04
@@ -129,7 +158,7 @@ jobs:
129158
runs-on: ubuntu-24.04
130159
permissions:
131160
contents: write
132-
needs: [lint, test, security]
161+
needs: [lint, test, test-examples, security]
133162
if: startsWith(github.ref, 'refs/tags/v')
134163

135164
steps:
@@ -168,7 +197,7 @@ jobs:
168197
publish-testpypi:
169198
name: Publish to TestPyPI
170199
runs-on: ubuntu-24.04
171-
needs: [test, create-release] # Run after tests and release creation
200+
needs: [test, test-examples, create-release] # Run after tests and release creation
172201
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') # Only on tag push
173202
environment:
174203
name: testpypi

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ full = [
8080
# Development tools and testing
8181
dev = [
8282
"pytest==8.4.2",
83+
"pytest-xdist==3.8.0",
8384
"nbformat==5.10.4",
8485
"ruff==0.13.0",
8586
"pre-commit==4.3.0",
@@ -176,6 +177,13 @@ docstring-code-format = true
176177
[tool.ruff.lint.pyupgrade]
177178
keep-runtime-typing = false # Allow pyupgrade to drop runtime typing; prefer postponed annotations
178179

180+
[tool.pytest.ini_options]
181+
markers = [
182+
"slow: marks tests as slow",
183+
"examples: marks example tests (run only on releases)",
184+
]
185+
addopts = "-m 'not examples'" # Skip examples by default
186+
179187
[tool.bandit]
180188
skips = ["B101", "B506"] # assert_used and yaml_load
181189
exclude_dirs = ["tests/"]

tests/test_examples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
), # Sort by parent and script name
1717
ids=lambda path: str(path.relative_to(EXAMPLES_DIR)), # Show relative file paths
1818
)
19-
@pytest.mark.slow
19+
@pytest.mark.examples
2020
def test_example_scripts(example_script):
2121
"""
2222
Test all example scripts in the examples directory.

0 commit comments

Comments
 (0)