diff --git a/hassio-google-drive-backup/.devcontainer/Dockerfile b/hassio-google-drive-backup/.devcontainer/Dockerfile deleted file mode 100644 index 35c44e4..0000000 --- a/hassio-google-drive-backup/.devcontainer/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM python:3.9-buster - -WORKDIR /usr/src/install -RUN apt-get update -RUN apt-get install fping -# install gcloud api -RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && apt-get update -y && apt-get install google-cloud-cli -y - -COPY requirements-dev.txt ./ -RUN pip install --no-cache-dir -r requirements-dev.txt \ No newline at end of file diff --git a/hassio-google-drive-backup/.devcontainer/devcontainer.json b/hassio-google-drive-backup/.devcontainer/devcontainer.json deleted file mode 100644 index 70495e6..0000000 --- a/hassio-google-drive-backup/.devcontainer/devcontainer.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "build": { "dockerfile": "Dockerfile" }, - "extensions": ["ms-python.python", "wholroyd.jinja","ms-python.vscode-pylance"], - "forwardPorts": [3000] - } \ No newline at end of file diff --git a/hassio-google-drive-backup/.devcontainer/requirements-dev.txt b/hassio-google-drive-backup/.devcontainer/requirements-dev.txt deleted file mode 100644 index 06ed916..0000000 --- a/hassio-google-drive-backup/.devcontainer/requirements-dev.txt +++ /dev/null @@ -1,34 +0,0 @@ -google-api-python-client -google-auth-httplib2 -google-auth-oauthlib -oauth2client -requests -python-dateutil==2.6.1 -watchdog -pyyaml -dnspython -pytest>=5.4.0 -pytest-timeout -pytest-repeat -pytest-asyncio -flake8 -mypy -aiorun -aiohttp -aiodns -aiofiles -injector -autopep8 -colorlog -debugpy -google-cloud-logging -google-cloud-firestore -aiohttp-jinja2 -beautifulsoup4 -firebase-admin -aiofile -grpcio -aioping -pytz -tzlocal -pytest-cov \ No newline at end of file diff --git a/hassio-google-drive-backup/.github/FUNDING.yml b/hassio-google-drive-backup/.github/FUNDING.yml deleted file mode 100644 index 809cf4d..0000000 --- a/hassio-google-drive-backup/.github/FUNDING.yml +++ /dev/null @@ -1,6 +0,0 @@ -github: sabeechen -patreon: sabeechen -custom: - - https://www.buymeacoffee.com/sabeechen - - https://www.paypal.com/paypalme/stephenbeechen - - https://github.com/sabeechen/hassio-google-drive-backup/blob/master/donate-crypto.md diff --git a/hassio-google-drive-backup/.github/dependabot.yaml b/hassio-google-drive-backup/.github/dependabot.yaml deleted file mode 100644 index 2a8ccc5..0000000 --- a/hassio-google-drive-backup/.github/dependabot.yaml +++ /dev/null @@ -1,7 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: daily - time: "06:00" diff --git a/hassio-google-drive-backup/.github/workflows/codeql-analysis.yml b/hassio-google-drive-backup/.github/workflows/codeql-analysis.yml deleted file mode 100644 index a63b265..0000000 --- a/hassio-google-drive-backup/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,72 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ "master", "dev" ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "master", "dev" ] - schedule: - - cron: '42 18 * * 5' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'javascript', 'python' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/hassio-google-drive-backup/.github/workflows/lint.yaml b/hassio-google-drive-backup/.github/workflows/lint.yaml deleted file mode 100644 index c973fd4..0000000 --- a/hassio-google-drive-backup/.github/workflows/lint.yaml +++ /dev/null @@ -1,13 +0,0 @@ -name: Lint -on: [push, pull_request] -jobs: - build: - name: Lint add-on configuration - runs-on: ubuntu-latest - steps: - - name: â¤ĩī¸ Check out code from GitHub - uses: actions/checkout@v3 - - name: 🚀 Run Home Assistant Add-on Linter - uses: frenck/action-addon-linter@v2.13 - with: - path: "./hassio-google-drive-backup" diff --git a/hassio-google-drive-backup/.github/workflows/prod_push.yaml b/hassio-google-drive-backup/.github/workflows/prod_push.yaml deleted file mode 100644 index afeb616..0000000 --- a/hassio-google-drive-backup/.github/workflows/prod_push.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: push_to_prod -on: - workflow_dispatch: - -jobs: - deploy_to_staging: - runs-on: ubuntu-latest - steps: - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.8' - - - name: Check out dev repo - uses: actions/checkout@v3 - with: - path: dev - persist-credentials: false - - - name: Login to DockerHub - uses: docker/login-action@v2.2.0 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} - - - name: Publish Addon Image - uses: home-assistant/builder@master - with: - args: | - --all \ - --target dev/hassio-google-drive-backup diff --git a/hassio-google-drive-backup/.github/workflows/pytest.yml b/hassio-google-drive-backup/.github/workflows/pytest.yml deleted file mode 100644 index c285ed9..0000000 --- a/hassio-google-drive-backup/.github/workflows/pytest.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: run-pytest -on: - push: - pull_request: - workflow_dispatch: -jobs: - run-pytest: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.8' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r .devcontainer/requirements-dev.txt - - name: Install fping - run: sudo apt-get install fping - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-line-length=300 --statistics - - name: Test with pytest - run: | - pip install pytest - pip install pytest-cov - pytest hassio-google-drive-backup/tests --junitxml=junit/test-results.xml --cov=hassio-google-drive-backup/backup --cov-report=xml --cov-report=html - - name: Upload pytest test results - uses: actions/upload-artifact@v3 - with: - name: pytest-results - path: junit/test-results.xml - if: ${{ always() }} - - name: Publish Unit Test Results - uses: EnricoMi/publish-unit-test-result-action@v2 - if: always() - with: - files: junit/**/*.xml - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3.1.4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage.xml - directory: ./coverage/reports/ - flags: unittests - env_vars: OS,PYTHON - name: codecov-umbrella - fail_ci_if_error: true - path_to_write_report: ./coverage/codecov_report.txt - verbose: true diff --git a/hassio-google-drive-backup/.github/workflows/server_image_push.yml b/hassio-google-drive-backup/.github/workflows/server_image_push.yml deleted file mode 100644 index 77334b7..0000000 --- a/hassio-google-drive-backup/.github/workflows/server_image_push.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Server Image Push - -on: - workflow_dispatch: - -env: - IMAGE_NAME: addon-server - -jobs: - # Push image to GitHub Packages. - # See also https://docs.docker.com/docker-hub/builds/ - push: - runs-on: ubuntu-latest - permissions: - packages: write - contents: read - - steps: - - uses: actions/checkout@v3 - - - name: Build image - run: docker build -f hassio-google-drive-backup/Dockerfile-server --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" hassio-google-drive-backup/. - - - name: Log in to registry - # This is where you will update the PAT to GITHUB_TOKEN - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - - name: Push image - run: | - IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME - - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - # Strip git ref prefix from version - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - # Strip "v" prefix from tag name - [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') - # Use Docker `latest` tag convention - [ "$VERSION" == "master" ] && VERSION=latest - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - docker tag $IMAGE_NAME $IMAGE_ID:run-$GITHUB_RUN_NUMBER - docker push $IMAGE_ID:run-$GITHUB_RUN_NUMBER diff --git a/hassio-google-drive-backup/.github/workflows/staging_push.yml b/hassio-google-drive-backup/.github/workflows/staging_push.yml deleted file mode 100644 index ad91292..0000000 --- a/hassio-google-drive-backup/.github/workflows/staging_push.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: push_to_staging -concurrency: - # Only run this workflow one at a time, and cancel any in progress - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -on: - workflow_dispatch: - branches: - - dev - inputs: - name: - # Friendly description to be shown in the UI instead of 'name' - description: 'Staging Verison Override' - # Default value if no value is explicitly provided - default: 'increment' - -jobs: - run-pytest: - runs-on: ubuntu-latest - steps: - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.8' - # Check out the current branch - - uses: actions/checkout@v3 - with: - path: dev - # Check out the staging barnch - - uses: actions/checkout@v3 - with: - path: staging - repository: sabeechen/hgdb-dev-staging - - run: | - python3 staging/update.py dev staging diff --git a/hassio-google-drive-backup/.github/workflows/test_staging_push.yml b/hassio-google-drive-backup/.github/workflows/test_staging_push.yml deleted file mode 100644 index 0049ded..0000000 --- a/hassio-google-drive-backup/.github/workflows/test_staging_push.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: push_to_staging -on: - workflow_dispatch: - push: - branches: - - dev - -jobs: - deploy_to_staging: - runs-on: ubuntu-latest - steps: - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.8' - - - name: Check out dev repo - uses: actions/checkout@v3 - with: - path: dev - persist-credentials: false - - - name: Checkout Staging Repo - uses: actions/checkout@v3 - with: - path: staging - repository: sabeechen/hgdb-dev-staging - persist-credentials: true - token: ${{ secrets.STAGING_REPO_TOKEN }} - - - name: Update addon verison number - run: | - python3 staging/update.py dev staging - - - name: Login to DockerHub - uses: docker/login-action@v2.2.0 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} - - - name: Publish Staging Addon image - uses: home-assistant/builder@master - with: - args: | - --all \ - --target dev/hassio-google-drive-backup - - - name: Publish Staging Addon Version - run: | - cd staging - git config user.name github-actions - git config user.email github-actions@github.com - git add . - git commit -m "Updating staging addon config" - git push diff --git a/hassio-google-drive-backup/.vscode/extensions.json b/hassio-google-drive-backup/.vscode/extensions.json deleted file mode 100644 index 35b4eca..0000000 --- a/hassio-google-drive-backup/.vscode/extensions.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "recommendations": ["wholroyd.jinja"] -} diff --git a/hassio-google-drive-backup/.vscode/launch.json b/hassio-google-drive-backup/.vscode/launch.json deleted file mode 100644 index 7dfc241..0000000 --- a/hassio-google-drive-backup/.vscode/launch.json +++ /dev/null @@ -1,152 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Run Addon (Dev Backends)", - "type": "python", - "request": "launch", - "python": "${command:python.interpreterPath}", - "module": "hassio-google-drive-backup.backup", - "args": ["--config", "hassio-google-drive-backup/dev/data/dev_options.json"], - "env": { - "PYTHONPATH": "${workspaceFolder}/hassio-google-drive-backup" - } - }, - { - "name": "Run Addon (Dev Drive)", - "type": "python", - "request": "launch", - "python": "${command:python.interpreterPath}", - "module": "hassio-google-drive-backup.backup", - "args": ["--config", "hassio-google-drive-backup/dev/data/drive_dev_options.json"], - "env": { - "PYTHONPATH": "${workspaceFolder}/hassio-google-drive-backup" - } - }, - { - "name": "Run Addon (Real Google Drive)", - "type": "python", - "request": "launch", - "python": "${command:python.interpreterPath}", - "module": "hassio-google-drive-backup.backup", - "args": ["--config", "hassio-google-drive-backup/dev/data/drive_options.json"], - "env": { - "PYTHONPATH": "${workspaceFolder}/hassio-google-drive-backup" - } - }, - { - "name": "Run Mock Backend Server", - "type": "python", - "request": "launch", - "python": "${command:python.interpreterPath}", - "module": "hassio-google-drive-backup.dev.simulationserver", - "env": { - "PYTHONPATH": "${workspaceFolder}/hassio-google-drive-backup" - } - }, - { - "name": "Run Error Analyzer", - "type": "python", - "request": "launch", - "python": "${command:python.interpreterPath}", - "module": "hassio-google-drive-backup.backup.util.error_analyzer", - "env": { - "PYTHONPATH": "${workspaceFolder}/hassio-google-drive-backup" - } - }, - { - "name": "Python: Current File (External Terminal)", - "type": "python", - "request": "launch", - "program": "${file}", - "console": "externalTerminal", - "env": { - "PYTHONPATH": "${workspaceFolder}/hassio-google-drive-backup" - } - }, - { - "name": "Python Attach (Remote Debug docker addon)", - "type": "python", - "request": "attach", - "pathMappings": [ - { - "localRoot": "${workspaceFolder}/hassio-google-drive-backup", // You may also manually specify the directory containing your source code. - "remoteRoot": "/app" // Linux example; adjust as necessary for your OS and situation. - } - ], - "port": 1627, // Set to the remote port. - "host": "hassio", // Set to your remote host's public IP address. - "env": { - "PYTHONPATH": "${workspaceFolder}/hassio-google-drive-backup" - } - }, - { - "name": "Run Auth Server", - "type": "python", - "request": "launch", - "python": "${command:python.interpreterPath}", - "module": "hassio-google-drive-backup.server", - "env": { - "PYTHONPATH": "${workspaceFolder}/hassio-google-drive-backup", - "PORT": "12345", - "CLIENT_SECRET": "client_secret", - "CLIENT_ID": "client_id" - } - }, - { - "name": "(DEV) Build/Upload Addon Container", - "type": "python", - "request": "launch", - "python": "${command:python.interpreterPath}", - "module": "hassio-google-drive-backup.dev.deploy_dev_addon", - "env": { - "PYTHONPATH": "${workspaceFolder}/hassio-google-drive-backup", - "PORT": "12345", - "CLIENT_SECRET": "client_secret", - "CLIENT_ID": "client_id" - } - }, - { - "name": "(PROD) Build/Upload Server Container", - "type": "python", - "request": "launch", - "python": "${command:python.interpreterPath}", - "module": "hassio-google-drive-backup.dev.deploy_server", - "env": { - "PYTHONPATH": "${workspaceFolder}/hassio-google-drive-backup", - "PORT": "12345", - "CLIENT_SECRET": "client_secret", - "CLIENT_ID": "client_id" - } - }, - { - "name": "(DEV) Build/Upload Server Container", - "type": "python", - "request": "launch", - "python": "${command:python.interpreterPath}", - "module": "hassio-google-drive-backup.dev.deploy_dev_server", - "env": { - "PYTHONPATH": "${workspaceFolder}/hassio-google-drive-backup", - "PORT": "12345", - "CLIENT_SECRET": "client_secret", - "CLIENT_ID": "client_id" - } - }, - { - "name": "(PROD) Build/Upload Addon Containers", - "type": "python", - "request": "launch", - "python": "${command:python.interpreterPath}", - "module": "hassio-google-drive-backup.dev.deploy_addon", - "env": { - "PYTHONPATH": "${workspaceFolder}/hassio-google-drive-backup", - "PORT": "12345", - "CLIENT_SECRET": "client_secret", - "CLIENT_ID": "client_id" - } - }, - ] -} \ No newline at end of file diff --git a/hassio-google-drive-backup/.vscode/settings.json b/hassio-google-drive-backup/.vscode/settings.json deleted file mode 100644 index 0ede21b..0000000 --- a/hassio-google-drive-backup/.vscode/settings.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "python.testing.unittestEnabled": false, - "python.testing.nosetestsEnabled": false, - "python.testing.pytestEnabled": true, - "python.linting.enabled": true, - "python.linting.flake8Enabled": true, - "python.linting.pylintEnabled": false, - "python.linting.mypyEnabled": false, - "python.linting.mypyArgs": ["--python-version", "3.8"], - "python.linting.flake8Args": ["--ignore=E501,E731", "--verbose"], - "python.autoComplete.addBrackets": true, - "files.associations": { - "*.jinja2": "html" - }, - "[html]": { - "editor.defaultFormatter": "vscode.html-language-features", - "editor.tabSize": 2, - }, - "python.analysis.completeFunctionParens": true, - "python.analysis.typeCheckingMode": "basic" -} diff --git a/hassio-google-drive-backup/.vscode/tasks.json b/hassio-google-drive-backup/.vscode/tasks.json deleted file mode 100644 index 222359d..0000000 --- a/hassio-google-drive-backup/.vscode/tasks.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 for help with task definitions - "version": "2.0.0", - "tasks": [ - { - "label": "PUBLISH: New version to Docker Hub (requires working docker)", - "type": "shell", - "command": "./deploy.sh", - "problemMatcher": [] - }, - { - "label": "Install addon libraries", - "type": "process", - "command": "${config:python.pythonPath}", - "args": ["-m", "pip", "install", "-e", "hassio-google-drive-backup/"], - "problemMatcher": [], - "group": { - "kind": "build", - "isDefault": true - } - }, - { - "label": "Install development dependencies", - "type": "process", - "command": "${config:python.pythonPath}", - "args": ["-m", "pip", "install", "-r", ".devcontainer/requirements-dev.txt"], - "problemMatcher": [], - "group": { - "kind": "build", - "isDefault": true - } - }, - { - "label": "[Re]create and run local addon", - "type": "process", - "command": "${config:python.pythonPath}", - "args": ["-m", "hassio-google-drive-backup.dev.deploy_local_addon"], - "problemMatcher": [], - "group": { - "kind": "build", - "isDefault": true - } - } - ] -} \ No newline at end of file