-
-
Notifications
You must be signed in to change notification settings - Fork 6
95 lines (82 loc) · 2.34 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Tests
on:
push:
branches: ["*"]
pull_request:
branches: [main]
jobs:
tests:
name: Python ${{ matrix.python }} ${{ matrix.os }}
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12", pypy3.8, pypy3.10]
include:
- {python: "3.6", os: ubuntu-20.04, tox3: true}
- {python: "3.7", tox3: true}
- {python: pypy2.7, tox3: true}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ matrix.python }}
- run: python -m pip install --upgrade pip setuptools
- name: Install tox4
run: pip install tox
if: ${{ ! matrix.tox3 }}
- name: Install tox3
run: pip install 'tox<4' 'virtualenv<20.22.0'
if: ${{ matrix.tox3 }}
- name: Compute tox env name
run: |
toxenv=$(python -c '
ver=r"${{ matrix.python }}".replace(".", "")
print("py" + ver if ver[0].isdigit() else ver)
')
echo toxenv is "$toxenv";
echo "TOXENV=$toxenv" >> "$GITHUB_ENV"
- name: Test with tox
run: tox
- uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ matrix.python }}
path: .coverage.*
include-hidden-files: true
test-py27:
name: Python 2.7
runs-on: ubuntu-latest
container: python:2.7-buster
steps:
- uses: actions/checkout@v4
- run: python -m pip install --upgrade pip setuptools
- name: Install tox3
run: pip install 'tox<4' 'virtualenv<20.22.0'
- name: Test with tox
run: tox -e py27
- uses: actions/upload-artifact@v4
with:
name: coverage-data-2.7
path: .coverage.*
include-hidden-files: true
coverage:
needs: [tests, test-py27]
if: ${{ success() || failure() }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: coverage-data-*
merge-multiple: true
- run: python -m pip install tox
- run: tox -e cover-report
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: python -m pip install pre-commit tox
- run: pre-commit run -a
- run: tox r -e lint
if: ${{ success() || failure() }}