Skip to content

Commit 946c0fe

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

File tree

1 file changed

+15
-97
lines changed

1 file changed

+15
-97
lines changed

.github/workflows/tests.yaml

+15-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:
@@ -86,11 +94,11 @@ jobs:
8694
name: process / coverage
8795
runs-on: ubuntu-latest
8896
timeout-minutes: 5
89-
needs: tests-linux
97+
needs: tests
9098
steps:
9199
- name: Check out code from GitHub
92100
uses: actions/[email protected]
93-
- name: Set up Python 3.12
101+
- name: Set up Python 3.13
94102
id: python
95103
uses: actions/[email protected]
96104
with:
@@ -122,7 +130,7 @@ jobs:
122130
name: run benchmark / ${{ matrix.python-version }} / Linux
123131
runs-on: ubuntu-latest
124132
timeout-minutes: 10
125-
needs: tests-linux
133+
needs: tests
126134
strategy:
127135
fail-fast: false
128136
matrix:
@@ -173,7 +181,7 @@ jobs:
173181
name: run / ${{ matrix.python-version }} / Windows
174182
runs-on: windows-latest
175183
timeout-minutes: 25
176-
needs: tests-linux
184+
needs: tests
177185
strategy:
178186
fail-fast: false
179187
matrix:
@@ -217,93 +225,3 @@ jobs:
217225
. venv\\Scripts\\activate
218226
pip list | grep 'astroid\|pylint'
219227
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)