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