Cleanup code and increase code coverage to 100% #2823
Workflow file for this run
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: | |
pull_request: | |
env: | |
POETRY_VERSION: 1.5.1 | |
jobs: | |
tests: | |
runs-on: "ubuntu-latest" | |
name: Run tests | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Load cached Poetry installation | |
id: cached-poetry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.local | |
key: poetry-${{ env.POETRY_VERSION }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: cache dependencies | |
id: cache-deps | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: pydeps-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
run: poetry install --no-interaction --no-root | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
- name: Prepare test env | |
run: bash tests/setup.sh | |
- name: Run tests | |
run: | | |
source .venv/bin/activate | |
pytest \ | |
-qq \ | |
--timeout=9 \ | |
--durations=10 \ | |
-n auto \ | |
--cov custom_components.powercalc \ | |
--cov-report xml \ | |
-o console_output_style=count \ | |
-p no:sugar \ | |
tests | |
coverage lcov | |
- name: Upload Coverage Results | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.github_token }} | |
path-to-lcov: coverage.lcov |