ci: add notify-failure, pytest with coverage, and 49 unit tests
- lint.yml: add notify-failure Matrix alert job - test.yml: new workflow running pytest with pytest-cov for coverage - .coveragerc: omit tests and site-packages from coverage - .gitignore: ignore __pycache__ and .pyc files - tests/test_hwmon.py: 49 unit tests covering SystemHealthMonitor (temperature parsing, service monitoring, disk usage, metric collection, dry run behaviour); uses unittest.mock to isolate from env/filesystem Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -21,3 +21,21 @@ jobs:
|
||||
|
||||
- name: Run flake8
|
||||
run: flake8 . --exclude=__pycache__,.git
|
||||
|
||||
notify-failure:
|
||||
name: Notify on failure
|
||||
runs-on: ubuntu-latest
|
||||
needs: [python-lint]
|
||||
if: failure() && github.event_name == 'push'
|
||||
steps:
|
||||
- name: Send Matrix alert
|
||||
env:
|
||||
MATRIX_WEBHOOK_URL: ${{ secrets.MATRIX_WEBHOOK_URL }}
|
||||
REPO: ${{ github.repository }}
|
||||
BRANCH: ${{ github.ref_name }}
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
run: |
|
||||
if [ -z "$MATRIX_WEBHOOK_URL" ] || [ "$MATRIX_WEBHOOK_URL" = "CONFIGURE_ME" ]; then exit 0; fi
|
||||
curl -sf -X POST "$MATRIX_WEBHOOK_URL" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"text\":\"CI FAILED: ${REPO} @ ${BRANCH} — ${RUN_URL}\"}"
|
||||
|
||||
Reference in New Issue
Block a user