Skip to content

Commit

Permalink
Poetry and Graphql Generator
Browse files Browse the repository at this point in the history
  • Loading branch information
MiguelAngelLV committed Dec 12, 2024
1 parent 40cacec commit d9642c4
Show file tree
Hide file tree
Showing 25 changed files with 4,930 additions and 119 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/hacs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: HACS Validation

on:
pull_request:
push:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
hacs:
name: HACS Validation
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]

- name: 🚀 Run HACS validation
uses: hacs/action@main
with:
category: integration
19 changes: 19 additions & 0 deletions .github/workflows/hassfest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Hassfest

on:
pull_request:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
hassfest:
name: Hassfest
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]

- name: 🚀 Run hassfest validation
uses: home-assistant/actions/hassfest@master
33 changes: 33 additions & 0 deletions .github/workflows/pylint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Pylint

on:
pull_request:
push:
workflow_dispatch:

env:
DEFAULT_PYTHON: "3.11"

jobs:
pylint:
name: Pylint
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]

- name: 🏗 Set up Poetry
run: pipx install poetry

- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/[email protected]
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "poetry"

- name: 🏗 Install Python dependencies
run: poetry install --no-interaction

- name: 🚀 Run Pylint
run: poetry run pylint custom_components/octopus_spain
44 changes: 44 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Release

on:
release:
types:
- published

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]

- name: 🔢 Adjust version number
shell: bash
run: |
version="${{ github.event.release.tag_name }}"
version="${version,,}"
version="${version#v}"
yq e -P -o=json \
-i ".version = \"${version}\"" \
"${{ github.workspace }}/custom_components/octopus_spain/manifest.json"
- name: 📦 Created zipped release package
shell: bash
run: |
cd "${{ github.workspace }}/custom_components/octopus_spain"
zip octopus_spain.zip -r ./
- name: 🔏 Sign release package
uses: sigstore/[email protected]
with:
inputs: ${{ github.workspace }}/custom_components/octopus_spain/octopus_spain.zip

- name: ⬆️ Upload zip to release
uses: softprops/[email protected]
with:
files: ${{ github.workspace }}/custom_components/octopus_spain/octopus_spain.zip
35 changes: 35 additions & 0 deletions .github/workflows/ruff.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Ruff

on:
pull_request:
workflow_dispatch:

env:
DEFAULT_PYTHON: "3.11"

jobs:
ruff:
name: Ruff
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]

- name: 🏗 Set up Poetry
run: pipx install poetry

- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/[email protected]
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "poetry"

- name: 🏗 Install Python dependencies
run: poetry install --no-interaction

- name: 🚀 Run ruff linter
run: poetry run ruff check --output-format=github .

- name: 🚀 Run ruff formatter
run: poetry run ruff format --check .
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 73 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
repos:
- repo: local
hooks:
- id: ruff-check
name: 🐶 Ruff Linter
language: system
types: [python]
entry: poetry run ruff check --fix
require_serial: true
stages: [commit, push, manual]
- id: ruff-format
name: 🐶 Ruff Formatter
language: system
types: [python]
entry: poetry run ruff format
require_serial: true
stages: [commit, push, manual]
- id: check-json
name: { Check JSON files
language: system
types: [json]
entry: poetry run check-json
- id: check-toml
name: ✅ Check TOML files
language: system
types: [toml]
entry: poetry run check-toml
- id: check-yaml
name: ✅ Check YAML files
language: system
types: [yaml]
entry: poetry run check-yaml
- id: check-merge-conflict
name: 💥 Check for merge conflicts
language: system
types: [text]
entry: poetry run check-merge-conflict
- id: check-symlinks
name: 🔗 Check for broken symlinks
language: system
types: [symlink]
entry: poetry run check-symlinks
- id: end-of-file-fixer
name: ⮐ Fix End of Files
language: system
types: [text]
entry: poetry run end-of-file-fixer
stages: [commit, push, manual]
- id: no-commit-to-branch
name: 🛑 Don't commit to main branch
language: system
entry: poetry run no-commit-to-branch
pass_filenames: false
always_run: true
args:
- --branch=main
- id: poetry
name: 📜 Check pyproject with Poetry
language: system
entry: poetry check
pass_filenames: false
always_run: true
- id: pylint
name: 🌟 Starring code with pylint
language: system
types: [python]
entry: poetry run pylint
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier
name: 🎨 Format using prettier
47 changes: 47 additions & 0 deletions custom_components/octopus_spain/api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from .async_base_client import AsyncBaseClient
from .base_model import BaseModel, Upload
from .exceptions import (
GraphQLClientError,
GraphQLClientGraphQLError,
GraphQLClientGraphQLMultiError,
GraphQLClientHttpError,
GraphQLClientInvalidResponseError,
)
from .get_accounts import (
GetAccounts,
GetAccountsViewer,
GetAccountsViewerAccountsAccount,
GetAccountsViewerAccountsAccountInterface,
GetAccountsViewerAccountsAccountProperties,
GetAccountsViewerAccountsAccountPropertiesElectricitySupplyPoints,
GetAccountsViewerAccountsAccountPropertiesElectricitySupplyPointsActiveAgreement,
GetAccountsViewerAccountsAccountPropertiesElectricitySupplyPointsActiveAgreementDetails,
GetAccountsViewerAccountsAccountPropertiesElectricitySupplyPointsActiveAgreementProduct,
GetAccountsViewerAccountsAccountPropertiesElectricitySupplyPointsActiveAgreementProductPrices,
)
from .login import Login, LoginObtainKrakenToken
from .octopus_api import OctopusAPI

__all__ = [
"AsyncBaseClient",
"BaseModel",
"GetAccounts",
"GetAccountsViewer",
"GetAccountsViewerAccountsAccount",
"GetAccountsViewerAccountsAccountInterface",
"GetAccountsViewerAccountsAccountProperties",
"GetAccountsViewerAccountsAccountPropertiesElectricitySupplyPoints",
"GetAccountsViewerAccountsAccountPropertiesElectricitySupplyPointsActiveAgreement",
"GetAccountsViewerAccountsAccountPropertiesElectricitySupplyPointsActiveAgreementDetails",
"GetAccountsViewerAccountsAccountPropertiesElectricitySupplyPointsActiveAgreementProduct",
"GetAccountsViewerAccountsAccountPropertiesElectricitySupplyPointsActiveAgreementProductPrices",
"GraphQLClientError",
"GraphQLClientGraphQLError",
"GraphQLClientGraphQLMultiError",
"GraphQLClientHttpError",
"GraphQLClientInvalidResponseError",
"Login",
"LoginObtainKrakenToken",
"OctopusAPI",
"Upload",
]
Loading

0 comments on commit d9642c4

Please sign in to comment.