Skip to content

Commit 77fe25a

Browse files
committed
Use Python containers for Gitlab CI
1 parent c30d511 commit 77fe25a

File tree

1 file changed

+17
-37
lines changed

1 file changed

+17
-37
lines changed

.github/workflows/tests.yml

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,25 @@ jobs:
1414

1515
continue-on-error: ${{ matrix.optional || false }}
1616
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
17-
container: ${{ matrix.container }}
17+
container: ${{ !startsWith(matrix.os, 'windows') && (matrix.container || format('python:{0}', matrix.python-version)) || null }}
1818
name: ${{ matrix.label || matrix.python-version }} ${{ startsWith(matrix.os, 'windows') && '(Windows)' || '' }} ${{ matrix.optional && '[OPTIONAL]' }}
1919

2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
23+
python-version: ['3.5', '3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
2424
test_quick: [1]
2525

2626
include:
2727
- python-version: '3.13'
2828
label: Linting
2929
toxenv: docformatter_check,flake8,flake8_tests,isort_check,mypy,sphinx,pydocstyle,pylint,pylint_tests
30+
os-deps:
31+
- enchant-2
3032

31-
- python-version: '3.14-dev'
33+
- python-version: '3.14'
34+
container: 'python:3.14-rc'
3235
optional: true
33-
toxenv: py314
34-
toxpython: 3.14
3536

3637
- python-version: '3.13'
3738
test_keyboard: 1
@@ -42,26 +43,11 @@ jobs:
4243
os: windows-latest
4344
test_quick: 0
4445

45-
- python-version: '3.7'
46-
os: ubuntu-22.04
47-
toxenv: py37
48-
49-
- python-version: '3.6'
50-
os: ubuntu-20.04
51-
toxenv: py36
52-
53-
- python-version: '3.5'
54-
os: ubuntu-20.04
55-
toxenv: py35
56-
5746
- python-version: '2.7'
58-
container: {image: 'python:2.7.18-buster'}
59-
toxenv: py27
6047
test_keyboard: 1
6148
test_raw: 1
6249
test_quick: 0
6350

64-
6551
env:
6652
TOXENV: ${{ matrix.toxenv || format('py{0}', matrix.python-version) }}
6753
TEST_QUICK: ${{ matrix.test_quick || 0 }}
@@ -70,22 +56,16 @@ jobs:
7056
TOXPYTHON: python${{ matrix.toxpython || matrix.python-version }}
7157

7258
steps:
73-
- uses: actions/checkout@v4
59+
# This is only needed for Python 3.6 and earlier because Tox 4 requires 3.7+
60+
- name: Fix TOXENV
61+
run: echo "TOXENV=$(echo $TOXENV | sed 's/\.//g')" >> $GITHUB_ENV
62+
if: ${{ contains(fromJson('["2.7", "3.5", "3.6"]'), matrix.python-version) }}
7463

75-
- name: Set up Python ${{ matrix.python-version }}
76-
uses: actions/setup-python@v5
77-
with:
78-
python-version: ${{ matrix.python-version }}
79-
if: ${{ matrix.python-version != '2.7' && matrix.python-version != '3.5' }}
64+
- name: Install OS Dependencies
65+
run: apt update && apt -y install ${{ join(matrix.os-deps, ' ') }}
66+
if: ${{ matrix.os-deps }}
8067

81-
# Workaround for https://github.com/actions/setup-python/issues/866
82-
- name: Set up Python 3.5 (Workaround)
83-
uses: actions/setup-python@v5
84-
with:
85-
python-version: 3.5
86-
env:
87-
PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org"
88-
if: ${{ matrix.python-version == '3.5' }}
68+
- uses: actions/checkout@v4
8969

9070
- name: Install tox
9171
run: pip install tox
@@ -97,7 +77,7 @@ jobs:
9777
run: tox
9878

9979
- name: Upload to Codecov
100-
if: ${{ matrix.label != 'linting' && matrix.python-version != '2.7' }}
80+
if: ${{ matrix.label != 'linting' && !contains(fromJson('["2.7", "3.5"]'), matrix.python-version) }}
10181

10282
uses: codecov/codecov-action@v4
10383
with:
@@ -109,8 +89,8 @@ jobs:
10989
env_vars: TOXENV,TEST_QUICK,TEST_KEYBOARD,TEST_RAW
11090

11191
# Work around for https://github.com/codecov/codecov-action/issues/1277
112-
- name: Upload to Codecov (2.7 workaround)
113-
if: ${{ matrix.python-version == '2.7' && matrix.label != 'linting' }}
92+
- name: Upload to Codecov Workaround
93+
if: ${{ matrix.label != 'linting' && contains(fromJson('["2.7", "3.5"]'), matrix.python-version) }}
11494

11595
uses: codecov/codecov-action@v3
11696
with:

0 commit comments

Comments
 (0)