-
Notifications
You must be signed in to change notification settings - Fork 2
339 lines (306 loc) · 13.1 KB
/
test.yml
File metadata and controls
339 lines (306 loc) · 13.1 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
---
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# * is a special character in YAML so you have to quote this string
# Run at 1:00 every day
- cron: 0 1 * * *
workflow_dispatch: {}
# We share Vuforia credentials and therefore Vuforia databases across
# workflows. We therefore want to run only one workflow at a time.
concurrency: vuforia_credentials
permissions: {}
jobs:
# CI tests with matrix
ci-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.13']
ci_pattern:
- tests/mock_vws/test_query.py::TestContentType
- tests/mock_vws/test_query.py::TestSuccess
- tests/mock_vws/test_query.py::TestIncorrectFields
- tests/mock_vws/test_query.py::TestMaxNumResults
- tests/mock_vws/test_query.py::TestIncludeTargetData
- tests/mock_vws/test_query.py::TestAcceptHeader
- tests/mock_vws/test_query.py::TestActiveFlag
- tests/mock_vws/test_query.py::TestBadImage
- tests/mock_vws/test_query.py::TestMaximumImageFileSize
- tests/mock_vws/test_query.py::TestMaximumImageDimensions
- tests/mock_vws/test_query.py::TestImageFormats
- tests/mock_vws/test_query.py::TestProcessing
- tests/mock_vws/test_query.py::TestUpdate
- tests/mock_vws/test_query.py::TestDeleted
- tests/mock_vws/test_query.py::TestTargetStatusFailed
- tests/mock_vws/test_query.py::TestDateFormats
- tests/mock_vws/test_query.py::TestInactiveProject
- tests/mock_vws/test_add_target.py::TestContentTypes
- tests/mock_vws/test_add_target.py::TestMissingData
- tests/mock_vws/test_add_target.py::TestWidth
- tests/mock_vws/test_add_target.py::TestTargetName
- tests/mock_vws/test_add_target.py::TestImage
- tests/mock_vws/test_add_target.py::TestActiveFlag
- tests/mock_vws/test_add_target.py::TestUnexpectedData
- tests/mock_vws/test_add_target.py::TestApplicationMetadata
- tests/mock_vws/test_add_target.py::TestInactiveProject
- tests/mock_vws/test_authorization_header.py::TestAuthorizationHeader
- tests/mock_vws/test_authorization_header.py::TestMalformed::test_one_part_no_space
- tests/mock_vws/test_authorization_header.py::TestMalformed::test_one_part_with_space
- tests/mock_vws/test_authorization_header.py::TestMalformed::test_missing_signature
- tests/mock_vws/test_authorization_header.py::TestBadKey
- tests/mock_vws/test_content_length.py::TestIncorrect::test_not_integer
- tests/mock_vws/test_content_length.py::TestIncorrect::test_too_large
- tests/mock_vws/test_content_length.py::TestIncorrect::test_too_small
- tests/mock_vws/test_database_summary.py::TestDatabaseSummary::test_success
- tests/mock_vws/test_database_summary.py::TestDatabaseSummary::test_active_images
- tests/mock_vws/test_database_summary.py::TestDatabaseSummary::test_failed_images
- tests/mock_vws/test_database_summary.py::TestDatabaseSummary::test_inactive_images
- tests/mock_vws/test_database_summary.py::TestDatabaseSummary::test_inactive_failed
- tests/mock_vws/test_database_summary.py::TestDatabaseSummary::test_deleted
- tests/mock_vws/test_database_summary.py::TestProcessingImages
- tests/mock_vws/test_database_summary.py::TestQuotas
- tests/mock_vws/test_database_summary.py::TestRecos
- tests/mock_vws/test_database_summary.py::TestRequestUsage
- tests/mock_vws/test_database_summary.py::TestInactiveProject
- tests/mock_vws/test_date_header.py::TestFormat
- tests/mock_vws/test_date_header.py::TestMissing
- tests/mock_vws/test_date_header.py::TestSkewedTime::test_date_out_of_range_after
- tests/mock_vws/test_date_header.py::TestSkewedTime::test_date_out_of_range_before
- tests/mock_vws/test_date_header.py::TestSkewedTime::test_date_in_range_after
- tests/mock_vws/test_date_header.py::TestSkewedTime::test_date_in_range_before
- tests/mock_vws/test_delete_target.py
- tests/mock_vws/test_get_duplicates.py
- tests/mock_vws/test_get_target.py
- tests/mock_vws/test_invalid_given_id.py
- tests/mock_vws/test_invalid_json.py::TestInvalidJSON::test_invalid_json
- tests/mock_vws/test_invalid_json.py::TestInvalidJSON::test_invalid_json_with_skewed_time
- tests/mock_vws/test_target_list.py
- tests/mock_vws/test_target_raters.py
- tests/mock_vws/test_target_summary.py
- tests/mock_vws/test_unexpected_json.py
- tests/mock_vws/test_update_target.py::TestActiveFlag
- tests/mock_vws/test_update_target.py::TestApplicationMetadata::test_base64_encoded
- tests/mock_vws/test_update_target.py::TestApplicationMetadata::test_invalid_type
- tests/mock_vws/test_update_target.py::TestApplicationMetadata::test_not_base64_encoded_processable
- tests/mock_vws/test_update_target.py::TestApplicationMetadata::test_not_base64_encoded_not_processable
- tests/mock_vws/test_update_target.py::TestApplicationMetadata::test_metadata_too_large
- tests/mock_vws/test_update_target.py::TestImage::test_image_valid
- tests/mock_vws/test_update_target.py::TestImage::test_bad_image_format_or_color_space
- tests/mock_vws/test_update_target.py::TestImage::test_corrupted
- tests/mock_vws/test_update_target.py::TestImage::test_image_too_large
- tests/mock_vws/test_update_target.py::TestImage::test_not_base64_encoded_processable
- tests/mock_vws/test_update_target.py::TestImage::test_not_base64_encoded_not_processable
- tests/mock_vws/test_update_target.py::TestImage::test_not_image
- tests/mock_vws/test_update_target.py::TestImage::test_invalid_type
- tests/mock_vws/test_update_target.py::TestImage::test_rating_can_change
- tests/mock_vws/test_update_target.py::TestTargetName::test_name_valid
- tests/mock_vws/test_update_target.py::TestTargetName::test_name_invalid
- tests/mock_vws/test_update_target.py::TestTargetName::test_existing_target_name
- tests/mock_vws/test_update_target.py::TestTargetName::test_same_name_given
- tests/mock_vws/test_update_target.py::TestUnexpectedData
- tests/mock_vws/test_update_target.py::TestUpdate
- tests/mock_vws/test_update_target.py::TestWidth
- tests/mock_vws/test_update_target.py::TestInactiveProject
- tests/mock_vws/test_requests_mock_usage.py
- tests/mock_vws/test_flask_app_usage.py
- tests/mock_vws/test_vumark_generation_api.py
- tests/mock_vws/test_docker.py
- README.rst
- docs/source/basic-example.rst
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: '**/pyproject.toml'
- name: Set secrets file
run: |
# See the "CI Setup" document for details of how this was set up.
ci/decrypt_secret.sh
tar xvf "${HOME}"/secrets/secrets.tar
cp ./ci_secrets/vuforia_secrets_${{ strategy.job-index }}.env ./vuforia_secrets.env
env:
CI_PATTERN: ${{ matrix.ci_pattern }}
ENCRYPTED_FILE: secrets.tar.gpg
LARGE_SECRET_PASSPHRASE: ${{ secrets.PASSPHRASE_FOR_VUFORIA_SECRETS }}
# We have seen issues with running out of disk space on test_docker
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
if: matrix.ci_pattern == 'tests/mock_vws/test_docker.py'
with:
# All of these default to true (meaning they are removed).
docker-images: false
large-packages: false
swap-storage: false
tool-cache: false
android: true
dotnet: true
haskell: true
- name: Run tests
run: |
uv run --extra=dev \
coverage run -m pytest \
-s \
-vvv \
--showlocals \
--exitfirst \
${{ matrix.ci_pattern }}
env:
UV_PYTHON: ${{ matrix.python-version }}
- name: Sanitize pattern for artifact name
id: sanitize
run: |
SANITIZED_PATTERN=$(echo "${{ matrix.ci_pattern }}" | sed 's/::/-/g' | sed 's/:/-/g' | sed 's|/|-|g')
echo "name=coverage-data-ci-${{ matrix.python-version }}-${SANITIZED_PATTERN}" >> "$GITHUB_OUTPUT"
- name: Upload coverage data
uses: actions/upload-artifact@v7
with:
name: ${{ steps.sanitize.outputs.name }}
path: .coverage.*
include-hidden-files: true
if-no-files-found: error
# Skip tests
skip-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.13']
platform: [ubuntu-latest]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: '**/pyproject.toml'
- name: Set secrets file
run: |
cp ./vuforia_secrets.env.example ./vuforia_secrets.env
- name: Run tests
run: |
uv run --extra=dev \
coverage run -m pytest \
--skip-docker_build_tests \
--skip-docker_in_memory \
--skip-mock \
--skip-real \
--capture=no \
-vvv \
--exitfirst \
.
env:
UV_PYTHON: ${{ matrix.python-version }}
- name: Upload coverage data
uses: actions/upload-artifact@v7
with:
name: coverage-data-skip-tests-${{ matrix.python-version }}
path: .coverage.*
include-hidden-files: true
if-no-files-found: error
# Windows tests
windows-tests:
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.13']
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: '**/pyproject.toml'
- name: Set secrets file
run: |
cp ./vuforia_secrets.env.example ./vuforia_secrets.env
- name: Run tests
shell: bash
run: |
# We use pytest-xdist to make this run much faster.
# The downside is that we cannot use -s / --capture=no.
#
# We use coverage to collect coverage data but we currently
# do not upload / use it because combining Windows and Linux
# coverage is challenging.
#
# We therefore have a few ``# pragma: no cover`` statements.
uv run --extra=dev \
coverage run -m pytest \
--skip-real \
-vvv \
--exitfirst \
-n auto \
.
env:
UV_PYTHON: ${{ matrix.python-version }}
coverage:
name: Combine & check coverage
needs: [ci-tests, skip-tests, windows-tests]
if: always()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: '**/pyproject.toml'
- uses: actions/download-artifact@v8
with:
pattern: coverage-data-*
merge-multiple: true
- name: Require 100% Coverage
id: coverage
run: |
uv tool install 'coverage[toml]'
coverage combine
coverage html --skip-covered --skip-empty
# Report and write to summary.
coverage report --format=markdown >> "$GITHUB_STEP_SUMMARY"
# Report again and fail if under 100%.
coverage report
- name: Upload HTML report if check failed
uses: actions/upload-artifact@v7
with:
name: html-report
path: htmlcov
if: ${{ failure() }}
# Final completion check
completion:
needs: [ci-tests, skip-tests, windows-tests, coverage]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check all jobs status
run: |-
if ! ${{ needs.ci-tests.result == 'success' }}; then
echo "CI tests failed"
exit 1
fi
if ! ${{ needs.skip-tests.result == 'success' }}; then
echo "Skip tests failed"
exit 1
fi
if ! ${{ needs.windows-tests.result == 'success' }}; then
echo "Windows tests failed"
exit 1
fi
if ! ${{ needs.coverage.result == 'success' }}; then
echo "Coverage check failed"
exit 1
fi