Merge pull request #180 from itsniawan/master #150
This file contains 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
name: CI | |
on: | |
push: | |
paths: | |
- 'custom_components/**' | |
- 'tests/**' | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths: | |
- 'custom_components/**' | |
- 'tests/**' | |
workflow_dispatch: | |
jobs: | |
black: | |
name: Python Code Format Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code from GitHub | |
uses: "actions/checkout@v3" | |
- name: Black Code Format Check | |
uses: lgeiger/black-action@master | |
with: | |
args: ". --check --fast --diff" | |
tests: | |
name: Python Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code from GitHub | |
uses: "actions/checkout@v3" | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Generate Requirements lists | |
run: | | |
python3 .github/generate_requirements.py | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -r requirements_tests.txt | |
- name: Lint with flake8 | |
run: | | |
pip install flake8 | |
flake8 . --count --select=E9,F63,F7,F82 --ignore W503,E722,F722 --show-source --statistics | |
flake8 . --count --exit-zero --max-complexity=15 --max-line-length=127 --statistics | |
# - name: Test with pytest | |
# run: | | |
# pip install pytest | |
# pytest | |
security: | |
name: Security check - Bandit | |
needs: [tests] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code from GitHub | |
uses: "actions/checkout@v3" | |
- name: Security check - Bandit | |
uses: ioggstream/[email protected] | |
with: | |
project_path: custom_components/truenas | |
config_file: .github/bandit.yaml | |
ignore_failure: false | |
- name: Security check report artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Security report | |
path: output/security_report.txt | |
validate: | |
name: Check hassfest | |
needs: [tests] | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Check out code from GitHub | |
uses: "actions/checkout@v3" | |
- name: Run hassfest | |
uses: home-assistant/actions/hassfest@master |