-
Notifications
You must be signed in to change notification settings - Fork 15
58 lines (45 loc) · 1.99 KB
/
ci-simulation-example.yml
File metadata and controls
58 lines (45 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: CI with Simulation Tests
on:
workflow_call:
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install dependencies
run: |
# Replace path dependencies with PyPI versions for CI
sed -i 's/span-panel-api = {path = "..\/span-panel-api", develop = true}/span-panel-api = "^1.1.5"/' pyproject.toml
sed -i 's/ha-synthetic-sensors = {path = "..\/ha-synthetic-sensors", develop = true}/ha-synthetic-sensors = "^1.1.1"/' pyproject.toml
# Regenerate lock file with the modified dependencies
poetry lock
poetry install --with dev
# Install bandit with TOML support
poetry run pip install 'bandit[toml]'
- name: Format check with ruff
run: poetry run ruff format --check custom_components/span_panel
- name: Lint with ruff
run: poetry run ruff check custom_components/span_panel
- name: Type check with mypy
run: poetry run mypy custom_components/span_panel
- name: Security check with bandit
run: poetry run bandit -c pyproject.toml -r custom_components/span_panel
- name: Check poetry configuration
run: poetry check
- name: Run pre-commit hooks (for extra validation)
run: poetry run pre-commit run --all-files --show-diff-on-failure
# Regular tests - simulation tests are automatically skipped
- name: Run tests with coverage
run: poetry run pytest tests/ --cov=custom_components/span_panel --cov-report=xml --cov-report=term-missing
# Optional: Run simulation tests separately if desired
- name: Run simulation tests
env:
SPAN_USE_REAL_SIMULATION: 1
run: poetry run pytest tests/test_solar_configuration_with_simulator.py -v