Prepare mypy for typing checks

This commit is contained in:
Sebastian Englbrecht 2022-04-12 15:30:55 +02:00 committed by Blake Blackshear
parent d749cf2e6b
commit d995761419
5 changed files with 14 additions and 13 deletions

View File

@ -56,5 +56,7 @@ jobs:
uses: docker/setup-buildx-action@v1
- name: Build
run: make
- name: Run mypy
run: docker run --rm --entrypoint=python3 frigate:latest -u -m mypy --config-file frigate/mypy.ini frigate
- name: Run tests
run: docker run --rm --entrypoint=python3 frigate:latest -u -m unittest
run: docker run --rm --entrypoint=python3 frigate:latest -u -m unittest

View File

@ -14,16 +14,8 @@ frigate: version
frigate_push: version
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag blakeblackshear/frigate:0.11.0-$(COMMIT_HASH) --file docker/Dockerfile .
run_tests:
# PLATFORM: linux/arm64/v8 linux/amd64 or linux/arm/v7
# ARCH: aarch64 amd64 or armv7
@cat docker/Dockerfile.base docker/Dockerfile.$(ARCH) > docker/Dockerfile.test
@sed -i "s/FROM frigate-web as web/#/g" docker/Dockerfile.test
@sed -i "s/COPY --from=web \/opt\/frigate\/build web\//#/g" docker/Dockerfile.test
@sed -i "s/FROM frigate-base/#/g" docker/Dockerfile.test
@echo "" >> docker/Dockerfile.test
@echo "RUN python3 -m unittest" >> docker/Dockerfile.test
@docker buildx build --platform=$(PLATFORM) --tag frigate-base --build-arg NGINX_VERSION=1.0.2 --build-arg FFMPEG_VERSION=1.0.0 --build-arg ARCH=$(ARCH) --build-arg WHEELS_VERSION=1.0.3 --file docker/Dockerfile.test .
@rm docker/Dockerfile.test
run_tests: frigate
docker run --rm --entrypoint=python3 frigate:latest -u -m unittest
docker run --rm --entrypoint=python3 frigate:latest -u -m mypy --config-file frigate/mypy.ini frigate
.PHONY: run_tests

View File

@ -42,7 +42,7 @@ COPY requirements.txt /requirements.txt
RUN pip3 install -r requirements.txt
COPY requirements-wheels.txt /requirements-wheels.txt
RUN pip3 wheel --wheel-dir=/wheels -r requirements-wheels.txt
RUN pip3 wheel --wheel-dir=/wheels -r requirements-wheels.txt
# Frigate Container
FROM debian:11-slim

6
frigate/mypy.ini Normal file
View File

@ -0,0 +1,6 @@
[mypy]
python_version = 3.9
ignore_missing_imports = true
[mypy-frigate.*]
ignore_errors = true

View File

@ -2,6 +2,7 @@ click == 8.1.*
Flask == 2.1.*
imutils == 0.5.*
matplotlib == 3.5.*
mypy == 0.942
numpy == 1.22.*
opencv-python-headless == 4.5.5.*
paho-mqtt == 1.6.*