Do not run coverage on pypy and cache poetry envs (#812)

Currently the CI is very slow for pypy vs cpython, one job is 24m vs 3m
on cpython. This PR enables poetry environment caching and bypasses
coverage checking for pypy.

N.B. The poetry cache is keyed on a hash of the `poetry.lock` file.
This commit is contained in:
Steven B 2024-03-06 15:23:31 +00:00 committed by GitHub
parent ced879498b
commit 652696a9a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,13 +18,15 @@ jobs:
python-version: ["3.12"]
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
- uses: "actions/checkout@v4"
- name: Install poetry
run: pipx install poetry
- uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.python-version }}"
cache: 'poetry'
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip poetry
poetry install
- name: "Check supported device md files are up to date"
run: |
@ -85,21 +87,27 @@ jobs:
extras: true
steps:
- uses: "actions/checkout@v3"
- uses: "actions/setup-python@v4"
- uses: "actions/checkout@v4"
- name: Install poetry
run: pipx install poetry
- uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.python-version }}"
cache: 'poetry'
- name: "Install dependencies (no extras)"
if: matrix.extras == false
run: |
python -m pip install --upgrade pip poetry
poetry install
- name: "Install dependencies (with extras)"
if: matrix.extras == true
run: |
python -m pip install --upgrade pip poetry
poetry install --all-extras
- name: "Run tests"
- name: "Run tests (no coverage)"
if: ${{ startsWith(matrix.python-version, 'pypy') }}
run: |
poetry run pytest
- name: "Run tests (with coverage)"
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
run: |
poetry run pytest --cov kasa --cov-report xml
- name: "Upload coverage to Codecov"