Skip to content

Commit

Permalink
chore: update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
EuleMitKeule committed Nov 3, 2024
1 parent dcee371 commit c4ecfb0
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 59 deletions.
162 changes: 107 additions & 55 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,110 +2,162 @@ name: Code Quality

on:
pull_request:
types: [opened, synchronize, reopened]
types: [opened, synchronize, reopened]
push:
branches:
- master
workflow_dispatch:

jobs:
black:
cache:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.12"
- "3.13"
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install black
- name: Run black
run: |
python -m black --check --diff custom_components/template_media_player
- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}

isort:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Install Python
uses: actions/setup-python@v4
- name: Load cached Poetry venv
id: cached-poetry-venv
uses: actions/cache@v4
with:
python-version: "3.10"
path: .venv
key: poetry-venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install isort
if: steps.cached-poetry-venv.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Run isort
run: |
python -m isort --check-only --diff --profile black custom_components/template_media_player
- name: Install package
run: poetry install --no-interaction

mypy:
ruff:
needs: cache
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.12"
- "3.13"
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install mypy
- name: Run mypy
run: |
python -m mypy custom_components/template_media_player --ignore-missing-imports
bandit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Load cached Poetry installation
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}

- name: Install Python
uses: actions/setup-python@v4
- name: Load cached Poetry venv
uses: actions/cache@v4
with:
python-version: "3.10"
path: ~/.venv
key: poetry-venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}

- name: Install dependencies
- name: Install package
run: |
pip install bandit
poetry install --no-interaction
- name: Run bandit
- name: Run ruff
run: |
python -m bandit -r custom_components/template_media_player
poetry run ruff check custom_components/template_media_player
hassfest:
needs: cache
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.12"
- "3.13"
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Load cached Poetry installation
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}

- name: Load cached Poetry venv
uses: actions/cache@v4
with:
python-version: "3.10"
path: ~/.venv
key: poetry-venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}

- name: Install package
run: |
poetry install --no-interaction
- name: Run hassfest
uses: home-assistant/actions/hassfest@master

hacs:
needs: cache
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.12"
- "3.13"
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Load cached Poetry installation
uses: actions/cache@v4
with:
python-version: "3.10"
path: ~/.local
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}

- name: Load cached Poetry venv
uses: actions/cache@v4
with:
path: ~/.venv
key: poetry-venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}

- name: Install package
run: |
poetry install --no-interaction
- name: Run hacs
uses: hacs/action@main
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ jobs:
runs-on: ubuntu-latest
concurrency: release
steps:

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
uses: cycjimmy/semantic-release-action@v4
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
GITHUB_TOKEN: ${{ secrets.PAT }}

0 comments on commit c4ecfb0

Please sign in to comment.