From 509bb7e932f967505bc8e416d266bc7672a8c426 Mon Sep 17 00:00:00 2001 From: Dmitry Krasnoukhov Date: Thu, 19 Oct 2023 18:13:33 +0300 Subject: [PATCH] Initial commit --- .editorconfig | 19 +++ .github/dependabot.yml | 11 ++ .github/workflows/ci.yml | 25 +++ .github/workflows/hacs.yml | 15 ++ .github/workflows/release.yml | 81 ++++++++++ .gitignore | 160 ++++++++++++++++++++ .pylintrc | 3 + LICENSE | 21 +++ README.md | 3 + custom_components/nova_poshta/manifest.json | 13 ++ custom_components/nova_poshta/strings.json | 1 + hacs.json | 5 + 12 files changed, 357 insertions(+) create mode 100644 .editorconfig create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/hacs.yml create mode 100644 .github/workflows/release.yml create mode 100644 .gitignore create mode 100644 .pylintrc create mode 100644 LICENSE create mode 100644 README.md create mode 100644 custom_components/nova_poshta/manifest.json create mode 100644 custom_components/nova_poshta/strings.json create mode 100644 hacs.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..6157dd8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 2 + +[*.{diff,md}] +trim_trailing_whitespace = false + +[*.py] +indent_size = 4 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..90e05c4 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2c00a21 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: CI + +on: + push: + +jobs: + black: + name: Python Code Format Check + runs-on: ubuntu-latest + steps: + - name: Check out code from GitHub + uses: "actions/checkout@main" + - name: Black Code Format Check + uses: lgeiger/black-action@master + with: + args: ". --check --fast --diff" + + validate: + name: Check hassfest + runs-on: "ubuntu-latest" + steps: + - name: Check out code from GitHub + uses: "actions/checkout@main" + - name: Run hassfest + uses: home-assistant/actions/hassfest@master diff --git a/.github/workflows/hacs.yml b/.github/workflows/hacs.yml new file mode 100644 index 0000000..8be5d7a --- /dev/null +++ b/.github/workflows/hacs.yml @@ -0,0 +1,15 @@ +name: HACS Action + +on: + push: + +jobs: + hacs: + name: HACS Action + runs-on: "ubuntu-latest" + steps: + - name: HACS Action + uses: "hacs/action@main" + with: + category: "integration" + ignore: brands diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bfa5d04 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,81 @@ +--- +name: "Auto Release" + +on: + push: + branches: + - main + paths: + - custom_components/*/manifest.json + +jobs: + auto-release: + name: "Auto Release" + runs-on: "ubuntu-latest" + steps: + - name: "✏️ Checkout code" + uses: actions/checkout@v4 + with: + path: './' + + - name: "🏷️ Get version tag" + id: set_var + run: echo "COMPONENT_VERSION=$(jq -r .version custom_components/*/manifest.json)" >> $GITHUB_ENV + + - name: "🏷️ Check if tag exists already" + uses: mukunku/tag-exists-action@v1.4.0 + id: "check_tag" + with: + tag: "v${{ env.COMPONENT_VERSION }}" + + - name: "❌ Cancel if tag is already present" + run: | + echo "Tag already present: v${{ env.COMPONENT_VERSION }}. Not creating a new release" + gh run cancel ${{ github.run_id }} + gh run watch ${{ github.run_id }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if: steps.check_tag.outputs.exists == 'true' + + - name: "🗝️ Get previous release version" + id: last_release + uses: InsonusK/get-latest-release@v1.1.0 + with: + myToken: ${{ github.token }} + exclude_types: "draft|prerelease" + + - name: "🏷️ Create new tag" + uses: rickstaa/action-create-tag@v1 + id: "tag_create" + with: + tag: "v${{ env.COMPONENT_VERSION }}" + tag_exists_error: false + message: "Version ${{ env.COMPONENT_VERSION }}" + # if: steps.check_tag.outputs.exists == 'false' + + - name: "🗒️ Generate release changelog" + id: changelog + uses: heinrichreimer/github-changelog-generator-action@v2.3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + sinceTag: ${{ steps.last_release.outputs.tag_name }} + headerLabel: "# Notable changes since ${{ steps.last_release.outputs.tag_name }}" + stripGeneratorNotice: true + + - name: 👍 Create Stable release + uses: softprops/action-gh-release@v1 + with: + prerelease: false + body: "${{ steps.changelog.outputs.changelog }}" + name: "Version ${{ env.COMPONENT_VERSION }}" + tag_name: "v${{ env.COMPONENT_VERSION }}" + if: contains(env.COMPONENT_VERSION, 'beta') == false + + - name: 🤞 Create Beta release + uses: softprops/action-gh-release@v1 + with: + prerelease: true + body: "${{ steps.changelog.outputs.changelog }}" + name: "Version ${{ env.COMPONENT_VERSION }}" + tag_name: "v${{ env.COMPONENT_VERSION }}" + if: contains(env.COMPONENT_VERSION, 'beta') == true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..68bc17f --- /dev/null +++ b/.gitignore @@ -0,0 +1,160 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000..818518a --- /dev/null +++ b/.pylintrc @@ -0,0 +1,3 @@ +[MESSAGES CONTROL] + +disable= diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3667008 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Dmitry Krasnoukhov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..229744e --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Home Assistant Nova Poshta integration + +TODO \ No newline at end of file diff --git a/custom_components/nova_poshta/manifest.json b/custom_components/nova_poshta/manifest.json new file mode 100644 index 0000000..f8b434b --- /dev/null +++ b/custom_components/nova_poshta/manifest.json @@ -0,0 +1,13 @@ +{ + "domain": "nova_poshta", + "name": "Nova Poshta", + "codeowners": ["@krasnoukhov"], + "config_flow": false, + "dependencies": [], + "documentation": "https://github.com/krasnoukhov/homeassistant-nova-poshta", + "integration_type": "service", + "iot_class": "local_polling", + "issue_tracker": "https://github.com/krasnoukhov/homeassistant-nova-poshta/issues", + "requirements": [], + "version": "1.0.0-beta.0" +} diff --git a/custom_components/nova_poshta/strings.json b/custom_components/nova_poshta/strings.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/custom_components/nova_poshta/strings.json @@ -0,0 +1 @@ +{} diff --git a/hacs.json b/hacs.json new file mode 100644 index 0000000..82614d2 --- /dev/null +++ b/hacs.json @@ -0,0 +1,5 @@ +{ + "name": "Nova Poshta", + "homeassistant": "2023.10.0", + "render_readme": true +} \ No newline at end of file