Quick fix for the remote access disable switch in the web ui. #690
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # yamllint disable rule:line-length | |
| --- | |
| name: Lint | |
| permissions: | |
| contents: read | |
| # yamllint disable-line rule:truthy | |
| on: [push, pull_request] | |
| concurrency: | |
| group: queue | |
| jobs: | |
| information: | |
| name: Gather add-on information | |
| runs-on: ubuntu-latest | |
| outputs: | |
| architectures: ${{ steps.information.outputs.architectures }} | |
| base_image_signer: ${{ steps.information.outputs.codenotary_base_image }} | |
| build: ${{ steps.information.outputs.build }} | |
| description: ${{ steps.information.outputs.description }} | |
| name: ${{ steps.information.outputs.name }} | |
| slug: ${{ steps.override.outputs.slug }} | |
| target: ${{ steps.information.outputs.target }} | |
| steps: | |
| - name: ⤵️ Check out code from GitHub | |
| uses: actions/checkout@v6 | |
| - name: 🚀 Run add-on information action | |
| id: information | |
| uses: frenck/action-addon-information@v1.4.2 | |
| - name: 🚀 Process possible slug override | |
| id: override | |
| run: | | |
| slug="${{ steps.information.outputs.slug }}" | |
| echo "slug=$slug" >> "$GITHUB_OUTPUT" | |
| find: | |
| name: Find add-ons | |
| runs-on: ubuntu-latest | |
| outputs: | |
| addons: ${{ steps.addons.outputs.addons_list }} | |
| steps: | |
| - name: ⤵️ Check out code from GitHub | |
| uses: actions/checkout@v6 | |
| - name: 🔍 Find add-on directories | |
| id: addons | |
| uses: home-assistant/actions/helpers/find-addons@master | |
| python-lint: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # We always install zstandard by hand, since it's an optional lib. | |
| # Ideally this version will stay in sync with | |
| # Compression.ZStandardPipPackageString | |
| - name: 🏗️ Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pylint | |
| pip install pyright | |
| pip install ruff | |
| pip install -r ./homeway/requirements.txt | |
| pip install "zstandard>=0.21.0,<0.23.0" | |
| # This crazy script is needed to ensure that we always run pylint | |
| # on all of the files in the repo and the path is set correctly for it to work. | |
| - name: 👖 Running Pylint | |
| env: | |
| PYTHONPATH: ${{ github.workspace }} | |
| run: | | |
| python - <<'PY' | |
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| repo_root = Path(".") | |
| tracked_files = subprocess.check_output( | |
| ["git", "ls-files", "*.py"], | |
| text=True, | |
| ).splitlines() | |
| if not tracked_files: | |
| sys.exit(0) | |
| package_roots = set() | |
| standalone_modules = set() | |
| for file_path in tracked_files: | |
| path = Path(file_path) | |
| package_root = None | |
| for ancestor in path.parents: | |
| if ancestor == repo_root: | |
| break | |
| if (ancestor / "__init__.py").exists(): | |
| package_root = ancestor | |
| if package_root is None: | |
| standalone_modules.add(path) | |
| else: | |
| package_roots.add(package_root) | |
| def has_parent_package(path: Path) -> bool: | |
| for parent in path.parents: | |
| if parent == repo_root: | |
| break | |
| if parent in package_roots: | |
| return True | |
| return False | |
| filtered_packages = { | |
| pkg for pkg in package_roots if not has_parent_package(pkg) | |
| } | |
| def run_pylint(target: Path) -> bool: | |
| print(f"Running pylint on {target}...") | |
| result = subprocess.run(["pylint", str(target)], check=False) | |
| return result.returncode == 0 | |
| success = True | |
| for package in sorted(filtered_packages, key=lambda p: (len(p.parts), str(p))): | |
| success &= run_pylint(package) | |
| for module in sorted(standalone_modules, key=str): | |
| success &= run_pylint(module) | |
| if not success: | |
| sys.exit(1) | |
| PY | |
| - name: 👉 Pyright | |
| run: | | |
| pyright | |
| - name: 🐶 Ruff | |
| run: | | |
| ruff check | |
| lint-addon: | |
| name: Lint Add-on | |
| needs: | |
| - information | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: ⤵️ Check out code from GitHub | |
| uses: actions/checkout@v6 | |
| - name: 🚀 Run Add-on Lint | |
| uses: frenck/action-addon-linter@v2.21.0 | |
| with: | |
| community: false | |
| path: "./${{ needs.information.outputs.target }}" | |
| lint-yamllint: | |
| name: YAMLLint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: ⤵️ Check out code from GitHub | |
| uses: actions/checkout@v6 | |
| - name: 🚀 Run YAMLLint | |
| uses: frenck/action-yamllint@v1.5 |