Skip to content

Commit

Permalink
Merge branch 'main' into always-use-ref-for-validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed May 23, 2024
2 parents 54f359a + 69e197c commit 3923a98
Show file tree
Hide file tree
Showing 387 changed files with 19,892 additions and 2,741 deletions.
13 changes: 0 additions & 13 deletions .bellybutton.yml

This file was deleted.

13 changes: 1 addition & 12 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,11 @@
source = custom_components

omit =
# omit pieces of code that rely on external API calls
# These should be mocked one day....
custom_components/hacs/helpers/get_defaults.py
custom_components/hacs/operational/setup_actions/load_hacs_repository.py
custom_components/hacs/operational/factory.py
custom_components/hacs/operational/relaod.py
custom_components/hacs/operational/remove.py
custom_components/hacs/operational/setup.py
custom_components/hacs/config_flow.py
custom_components/hacs/__init__.py

# omit tests
tests/*

# omit scripts
scripts/*
scripts/update/*

[report]
exclude_lines =
Expand Down
5 changes: 3 additions & 2 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hacs/integration",
"image": "mcr.microsoft.com/vscode/devcontainers/python:0-3.11-bullseye",
"image": "mcr.microsoft.com/devcontainers/python:1-3.12",
"postCreateCommand": "scripts/setup",
"forwardPorts": [
8123
Expand Down Expand Up @@ -66,6 +66,7 @@
},
"remoteUser": "vscode",
"features": {
"rust": "latest"
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/rust:1": {}
}
}
94 changes: 62 additions & 32 deletions .github/pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,50 +1,80 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.34.0
- repo: local
hooks:
- id: pyupgrade
stages: [manual]
- id: codespell
name: Check code for common misspellings
language: system
types: [text]
stages: [commit, push, manual]
entry: codespell
args:
- "--py39-plus"
- --quiet-level=2
- --ignore-words-list=hass,ba,fo
- --skip=custom_components/hacs/utils/default.repositories
- --skip=tests/fixtures/*

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
name: Sort imports
language: system
types: [text]
stages: [commit, push, manual]
entry: isort

- id: pyupgrade
name: Run pyupgrade
language: system
types: [text]
stages: [commit, push, manual]
entry: pyupgrade
files: ^.*.py$
args:
- "--py39-plus"

- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
stages: [manual]
name: Run black
language: system
types: [text]
stages: [commit, push, manual]
entry: black
args:
- --safe
- --quiet
files: ^((custom_components|script|tests)/.+)?[^/]+\.py$
files: ^((action|custom_components|script|tests)/.+)?[^/]+\.py$

- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
stages: [manual]
args:
- --quiet-level=2
- --ignore-words-list=hass,ba,fo
- --exclude-file=custom_components/hacs/utils/default.repositories

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-executables-have-shebangs
stages: [manual]
name: Check that executables have shebangs
language: system
types: [text, executable]
entry: check-executables-have-shebangs
stages: [commit, push, manual]

- id: check-json
stages: [manual]
name: Check JSON files
language: system
types: [json]
stages: [commit, push, manual]
entry: check-json

- id: requirements-txt-fixer
stages: [manual]
name: Check requirements files
language: system
types: [text]
stages: [commit, push, manual]
entry: requirements-txt-fixer
files: ^requirements_.*.txt$

- id: check-ast
stages: [manual]
name: Check Python AST
language: system
types: [python]
stages: [commit, push, manual]
entry: check-ast

- id: mixed-line-ending
stages: [manual]
name: Check line nedings
language: system
types: [text]
stages: [commit, push, manual]
entry: mixed-line-ending
args:
- --fix=lf
11 changes: 6 additions & 5 deletions .github/workflows/action-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
permissions:
packages: write
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4.1.6

- name: Login to GitHub Container Registry
uses: docker/login-action@v3.0.0
uses: docker/login-action@v3.1.0
if: ${{ github.event_name != 'pull_request' }}
with:
registry: ghcr.io
Expand All @@ -42,7 +42,7 @@ jobs:

- name: Docker metadata
id: meta
uses: docker/metadata-action@v5.0.0
uses: docker/metadata-action@v5.5.1
with:
images: |
ghcr.io/${{ github.repository_owner }}/action
Expand All @@ -52,9 +52,10 @@ jobs:
type=sha
- name: Build and push
uses: docker/build-push-action@v5.0.0
uses: docker/build-push-action@v5.3.0
with:
context: ./action
context: .
file: action/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
47 changes: 0 additions & 47 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

14 changes: 10 additions & 4 deletions .github/workflows/generate-hacs-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,18 @@ jobs:
if: github.repository == 'hacs/integration'
name: Generate ${{ matrix.category }} data
strategy:
fail-fast: false
matrix:
category: ${{ fromJSON( needs.generate-matrix.outputs.categories )}}
steps:
- name: Checkout the repository
uses: actions/checkout@v4.1.1
uses: actions/checkout@v4.1.6

- name: Set up Python
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v5.1.0
id: python
with:
python-version: "3.11"
python-version: "3.12"
cache: 'pip'
cache-dependency-path: |
requirements_base.txt
Expand Down Expand Up @@ -92,13 +93,18 @@ jobs:
jq -c . outputdata/${{ matrix.category }}/data.json
jq -c . outputdata/${{ matrix.category }}/repositories.json
- name: Validate output with schema
if: steps.updated.outputs.updated == 'true'
run: |
python3 -m scripts.data.validate_category_data ${{ matrix.category }} outputdata/${{ matrix.category }}/data.json
- name: Generate diff
if: steps.updated.outputs.updated == 'true'
run: |
diff -u outputdata/diff/${{ matrix.category }}_before.json outputdata/diff/${{ matrix.category }}_after.json > outputdata/diff/${{ matrix.category }}.diff || true
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4.3.3
if: steps.updated.outputs.updated == 'true'
with:
name: ${{ matrix.category }}
Expand Down
29 changes: 17 additions & 12 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,35 @@ jobs:
- requirements-txt-fixer
- check-ast
- mixed-line-ending
- isort
steps:
- name: 📥 Checkout the repository
uses: actions/checkout@v4.1.1
- name: Checkout the repository
uses: actions/checkout@v4.1.6

- name: 🛠️ Set up Python
uses: actions/setup-python@v4.7.1
- name: Set up Python
uses: actions/setup-python@v5.1.0
id: python
with:
python-version: "3.11"
python-version: "3.12"
cache: 'pip'
cache-dependency-path: |
requirements_base.txt
requirements_lint.txt
- name: 📦 Install pre-commit
- name: Install dependencies
run: |
scripts/install/pip_packages pre-commit
scripts/install/pip_packages --requirement requirements_lint.txt
pre-commit install-hooks --config .github/pre-commit-config.yaml
- name: 🏃 Run the check (${{ matrix.check }})
run: pre-commit run --hook-stage manual ${{ matrix.check }} --all-files --config .github/pre-commit-config.yaml
- name: Run the check (${{ matrix.check }})
run: pre-commit run --show-diff-on-failure --hook-stage manual ${{ matrix.check }} --all-files --config .github/pre-commit-config.yaml

lint-json:
runs-on: ubuntu-latest
name: With JQ
steps:
- name: 📥 Checkout the repository
uses: actions/checkout@v4.1.1
- name: Checkout the repository
uses: actions/checkout@v4.1.6

- name: 🏃 Run validation
- name: Run validation
run: jq -r -e -c . tests/fixtures/*.json
2 changes: 1 addition & 1 deletion .github/workflows/lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
pull-requests: write
steps:
- name: 🔒 Lock closed issues and PRs
uses: dessant/lock-threads@v4.0.1
uses: dessant/lock-threads@v5.0.1
with:
issue-inactive-days: "14"
issue-lock-reason: ""
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
contents: write
steps:
- name: 📥 Checkout the repository
uses: actions/checkout@v4.1.1
uses: actions/checkout@v4.1.6

- name: 🛠️ Set up Python
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v5.1.0
with:
python-version: "3.11"
python-version: "3.12"

- name: 🔢 Get version
if: ${{ github.event_name == 'release' }}
Expand All @@ -42,7 +42,7 @@ jobs:
run: ${{ github.workspace }}/scripts/install/frontend

- name: 📤 Upload zip to action
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v4.3.3
if: ${{ github.event_name == 'push' }}
with:
name: hacs
Expand Down
Loading

0 comments on commit 3923a98

Please sign in to comment.