Skip to content

Commit

Permalink
Merge pull request #619 from roflcoopter/feature/storage-component
Browse files Browse the repository at this point in the history
24/7 recordings
  • Loading branch information
roflcoopter authored Mar 25, 2024
2 parents 69abb07 + b2b8091 commit a675a1c
Show file tree
Hide file tree
Showing 238 changed files with 21,855 additions and 17,962 deletions.
30 changes: 17 additions & 13 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
"onAutoForward": "silent"
}
},
"mounts": [
"source=${localWorkspaceFolder}/config,target=/config,type=bind,consistency=cached"
],
"userEnvProbe": "loginInteractiveShell",
"runArgs": ["-e", "GIT_EDITOR=code --wait"],
"customizations": {
"vscode": {
Expand All @@ -26,6 +30,9 @@
"ms-python.vscode-pylance",
"ms-python.isort",
"ms-python.flake8",
"ms-python.black-formatter",
"ms-python.pylint",
"ms-python.mypy-type-checker",
"redhat.vscode-yaml",
"esbenp.prettier-vscode",
"GitHub.vscode-pull-request-github",
Expand All @@ -34,29 +41,26 @@
"eamodio.gitlens",
"dbaeumer.vscode-eslint",
"ms-azuretools.vscode-docker",
"unifiedjs.vscode-mdx"
"unifiedjs.vscode-mdx",
"ckolkman.vscode-postgres"
],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "/usr/local/bin/pylint",
"python.linting.flake8Enabled": true,
"python.linting.flake8Path": "/usr/local/bin/flake8",
"python.linting.pycodestylePath": "/usr/local/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/bin/pydocstyle",
"python.formatting.blackPath": "/usr/local/bin/black",
"python.formatting.provider": "black",
"python.testing.pytestArgs": ["--no-cov"],
"python.linting.mypyEnabled": true,
"python.linting.mypyPath": "/usr/local/bin/mypy",
"isort.check": true,
"editor.rulers": [80],
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.rulers": [88],
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
}
},
"mypy-type-checker.importStrategy": "fromEnvironment",
"pylint.importStrategy": "fromEnvironment",
"black-formatter.importStrategy": "fromEnvironment",
"flake8.importStrategy": "fromEnvironment",
"isort.importStrategy": "fromEnvironment",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
Expand Down
15 changes: 13 additions & 2 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ do
sed -i "s/$FILE=true/$FILE=false/g" $HOME/.bashrc
done

# Symlink config
# Create default config if it is missing
cd $WORKSPACE_DIR
mkdir -p $WORKSPACE_DIR/config
FILE=$WORKSPACE_DIR/config/config.yaml
Expand All @@ -35,7 +35,15 @@ else
echo "Creating default config"
python3 -c "import viseron.config; viseron.config.create_default_config('$FILE')"
fi
ln -s $WORKSPACE_DIR/config/config.yaml /config/config.yaml

# Create symlink to config file
FILE=/config/config.yaml
if test -f "$FILE"; then
echo "Config symlink already exists"
else
echo "Creating config symlink"
ln -s $WORKSPACE_DIR/config/config.yaml /config/config.yaml
fi

# Create .env.local
FILE=$WORKSPACE_DIR/frontend/.env.local
Expand All @@ -45,3 +53,6 @@ else
echo "Creating frontend .env.local"
echo "VITE_PROXY_HOST=localhost:8888" > $FILE
fi

# Generate locale
locale-gen
8 changes: 6 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends libgirepository1.0-dev
python3 -m venv venv
python3 -m venv --system-site-packages venv
- name: Install requirements into Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
uses: ./.github/templates/run_in_venv
Expand Down Expand Up @@ -422,7 +422,11 @@ jobs:
docker-compose --file azure-pipelines/docker-compose-build.yaml --env-file azure-pipelines/.env build --build-arg BUILDKIT_INLINE_CACHE=1 amd64-viseron-tests
- name: Run pytest
run: |
docker-compose --file azure-pipelines/docker-compose-build.yaml --env-file azure-pipelines/.env up amd64-viseron-tests
if docker-compose --file azure-pipelines/docker-compose-build.yaml --env-file azure-pipelines/.env up amd64-viseron-tests; then
exit 0
else
exit 1
fi
- name: Copy .coverage to host
run: |
docker cp amd64-viseron-tests:/src/coverage.xml coverage.xml
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
!/tests/*
!/tests/components
!/tests/components/**
!/tests/domains
!/tests/domains/**
!/tests/helpers
!/tests/helpers/*

Expand Down Expand Up @@ -81,7 +83,7 @@
!/frontend/src/**
!/frontend/tests
!/frontend/tests/**
!/frontend/.eslintrc.js
!/frontend/.eslintrc.cjs
!/frontend/.prettierrc.json
!/frontend/404.html
!/frontend/index.html
Expand Down
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ repos:
rev: v3.2.2
hooks:
- id: pyupgrade
args: [--py38-plus]
args:
- --py38-plus
- --keep-runtime-typing
files: ^(viseron|tests)/.+\.py$
- repo: https://github.com/PyCQA/autoflake
rev: v2.0.0
Expand Down Expand Up @@ -88,4 +90,4 @@ repos:
if [ -n "$test" ]; then echo "Found null description in config.json:"; echo "$test"; false; fi
'
pass_filenames: false
always_run: true
always_run: true
9 changes: 6 additions & 3 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ disable=format,
too-many-statements,
too-many-boolean-expressions,
consider-using-with,
consider-using-f-string
consider-using-f-string,
consider-using-dict-items

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down Expand Up @@ -191,7 +192,7 @@ contextmanager-decorators=contextlib.contextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=cv2.*
generated-members=cv2.*,alembic.*

# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
Expand All @@ -214,7 +215,7 @@ ignored-classes=optparse.Values,thread._local,_thread._local
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=
ignored-modules=alembic.context,alembic.op

# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
Expand Down Expand Up @@ -309,6 +310,8 @@ good-names=i,
x2,
y1,
y2,
mb,
gb,
Run,
_,
T
Expand Down
30 changes: 17 additions & 13 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
{
"recommendations": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.isort",
"ms-python.flake8",
"redhat.vscode-yaml",
"esbenp.prettier-vscode",
"eamodio.gitlens",
"dbaeumer.vscode-eslint",
"ms-azuretools.vscode-docker",
"unifiedjs.vscode-mdx"
]
}
"recommendations": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.isort",
"ms-python.flake8",
"ms-python.black-formatter",
"ms-python.pylint",
"ms-python.mypy-type-checker",
"redhat.vscode-yaml",
"esbenp.prettier-vscode",
"eamodio.gitlens",
"dbaeumer.vscode-eslint",
"ms-azuretools.vscode-docker",
"unifiedjs.vscode-mdx",
"ckolkman.vscode-postgres"
]
}
12 changes: 11 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,15 @@
"github-actions.workflows.pinned.workflows": [".github/workflows/ci.yaml"],
"python.testing.pytestArgs": ["tests/"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
"python.testing.pytestEnabled": true,
"pylint.severity": {
"convention": "Warning"
},
"[python]": {
"editor.rulers": [88],
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "ms-python.black-formatter"
}
}
23 changes: 22 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"group": "test",
"presentation": {
"reveal": "always",
"panel": "new"
"panel": "dedicated"
},
"problemMatcher": []
},
Expand Down Expand Up @@ -92,6 +92,23 @@
},
"problemMatcher": []
},
{
"label": "Python: Generate database migration",
"detail": "Generates a new revision file for the database.",
"type": "shell",
"command": "alembic revision --autogenerate -m '${input:revision_message}'",
"options": {
"cwd": "${workspaceFolder}/viseron/components/storage"
},
"group": {
"kind": "build"
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
// Frontend tasks
{
"label": "Frontend: Build",
Expand Down Expand Up @@ -274,5 +291,9 @@
"type": "promptString",
"description": "The component to generate docs for",
},
{
"id": "revision_message",
"type": "promptString",
"description": "Revision message (should end with a period)",}
]
}
21 changes: 16 additions & 5 deletions azure-pipelines/docker-compose-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ services:
WHEELS_VERSION: "$WHEELS_VERSION"
S6_OVERLAY_ARCH: amd64
S6_OVERLAY_VERSION: "$S6_OVERLAY_VERSION"
UBUNTU_VERSION: "$UBUNTU_VERSION"
cache_from:
- roflcoopter/amd64-viseron:dev
image: roflcoopter/amd64-viseron:dev
Expand All @@ -133,14 +134,20 @@ services:
VISERON_VERSION: dev
image: roflcoopter/amd64-viseron-tests:dev
container_name: amd64-viseron-tests
entrypoint: ""
environment:
- PGID=1000
- PUID=1000
command: >
bash -c "pytest --cov=viseron/ --cov-report term-missing -s tests
&& coverage xml"
bash -c "
chown -R abc:abc /src &&
su abc -c '
cd /src &&
pytest --cov=viseron/ --cov-report term-missing -s tests &&
coverage xml
'
"
amd64-viseron-tests-tox:
<<: *amd64-viseron-tests
entrypoint: pytest

amd64-viseron-vulture:
<<: *amd64-viseron-tests
Expand Down Expand Up @@ -247,6 +254,7 @@ services:
WHEELS_VERSION: "$WHEELS_VERSION"
S6_OVERLAY_ARCH: amd64
S6_OVERLAY_VERSION: "$S6_OVERLAY_VERSION"
UBUNTU_VERSION: "$UBUNTU_VERSION"
cache_from:
- roflcoopter/amd64-cuda-viseron:dev
image: roflcoopter/amd64-cuda-viseron:dev
Expand Down Expand Up @@ -343,6 +351,7 @@ services:
WHEELS_VERSION: "$WHEELS_VERSION"
S6_OVERLAY_ARCH: armhf
S6_OVERLAY_VERSION: "$S6_OVERLAY_VERSION"
UBUNTU_VERSION: "$UBUNTU_VERSION"
cache_from:
- roflcoopter/rpi3-viseron:dev
image: roflcoopter/rpi3-viseron:dev
Expand Down Expand Up @@ -430,6 +439,7 @@ services:
WHEELS_VERSION: "$WHEELS_VERSION"
S6_OVERLAY_ARCH: aarch64
S6_OVERLAY_VERSION: "$S6_OVERLAY_VERSION"
UBUNTU_VERSION: "$UBUNTU_VERSION"
cache_from:
- roflcoopter/aarch64-viseron:dev
image: roflcoopter/aarch64-viseron:dev
Expand Down Expand Up @@ -568,6 +578,7 @@ services:
WHEELS_VERSION: "$WHEELS_VERSION"
S6_OVERLAY_ARCH: aarch64
S6_OVERLAY_VERSION: "$S6_OVERLAY_VERSION"
UBUNTU_VERSION: "$UBUNTU_VERSION"
cache_from:
- roflcoopter/jetson-nano-viseron:dev
image: roflcoopter/jetson-nano-viseron:dev
Expand Down
Loading

0 comments on commit a675a1c

Please sign in to comment.