-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
123 lines (103 loc) · 4.34 KB
/
Copy pathrun-tests.yml
File metadata and controls
123 lines (103 loc) · 4.34 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
# .github/workflows/run-tests.yml
# Reusable workflow – called by continuous-integration.yml
#
# Runs on a single OS/Python combination:
# 1. Lint with flake8
# 2. Test with pytest (+coverage upload on Linux)
# 3. Smoke-test meshroom_compute with Python 3.9
name: Run tests
on:
workflow_call:
inputs:
os:
description: "Runner OS: 'ubuntu-latest' or 'windows-latest'"
type: string
required: true
python-version:
description: "Python version used for lint + tests"
type: string
default: '3.11'
secrets:
CODECOV_TOKEN:
description: "Codecov upload token (only needed on Linux)"
required: false
env:
CI: true
PYTHONPATH: ${{ github.workspace }}
jobs:
test:
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v6
# ── Primary Python environment ───────────────────────────
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
pip install -r requirements.txt -r dev_requirements.txt --timeout 45
# ── Lint ─────────────────────────────────────────────────
- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Treat all other errors as warnings (line length 127, GitHub editor width)
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# ── Tests ────────────────────────────────────────────────
- name: Test with pytest
run: pytest tests/
# Coverage is generated and uploaded only on Linux to avoid double-counting
- name: Test with pytest (coverage)
if: runner.os == 'Linux'
run: pytest --cov --cov-report=xml --junitxml=junit.xml
- name: Upload coverage to Codecov
if: runner.os == 'Linux'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: runner.os == 'Linux' && !cancelled()
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
report_type: test_results
# ── meshroom_compute smoke test (Python 3.9) ─────────────
# Verifies that the CLI entry-point works on the minimum "ideal" supported version.
- name: Set up Python 3.9 – meshroom_compute smoke test
uses: actions/setup-python@v6
with:
python-version: '3.9'
- name: Install runtime dependencies (Python 3.9)
shell: bash
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt -r dev_requirements.txt --timeout 45
- name: Run meshroom_compute –h (Python 3.9)
run: python3 bin/meshroom_compute -h
- name: Run tests for plugins (Python 3.9)
run: |
pytest tests/test_plugins.py
# ── meshroom_compute smoke test (Python 3.7) ─────────────
# Verifies that the CLI entry-point works on the minimum supported version.
- name: Set up Python 3.7 – meshroom_compute smoke test
uses: actions/setup-python@v6
if: runner.os == 'Windows'
with:
python-version: '3.7'
- name: Install runtime dependencies (Python 3.7)
if: runner.os == 'Windows'
shell: bash
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt -r dev_requirements.txt --timeout 45
- name: Run meshroom_compute –h (Python 3.7)
if: runner.os == 'Windows'
run: python3 bin/meshroom_compute -h
- name: Run tests for plugins (Python 3.7)
if: runner.os == 'Windows'
run: |
pytest tests/test_plugins.py