Skip to content

Commit 821cd31

Browse files
committed
feat(gha): use tox environments
1 parent c4b89aa commit 821cd31

File tree

1 file changed

+30
-37
lines changed

1 file changed

+30
-37
lines changed

.github/workflows/testing.yml

+30-37
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@ env:
99
jobs:
1010
test:
1111
name: Testing on
12-
runs-on: ${{ matrix.os }}
12+
runs-on: "ubuntu-latest"
1313
strategy:
1414
matrix:
1515
python-version: ["3.12", "3.11", "3.10", 3.9, 3.8, pypy-3.9]
16-
os: ["ubuntu-22.04"]
17-
include:
18-
- os: "ubuntu-latest"
19-
python-version: 3.11
2016
steps:
2117
- uses: actions/checkout@v4
2218
- name: Set up Python
@@ -27,39 +23,36 @@ jobs:
2723
uses: actions/cache@v3
2824
with:
2925
path: ~/.cache/pip
30-
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
26+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('tox.ini') }}
3127
restore-keys: |
3228
${{ runner.os }}-pip-${{ matrix.python-version }}-
33-
- name: pip version
34-
run: pip --version
3529
- name: Install dependencies
36-
if: matrix.python-version == '3.9'
37-
run: python -m pip install -r requirements-lint.txt
38-
- name: Install dependencies
39-
if: matrix.python-version != '3.9'
40-
run: python -m pip install -r requirements.txt
41-
# formatters
42-
- name: Run pyupgrade
43-
if: matrix.python-version == '3.9'
44-
run: pyupgrade --py37-plus *.py
45-
- name: Run isort
46-
if: matrix.python-version == '3.9'
47-
run: isort --check-only *.py
48-
- name: Run black
49-
if: matrix.python-version == '3.9'
50-
run: black --check --skip-string-normalization *.py
51-
# linters
52-
- name: Lint with bandit
53-
if: matrix.python-version == '3.9'
54-
run: bandit --skip B101 *.py # B101 is assert statements
55-
- name: Lint with codespell
56-
if: matrix.python-version == '3.9'
57-
run: codespell *.rst *.py
58-
- name: Lint with flake8
59-
if: matrix.python-version == '3.9'
60-
run: flake8 *.py --count --max-complexity=18 --max-line-length=88 --show-source --statistics
61-
# tests and coverage
30+
run: python -m pip install tox
6231
- name: Test
63-
run: pytest run_tests.py --cov --cov-report term-missing
64-
- name: Coverage
65-
run: coveralls --service=github
32+
run: tox -e test
33+
34+
lint:
35+
name: Lint code
36+
runs-on: "ubuntu-latest"
37+
strategy:
38+
matrix:
39+
python-version: [3.8]
40+
steps:
41+
- uses: actions/checkout@v4
42+
- name: Set up Python
43+
uses: actions/setup-python@v4
44+
with:
45+
python-version: ${{ matrix.python-version }}
46+
- name: Cache packages
47+
uses: actions/cache@v3
48+
with:
49+
path: |
50+
~/.cache/pre-commit
51+
~/.cache/pip
52+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('tox.ini') }}
53+
restore-keys: |
54+
${{ runner.os }}-pip-${{ matrix.python-version }}-
55+
- name: Install dependencies
56+
run: python -m pip install tox
57+
- name: Run linting
58+
run: tox -e lint

0 commit comments

Comments
 (0)