Repository navigation
174 lines (144 loc) · 5.21 KB
/
Copy pathci.yml
File metadata and controls
174 lines (144 loc) · 5.21 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-15, windows-latest]
python-version: ["3.11", "3.12", "3.13", "3.14"]
opencv-version: ["4", "5"]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install libegl (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libegl1 libgl1
- name: Install package
run: |
pip install .[dev,tool]
pip install "opencv-python==${{ matrix.opencv-version }}.*" "opencv-contrib-python==${{ matrix.opencv-version }}.*"
cd packages/mvtb-data && pip install .
- name: Install open3d (one leg per supported Python version)
if: matrix.os == 'ubuntu-latest' && matrix.opencv-version == '5'
run: pip install open3d
- name: Install ros extra (rosbags, roslibpy, websockets)
if: matrix.os == 'ubuntu-latest' && matrix.opencv-version == '5'
run: pip install .[ros]
- name: Run tests
env:
MPLBACKEND: Agg
run: python -m pytest --timeout=50 --timeout-method=thread
pgraph-compat:
# BundleAdjust is the only pgraph user and pgraph 1.0 changed API (keyword-only
# graph constructors, UVertex -> Vertex, edges() a list). The main matrix
# installs whatever pip resolves, so run the pgraph-touching tests against
# both the 0.6 series and the newest release explicitly.
name: pgraph compat (${{ matrix.pgraph }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pgraph: ["pgraph-python<1", "pgraph-python"]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install libegl
run: sudo apt-get update && sudo apt-get install -y libegl1 libgl1
- name: Install package
run: |
pip install .[dev,tool]
cd packages/mvtb-data && pip install .
- name: Install requested pgraph
run: |
pip install --upgrade "${{ matrix.pgraph }}"
pip show pgraph-python | grep -i '^version'
- name: Run pgraph tests
env:
MPLBACKEND: Agg
run: python -m pytest tests/test_bundleadjust.py --timeout=50 --timeout-method=thread
typecheck:
name: typecheck and build wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
# open3d and the ros extra are installed so that mypy sees their types: a
# "type: ignore" for one of them is unused, and so an error, where it is missing
- name: Install package and development dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev,ros]
pip install open3d build
# configuration is in pyproject.toml, [tool.mypy]; the package must stay at zero errors
- name: Run mypy
run: mypy
- name: Build wheel and verify typed marker
run: |
python -m build --wheel
python - <<'PY'
from pathlib import Path
from zipfile import ZipFile
wheel = next(Path("dist").glob("machinevision_toolbox_python-*.whl"))
with ZipFile(wheel) as archive:
assert "machinevisiontoolbox/py.typed" in archive.namelist(), (
f"{wheel.name} is missing machinevisiontoolbox/py.typed"
)
PY
all-tests-passed:
name: All tests passed
needs: [test, pgraph-compat, typecheck]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check test matrix result
run: |
if [ "${{ needs.test.result }}" != "success" ]; then
echo "test matrix did not succeed: ${{ needs.test.result }}"
exit 1
fi
if [ "${{ needs.pgraph-compat.result }}" != "success" ]; then
echo "pgraph compat did not succeed: ${{ needs.pgraph-compat.result }}"
exit 1
fi
if [ "${{ needs.typecheck.result }}" != "success" ]; then
echo "typecheck did not succeed: ${{ needs.typecheck.result }}"
exit 1
fi
codecov:
needs: test
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.13"
- name: Install libegl
run: sudo apt-get update && sudo apt-get install -y libegl1 libgl1
- name: Install package
run: |
pip install .[dev,tool]
cd packages/mvtb-data && pip install .
- name: Run coverage
env:
MPLBACKEND: Agg
run: |
coverage run --source=machinevisiontoolbox --omit="src/machinevisiontoolbox/blocks/*,src/machinevision/blocks/*" -m pytest --timeout=50
coverage xml
- name: Upload to Codecov
uses: codecov/codecov-action@v7
with:
file: ./coverage.xml