8000 Do not run coverage on pypy and cache poetry envs (#812) · python-kasa/python-kasa@652696a · GitHub
[go: up one dir, main page]

Skip to content

Commit 652696a

Browse files
authored
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.
1 parent ced8794 commit 652696a

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ jobs:
1818
python-version: ["3.12"]
1919

2020
steps:
21-
- uses: "actions/checkout@v2"
22-
- uses: "actions/setup-python@v2"
21+
- uses: "actions/checkout@v4"
22+
- name: Install poetry
23+
run: pipx install poetry
24+
- uses: "actions/setup-python@v5"
2325
with:
2426
python-version: "${{ matrix.python-version }}"
27+
cache: 'poetry'
2528
- name: "Install dependencies"
2629
run: |
27-
python -m pip install --upgrade pip poetry
2830
poetry install
2931
- name: "Check supported device md files are up to date"
3032
run: |
@@ -85,21 +87,27 @@ jobs:
8587
extras: true
8688

8789
steps:
88-
- uses: "actions/checkout@v3"
89-
- uses: "actions/setup-python@v4"
90+
- uses: "actions/checkout@v4"
91+
- name: Install poetry
92+
run: pipx install poetry
93+
- uses: "actions/setup-python@v5"
9094
with:
9195
python-version: "${{ matrix.python-version }}"
96+
cache: 'poetry'
9297
- name: "Install dependencies (no extras)"
9398
if: matrix.extras == false
9499
run: |
95-
python -m pip install --upgrade pip poetry
96100
poetry install
97101
- name: "Install dependencies (with extras)"
98102
if: matrix.extras == true
99103
run: |
100-
python -m pip install --upgrade pip poetry
101104
poetry install --all-extras
102-
- name: "Run tests"
105+
- name: "Run tests (no coverage)"
106+
if: ${{ startsWith(matrix.python-version, 'pypy') }}
107+
run: |
108+
poetry run pytest
109+
- name: "Run tests (with coverage)"
110+
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
103111
run: |
104112
poetry run pytest --cov kasa --cov-report xml
105113
- name: "Upload coverage to Codecov"

0 commit comments

Comments
 (0)
0