mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-08-06 02:46:25 +02:00
83 lines
2.3 KiB
YAML
83 lines
2.3 KiB
YAML
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.10
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.10
|
|
- 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/bandit-report-artifacts@v0.0.2
|
|
with:
|
|
project_path: custom_components/mikrotik_router
|
|
config_file: .github/bandit.yaml
|
|
ignore_failure: false
|
|
- name: Security check report artifacts
|
|
uses: actions/upload-artifact@v1
|
|
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
|