Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---

name: Windows CI

on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
# * is a special character in YAML so you have to quote this string
# Run at 1:00 every day
- cron: '0 1 * * *'

jobs:
build:

strategy:
matrix:
python-version: [3.8]
platform: [windows-latest]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v2
- name: "Set up Python"
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: "Install dependencies"
run: |
python -m pip install --upgrade pip setuptools wheel
# We use '--ignore-installed' to avoid GitHub's cache which can cause
# issues - we have seen packages from this cache be cause trouble with
# pip-extra-reqs.
python -m pip install --ignore-installed --upgrade --editable .[dev]

- name: "Set secrets file"
run: |
cp ./vuforia_secrets.env.example ./vuforia_secrets.env

- name: "Run tests"
env:
SKIP_REAL: 1
run: |
pytest -s -vvv --exitfirst --cov=src/ --cov=tests --cov-report=xml tests/mock_vws/${{ matrix.ci_pattern }}

- name: "Upload coverage to Codecov"
uses: "codecov/codecov-action@v1.0.13"
with:
fail_ci_if_error: true
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ flake8-commas==2.0.0 # Require silicon valley commas
flake8-quotes==3.2.0 # Require single quotes
flake8==3.8.3 # Lint
freezegun==1.0.0 # Freeze time in tests
func-timeout==4.3.5
isort==5.5.4 # Lint imports
keyring==21.4.0
mypy==0.782 # Type checking
Expand All @@ -29,7 +30,6 @@ requests-mock-flask==2020.9.25.0
sphinx-autodoc-typehints==1.11.0
sphinx_paramlinks==0.4.2
sphinxcontrib-spelling==5.4.0
timeout-decorator==0.4.1 # Decorate functions to time out.
twine==3.2.0
vulture==2.1
vws-python==2020.9.28.0
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Pillow
VWS-Auth-Tools
backports.zoneinfo
# We add ``[tzdata]`` for Windows.
backports.zoneinfo[tzdata]
flask
requests-mock
requests
Expand Down
1 change: 1 addition & 0 deletions spelling_private_dict.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ mib
mockvws
multipart
mypy
nat
noqa
pdict
plugins
Expand Down
8 changes: 4 additions & 4 deletions tests/mock_vws/test_database_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from time import sleep

import pytest
import timeout_decorator
from func_timeout import func_set_timeout
from vws import VWS, CloudRecoService
from vws.exceptions.vws_exceptions import Fail

Expand All @@ -20,7 +20,7 @@
LOGGER.setLevel(logging.DEBUG)


@timeout_decorator.timeout(seconds=500)
@func_set_timeout(timeout=500)
def _wait_for_image_numbers(
vws_client: VWS,
active_images: int,
Expand All @@ -47,8 +47,8 @@ def _wait_for_image_numbers(
processing_images: The expected number of processing images.

Raises:
TimeoutError: The numbers of images in various categories do not match
within the time limit.
func_timeout.exceptions.FunctionTimedOut: The numbers of images in
various categories do not match within the time limit.
"""
requirements = {
'active_images': active_images,
Expand Down
31 changes: 22 additions & 9 deletions tests/mock_vws/test_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,18 @@ def fixture_custom_bridge_network() -> Iterator[Network]:
Yield a custom bridge network which containers can connect to.
"""
client = docker.from_env()
network = client.networks.create(
name='test-vws-bridge-' + uuid.uuid4().hex,
driver='bridge',
)
try:
network = client.networks.create(
name='test-vws-bridge-' + uuid.uuid4().hex,
driver='bridge',
)
except docker.errors.NotFound:
# On Windows the "bridge" network driver is not available and we use
# the "nat" driver instead.
network = client.networks.create(
name='test-vws-bridge-' + uuid.uuid4().hex,
driver='nat',
)
try:
yield network
finally:
Expand Down Expand Up @@ -56,11 +64,16 @@ def test_build_and_run(
vws_tag = 'vws-mock-vws:latest-' + random
vwq_tag = 'vws-mock-vwq:latest-' + random

client.images.build(
path=str(repository_root),
dockerfile=str(base_dockerfile),
tag=base_tag,
)
try:
client.images.build(
path=str(repository_root),
dockerfile=str(base_dockerfile),
tag=base_tag,
)
except docker.errors.BuildError as exc:
assert 'no matching manifest for windows/amd64' in str(exc)
reason = 'We do not currently support using Windows containers.'
pytest.skip(reason)

storage_image, _ = client.images.build(
path=str(repository_root),
Expand Down