-
-
Notifications
You must be signed in to change notification settings - Fork 610
156 lines (147 loc) · 4.43 KB
/
ci.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: CI
on:
pull_request:
push:
branches:
- main
tags:
schedule:
# Run everyday at 03:53 UTC
- cron: 53 3 * * *
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
FORCE_COLOR: 1 # Request colored output from CLI tools supporting it
MYPY_FORCE_COLOR: 1 # MyPy's color enforcement
PIP_DISABLE_PIP_VERSION_CHECK: 1
PIP_NO_PYTHON_VERSION_WARNING: 1
PIP_NO_WARN_SCRIPT_LOCATION: 1
PRE_COMMIT_COLOR: 1
PY_COLORS: 1 # Recognized by the `py` package, dependency of `pytest`
TOX_PARALLEL_NO_SPINNER: 1
TOX_TESTENV_PASSENV: >-
FORCE_COLOR
MYPY_FORCE_COLOR
NO_COLOR
PY_COLORS
PYTEST_THEME
PYTEST_THEME_MODE
PRE_COMMIT_COLOR
jobs:
test:
name: ${{ matrix.os }} / ${{ matrix.python-version }} / ${{ matrix.pip-version }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os:
- Ubuntu
- Windows
- macOS
python-version:
- "3.11"
- "3.10"
- "3.9"
- "3.8"
- "3.7"
pip-version:
- "latest"
- "previous"
include:
- os: Ubuntu
python-version: 3.7
pip-version: main
env:
TOXENV: pip${{ matrix.pip-version }}-coverage
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }} from GitHub
id: python-install
if: "!endsWith(matrix.python-version, '-dev')"
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }} from deadsnakes
if: endsWith(matrix.python-version, '-dev')
uses: deadsnakes/action@v2.1.1
with:
python-version: ${{ matrix.python-version }}
- name: Log python version info (${{ matrix.python-version }})
run: python --version --version
- name: Get pip cache dir
id: pip-cache
shell: bash
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Pip cache
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: >-
${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}-${{
hashFiles('pyproject.toml') }}-${{ hashFiles('tox.ini') }}-${{
hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install test dependencies
run: python -m pip install -U tox virtualenv
- name: Prepare test environment
run: tox --notest -p auto --parallel-live
- name: Test pip ${{ matrix.pip-version }}
run: tox
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
flags: >-
CI-GHA,
OS-${{ runner.os }},
VM-${{ matrix.os }},
Py-${{ steps.python-install.outputs.python-version }},
Pip-${{ matrix.pip-version }}
name: >-
OS-${{ runner.os }},
VM-${{ matrix.os }},
Py-${{ steps.python-install.outputs.python-version }},
Pip-${{ matrix.pip-version }}
pypy:
name: ${{ matrix.os }} / ${{ matrix.python-version }} / ${{ matrix.pip-version }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os:
- Ubuntu
- MacOS
- Windows
python-version:
- pypy-3.7
pip-version:
- latest
env:
TOXENV: pip${{ matrix.pip-version }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: pip install tox
- name: Prepare test environment
run: tox --notest -p auto --parallel-live
- name: Test pip ${{ matrix.pip-version }}
run: tox
check: # This job does nothing and is only used for the branch protection
if: always()
needs:
- pypy
- test
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@13b4244b312e8a314951e03958a2f91519a6a3c9
with:
jobs: ${{ toJSON(needs) }}