Repository navigation
162 lines (131 loc) · 4.3 KB
/
Copy pathrun_tests.yml
File metadata and controls
162 lines (131 loc) · 4.3 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
name: Run test suite
on:
pull_request:
push:
branches:
- main
jobs:
tests:
strategy:
matrix:
os: [ubuntu-latest]
# NOTE: If bumping the minimum Python version here, also do it in
# ruff.toml, setup.py and other CI files as well.
# test with oldest and latest supported Python versions
python-version: ["3.12", "3.14"]
# test with oldest supported Python version only (for slow tests)
# python-version: ["3.12"]
# test with *all* supported Python versions
# python-version: ["3.12", "3.13", "3.14"]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Set up Git repository
uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Restore UV environment
run: cp production.uv.lock uv.lock
- name: Install dev requirements
run: |
uv sync --extra dev --frozen
- name: Run test suite
run: |
uv run --no-sync pytest \
--cov-report=term-missing:skip-covered \
--cov-report=xml:coverage.xml \
--cov=tesseract_streamlit
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v7.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: ${{ github.repository }}
files: coverage*.xml
fail_ci_if_error: true
test-macos: # note: docker not available
runs-on: macos-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.13"
- name: Restore UV environment
run: cp production.uv.lock uv.lock
- name: Install dev requirements
run: |
uv sync --extra dev --frozen
- name: Run selected tests
run: |
uv run --no-sync pytest --noconftest tests/test_visuals.py::test_pyvista_vis
test-examples:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Restore UV environment
run: cp production.uv.lock uv.lock
- name: Install dev requirements
run: |
uv sync --extra dev --frozen
uv pip install pip
- name: Run example scripts
env:
STREAMLIT_SERVER_HEADLESS: "true"
run: |
source .venv/bin/activate
for example in vectoradd_jax jax_fem; do
echo "::group::$example"
setsid bash "examples/$example/run.sh" > "$example.log" 2>&1 &
pid=$!
for _ in $(seq 1 90); do
curl -sf localhost:8501/_stcore/health > /dev/null && break
sleep 5
done
if ! curl -sf localhost:8501/_stcore/health > /dev/null; then
cat "$example.log"; exit 1
fi
kill -INT -- "-$pid"
wait "$pid" || { cat "$example.log"; exit 1; }
tail -5 "$example.log"
echo "::endgroup::"
done
all-ok:
if: always()
needs: [tests, test-macos, test-examples]
runs-on: ubuntu-latest
steps:
- name: Check for errors
run: |
if [[ "${{ needs.tests.result }}" != "success" && "${{ needs.tests.result }}" != "skipped" ]]; then
echo "Linux tests failed"
exit 1
fi
if [[ "${{ needs.test-macos.result }}" != "success" && "${{ needs.test-macos.result }}" != "skipped" ]]; then
echo "macOS tests failed"
exit 1
fi
if [[ "${{ needs.test-examples.result }}" != "success" && "${{ needs.test-examples.result }}" != "skipped" ]]; then
echo "Example scripts failed"
exit 1
fi
echo "All tests passed!"