mirror of
https://github.com/OMGeeky/homecontrol.esp-sensors.git
synced 2025-12-26 17:02:29 +01:00
refactor: update MQTT client tests to use mock methods for packet handling
This commit is contained in:
43
.github/workflows/ci.yml
vendored
Normal file
43
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
workflow_dispatch: # Allow manual triggering
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python 3.12
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.12'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Check code formatting with Black
|
||||
run: |
|
||||
black --check .
|
||||
|
||||
- name: Run tests with pytest
|
||||
run: |
|
||||
python -m pytest
|
||||
|
||||
- name: Run tests with coverage
|
||||
run: |
|
||||
python -m pytest --cov=src.esp_sensors --cov-report=xml
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
fail_ci_if_error: false
|
||||
10
README.md
10
README.md
@@ -102,6 +102,16 @@ pip install -r requirements.txt
|
||||
python -m pytest
|
||||
```
|
||||
|
||||
### Continuous Integration
|
||||
|
||||
This project uses GitHub Actions for continuous integration. The CI workflow automatically runs on every push to the main branch and on pull requests. It performs the following checks:
|
||||
|
||||
1. Verifies code formatting with Black
|
||||
2. Runs all tests with pytest
|
||||
3. Generates test coverage reports
|
||||
|
||||
You can view the CI workflow configuration in `.github/workflows/ci.yml`.
|
||||
|
||||
### Code Style
|
||||
|
||||
This project uses Black for code formatting:
|
||||
|
||||
@@ -5,5 +5,4 @@ black==24.3.0
|
||||
|
||||
# ESP-specific dependencies (these would be used in a real implementation)
|
||||
# micropython-esp32==1.19.1
|
||||
micropython-umqtt.simple==1.3.4
|
||||
rshell==0.0.31 # For deploying code to ESP devices
|
||||
#rshell==0.0.31 # For deploying code to ESP devices
|
||||
|
||||
Reference in New Issue
Block a user