Test breaking something #228
This file contains hidden or 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: Test | |
| on: | |
| push: | |
| branches: [master, main, dev] | |
| pull_request: | |
| branches: [master, main, dev] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.14" | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements-test.txt | |
| pip install pettracer-client==0.2.0 | |
| - name: Run tests with coverage | |
| run: | | |
| pytest --cov=custom_components.pettracer --cov-report=xml --cov-report=term -v | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v7 | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| - name: Generate coverage report | |
| run: | | |
| pip install coverage | |
| coverage report --fail-under=90 | |
| lint: | |
| name: Lint and Type Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.12" | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install ruff mypy | |
| - name: Lint with ruff | |
| run: | | |
| ruff check custom_components/pettracer/ --output-format=github | |
| continue-on-error: true | |
| - name: Check formatting with ruff | |
| run: | | |
| ruff format --check custom_components/pettracer/ | |
| continue-on-error: true | |
| validate: | |
| name: Validate | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Validate manifest | |
| run: | | |
| python -c "import json; json.load(open('custom_components/pettracer/manifest.json'))" | |
| - name: Validate strings.json | |
| run: | | |
| python -c "import json; json.load(open('custom_components/pettracer/strings.json'))" | |
| - name: Validate translations | |
| run: | | |
| python -c "import json; json.load(open('custom_components/pettracer/translations/en.json'))" | |
| - name: Check HACS compatibility | |
| run: | | |
| python -c "import json; json.load(open('hacs.json'))" |