Skip to content

Commit 6942e7c

Browse files
committed
GitHub Actions: Simplify tests using matrix.os
1 parent a3e5bef commit 6942e7c

File tree

1 file changed

+16
-97
lines changed

1 file changed

+16
-97
lines changed

.github/workflows/tests.yaml

+16-97
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,22 @@ concurrency:
2424
cancel-in-progress: true
2525

2626
jobs:
27-
tests-linux:
28-
name: run / ${{ matrix.python-version }} / Linux
29-
runs-on: ubuntu-latest
27+
tests:
28+
name: run / ${{ matrix.python-version }} / ${{ matrix.os }}
3029
timeout-minutes: 25
3130
strategy:
3231
fail-fast: false
3332
matrix:
33+
os: [ubuntu-latest]
3434
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
35+
include:
36+
- os: macos-latest
37+
python-version: "3.9"
38+
- os: ubuntu-latest
39+
python-version: "pypy-3.9"
40+
- os: ubuntu-latest
41+
python-version: "pypy-3.10"
42+
runs-on: ${{ matrix.os }}
3543
outputs:
3644
python-key: ${{ steps.generate-python-key.outputs.key }}
3745
steps:
@@ -76,6 +84,7 @@ jobs:
7684
pip list | grep 'astroid\|pylint'
7785
python -m pytest -vv --minimal-messages-config tests/test_functional.py
7886
- name: Upload coverage artifact
87+
if: runner.os == 'Linux'
7988
uses: actions/[email protected]
8089
with:
8190
name: coverage-${{ matrix.python-version }}
@@ -86,11 +95,11 @@ jobs:
8695
name: process / coverage
8796
runs-on: ubuntu-latest
8897
timeout-minutes: 5
89-
needs: tests-linux
98+
needs: tests
9099
steps:
91100
- name: Check out code from GitHub
92101
uses: actions/[email protected]
93-
- name: Set up Python 3.12
102+
- name: Set up Python 3.13
94103
id: python
95104
uses: actions/[email protected]
96105
with:
@@ -122,7 +131,7 @@ jobs:
122131
name: run benchmark / ${{ matrix.python-version }} / Linux
123132
runs-on: ubuntu-latest
124133
timeout-minutes: 10
125-
needs: tests-linux
134+
needs: tests
126135
strategy:
127136
fail-fast: false
128137
matrix:
@@ -173,7 +182,7 @@ jobs:
173182
name: run / ${{ matrix.python-version }} / Windows
174183
runs-on: windows-latest
175184
timeout-minutes: 25
176-
needs: tests-linux
185+
needs: tests
177186
strategy:
178187
fail-fast: false
179188
matrix:
@@ -217,93 +226,3 @@ jobs:
217226
. venv\\Scripts\\activate
218227
pip list | grep 'astroid\|pylint'
219228
python -m pytest --durations=10 --benchmark-disable tests/
220-
221-
tests-macos:
222-
name: run / ${{ matrix.python-version }} / macOS
223-
runs-on: macos-latest
224-
timeout-minutes: 25
225-
needs: tests-linux
226-
strategy:
227-
fail-fast: false
228-
matrix:
229-
# We only run on the oldest supported version on Mac
230-
python-version: ["3.9"]
231-
steps:
232-
- name: Check out code from GitHub
233-
uses: actions/[email protected]
234-
- name: Set up Python ${{ matrix.python-version }}
235-
id: python
236-
uses: actions/[email protected]
237-
with:
238-
python-version: ${{ matrix.python-version }}
239-
check-latest: true
240-
- name: Generate partial Python venv restore key
241-
id: generate-python-key
242-
run: >-
243-
echo "key=venv-${{ env.CACHE_VERSION }}-${{
244-
hashFiles('pyproject.toml', 'requirements_test_min.txt')
245-
}}" >> $GITHUB_OUTPUT
246-
- name: Restore Python virtual environment
247-
id: cache-venv
248-
uses: actions/[email protected]
249-
with:
250-
path: venv
251-
key: >-
252-
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
253-
steps.generate-python-key.outputs.key }}
254-
- name: Create Python virtual environment
255-
if: steps.cache-venv.outputs.cache-hit != 'true'
256-
run: |
257-
python -m venv venv
258-
. venv/bin/activate
259-
python -m pip install --upgrade pip setuptools wheel
260-
pip install --upgrade --requirement requirements_test_min.txt
261-
- name: Run pytest
262-
run: |
263-
. venv/bin/activate
264-
pip list | grep 'astroid\|pylint'
265-
python -m pytest --durations=10 --benchmark-disable tests/
266-
267-
tests-pypy:
268-
name: run / ${{ matrix.python-version }} / Linux
269-
runs-on: ubuntu-latest
270-
timeout-minutes: 25
271-
strategy:
272-
fail-fast: false
273-
matrix:
274-
python-version: ["pypy-3.9", "pypy-3.10"]
275-
steps:
276-
- name: Check out code from GitHub
277-
uses: actions/[email protected]
278-
- name: Set up Python ${{ matrix.python-version }}
279-
id: python
280-
uses: actions/[email protected]
281-
with:
282-
python-version: ${{ matrix.python-version }}
283-
check-latest: true
284-
- name: Generate partial Python venv restore key
285-
id: generate-python-key
286-
run: >-
287-
echo "key=venv-${{ env.CACHE_VERSION }}-${{
288-
hashFiles('pyproject.toml', 'requirements_test_min.txt')
289-
}}" >> $GITHUB_OUTPUT
290-
- name: Restore Python virtual environment
291-
id: cache-venv
292-
uses: actions/[email protected]
293-
with:
294-
path: venv
295-
key: >-
296-
${{ runner.os }}-${{ matrix.python-version }}-${{
297-
steps.generate-python-key.outputs.key }}
298-
- name: Create Python virtual environment
299-
if: steps.cache-venv.outputs.cache-hit != 'true'
300-
run: |
301-
python -m venv venv
302-
. venv/bin/activate
303-
python -m pip install --upgrade pip setuptools wheel
304-
pip install --upgrade --requirement requirements_test_min.txt
305-
- name: Run pytest
306-
run: |
307-
. venv/bin/activate
308-
pip list | grep 'astroid\|pylint'
309-
python -m pytest --durations=10 --benchmark-disable tests/

0 commit comments

Comments
 (0)