Fix deprecations and warnings #757
This file contains 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: | |
- "main" | |
- "feature/*" | |
pull_request: | |
branches: | |
- "main" | |
jobs: | |
test: | |
name: "Test" | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: "Checkout the repository" | |
uses: "actions/checkout@v4.2.2" | |
- name: "Set up Python" | |
uses: actions/setup-python@v5.4.0 | |
with: | |
python-version: "3.13" | |
cache: "pip" | |
- name: "Install requirements" | |
run: pip install -r requirements-dev.txt | |
- name: "Test" | |
run: pytest tests --doctest-modules --junitxml=pytest.xml --cov --cov=custom_components/ --cov-report=term-missing | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: .coverage | |
path: .coverage | |
retention-days: 1 | |
include-hidden-files: true | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pytest.xml | |
path: pytest.xml | |
retention-days: 1 | |
coverage-upload: | |
name: "Coverage Upload" | |
runs-on: "ubuntu-latest" | |
needs: test | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main'}} | |
permissions: | |
contents: write | |
steps: | |
- name: "Checkout the repository" | |
uses: "actions/checkout@v4.2.2" | |
- name: "Set up Python" | |
uses: actions/setup-python@v5.4.0 | |
with: | |
python-version: "3.13" | |
- name: Install coverage.py | |
run: pip install coverage | |
- uses: actions/download-artifact@v4 | |
with: | |
name: .coverage | |
- run: coverage json | |
- run: mkdir -p ./gh-pages-coverage | |
- run: mv coverage.json ./gh-pages-coverage | |
- name: Store coverage report in gh-pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: gh-pages-coverage # The folder the action should dep | |
target-folder: coverage | |
commit-message: Upload latest coverage report | |
coverage-comment: | |
name: "Coverage Comment" | |
runs-on: "ubuntu-latest" | |
needs: test | |
if: ${{ github.event_name == 'pull_request' }} | |
permissions: | |
issues: write | |
pull-requests: write | |
contents: write | |
steps: | |
- name: "Checkout the repository" | |
uses: "actions/checkout@v4.2.2" | |
- name: "Set up Python" | |
uses: actions/setup-python@v5.4.0 | |
with: | |
python-version: "3.13" | |
- name: Install coverage.py | |
run: pip install coverage | |
- uses: actions/download-artifact@v4 | |
with: | |
name: .coverage | |
- uses: actions/download-artifact@v4 | |
with: | |
name: pytest.xml | |
- run: coverage xml | |
- name: Pytest coverage comment | |
uses: MishaKav/pytest-coverage-comment@v1.1.53 | |
with: | |
pytest-xml-coverage-path: ./coverage.xml | |
junitxml-path: ./pytest.xml |