9
9
10
10
# Cancel previous runs within same workflow and if within a PR (all branch runs complete)
11
11
# (head_ref [branch name] is unique to and only for PRs, otherwise use always-unique run_id)
12
- concurrency :
12
+ concurrency :
13
13
group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
14
14
cancel-in-progress : true
15
15
31
31
- name : Run mypy
32
32
run : ./tools/run-mypy
33
33
34
- ruff :
34
+ flake8 :
35
35
runs-on : ubuntu-latest
36
- name : Lint - PEP8 & more (ruff )
36
+ name : Lint - PEP8 & more (flake8 )
37
37
steps :
38
38
- uses : actions/checkout@v3
39
39
with :
45
45
cache-dependency-path : ' setup.py'
46
46
- name : Install with linting tools
47
47
run : pip install .[linting]
48
- - name : Run ruff
49
- run : ruff zulipterminal/ tests/ setup.py `tools/python_tools.py`
48
+ - name : Run flake8
49
+ run : flake8 zulipterminal/ tests/ setup.py `tools/python_tools.py`
50
50
51
51
isort :
52
52
runs-on : ubuntu-latest
57
57
persist-credentials : false
58
58
- uses : actions/setup-python@v4
59
59
with :
60
- python-version : 3.7
60
+ python-version : 3.6
61
61
cache : ' pip'
62
62
cache-dependency-path : ' setup.py'
63
63
- name : Install with linting tools
@@ -75,31 +75,14 @@ jobs:
75
75
persist-credentials : false
76
76
- uses : actions/setup-python@v4
77
77
with :
78
- python-version : 3.7
78
+ python-version : 3.6
79
79
cache : ' pip'
80
80
cache-dependency-path : ' setup.py'
81
81
- name : Install with linting tools
82
82
run : pip install .[linting]
83
83
- name : Check code & tests meet black standards
84
84
run : black --check zulipterminal/ tests/ setup.py `tools/python_tools.py`
85
85
86
- spellcheck :
87
- runs-on : ubuntu-latest
88
- name : Lint - Spellcheck
89
- steps :
90
- - uses : actions/checkout@v3
91
- with :
92
- persist-credentials : false
93
- - uses : actions/setup-python@v4
94
- with :
95
- python-version : 3.7
96
- cache : ' pip'
97
- cache-dependency-path : ' setup.py'
98
- - name : Install with linting tools
99
- run : pip install .[linting]
100
- - name : Check spelling
101
- run : ./tools/run-spellcheck
102
-
103
86
hotkeys :
104
87
runs-on : ubuntu-latest
105
88
name : Lint - Hotkeys linting & docs sync check
@@ -109,13 +92,13 @@ jobs:
109
92
persist-credentials : false
110
93
- uses : actions/setup-python@v4
111
94
with :
112
- python-version : 3.7
95
+ python-version : 3.6
113
96
cache : ' pip'
114
97
cache-dependency-path : ' setup.py'
115
98
- name : Minimal install
116
99
run : pip install .
117
- - name : Run lint-hotkeys
118
- run : ./tools/lint-hotkeys
100
+ - name : Run generate_hotkeys
101
+ run : ./tools/generate_hotkeys.py --check-only
119
102
120
103
docstrings :
121
104
runs-on : ubuntu-latest
@@ -126,89 +109,30 @@ jobs:
126
109
persist-credentials : false
127
110
- uses : actions/setup-python@v4
128
111
with :
129
- python-version : 3.7
112
+ python-version : 3.6
130
113
cache : ' pip'
131
114
cache-dependency-path : ' setup.py'
132
115
- name : Minimal install
133
116
run : pip install .
134
117
- name : Run lint-docstring
135
118
run : ./tools/lint-docstring
136
119
137
- base_pytest :
138
- runs-on : ubuntu-latest
139
- name : Install & test - CPython 3.7 (ubuntu), codecov
140
- steps :
141
- - uses : actions/checkout@v3
142
- with :
143
- persist-credentials : false
144
- - name : Install Python version
145
- uses : actions/setup-python@v4
146
- with :
147
- python-version : 3.7
148
- cache : ' pip'
149
- cache-dependency-path : ' setup.py'
150
- - name : Output Python version
151
- run : python --version
152
- - name : Upgrade pip
153
- run : python -m pip install --upgrade pip
154
- - name : Ensure regular package installs from checkout
155
- run : pip install .
156
- - name : Install test dependencies
157
- run : pip install .[testing]
158
- - name : Run tests with pytest
159
- run : pytest --cov-report=xml
160
- - name : Upload coverage to Codecov
161
- uses : codecov/codecov-action@v3
162
-
163
- isolated-commits :
164
- runs-on : ubuntu-latest
165
- name : Ensure isolated PR commits
166
- needs :
167
- - mypy
168
- - ruff
169
- - isort
170
- - black
171
- - spellcheck
172
- - hotkeys
173
- - docstrings
174
- - base_pytest
175
- steps :
176
- - uses : actions/checkout@v3
177
- if : github.event_name == 'pull_request'
178
- with :
179
- persist-credentials : false
180
- ref : ${{ github.event.pull_request.head.sha }}
181
- fetch-depth : 0
182
- - uses : actions/setup-python@v4
183
- if : github.event_name == 'pull_request'
184
- with :
185
- python-version : 3.7
186
- cache : ' pip'
187
- cache-dependency-path : ' setup.py'
188
- - name : Run check-branch
189
- if : github.event_name == 'pull_request'
190
- # Note that we install at each step since dependencies may change
191
- run :
192
- git fetch https://github.com/zulip/zulip-terminal main;
193
- CHECK="pip install .[linting,testing,typing] && ./tools/lint-all && pytest" ./tools/check-branch FETCH_HEAD
194
-
195
- pytest-on-other-platforms :
196
- needs : isolated-commits
120
+ pytest :
197
121
strategy :
198
122
# Not failing fast allows all matrix jobs to try & finish even if one fails early
199
123
fail-fast : false
200
124
matrix :
201
125
env :
202
- - {PYTHON: 3.8 , OS: ubuntu-latest, NAME: "CPython 3.8 (ubuntu)", EXPECT: "Linux "}
203
- - {PYTHON: 3.9 , OS: ubuntu-latest, NAME: "CPython 3.9 (ubuntu)", EXPECT: "Linux "}
204
- - {PYTHON: "3.10" , OS: ubuntu-latest, NAME: "CPython 3.10 (ubuntu)", EXPECT: "Linux "}
205
- - {PYTHON: "3.11" , OS: ubuntu-latest, NAME: "CPython 3.11 (ubuntu)", EXPECT: "Linux" }
206
- - {PYTHON: 'pypy-3.7' , OS: ubuntu-latest, NAME: "PyPy 3.7 (ubuntu)", EXPECT: "Linux "}
207
- - {PYTHON: 'pypy-3.8 ', OS: ubuntu-latest, NAME: "PyPy 3.8 (ubuntu)", EXPECT: "Linux "}
208
- - {PYTHON: 'pypy-3.9 ', OS: ubuntu-latest, NAME: "PyPy 3.9 (ubuntu)", EXPECT: "Linux "}
209
- - {PYTHON: '3.x ', OS: macos -latest, NAME: "CPython 3.x [latest] (macos)", EXPECT: "MacOS "}
210
- env :
211
- EXPECT : ${{ matrix.env.EXPECT } }
126
+ - {PYTHON: 3.6 , OS: ubuntu-latest, NAME: "CPython 3.6 (ubuntu)"}
127
+ - {PYTHON: 3.7 , OS: ubuntu-latest, NAME: "CPython 3.7 (ubuntu)"}
128
+ - {PYTHON: 3.8 , OS: ubuntu-latest, NAME: "CPython 3.8 (ubuntu)"}
129
+ - {PYTHON: 3.9 , OS: ubuntu-latest, NAME: "CPython 3.9 (ubuntu)", CODECOV: true }
130
+ - {PYTHON: "3.10" , OS: ubuntu-latest, NAME: "CPython 3.10 (ubuntu)"}
131
+ - {PYTHON: 'pypy-3.6 ', OS: ubuntu-latest, NAME: "PyPy 3.6 (ubuntu)"}
132
+ - {PYTHON: 'pypy-3.7 ', OS: ubuntu-latest, NAME: "PyPy 3.7 (ubuntu)"}
133
+ - {PYTHON: 'pypy-3.8 ', OS: ubuntu -latest, NAME: "PyPy 3.8 (ubuntu) "}
134
+ - {PYTHON: 'pypy-3.9', OS: ubuntu-latest, NAME: "PyPy 3.9 (ubuntu)"}
135
+ - {PYTHON: 3.9, OS: macos-latest, NAME: "CPython 3.9 (macos)" }
212
136
runs-on : ${{ matrix.env.OS }}
213
137
name : Install & test - ${{ matrix.env.NAME}}
214
138
steps :
@@ -230,9 +154,11 @@ jobs:
230
154
run : sudo apt install libxml2-dev libxslt1-dev
231
155
- name : Ensure regular package installs from checkout
232
156
run : pip install .
233
- - name : Check we detect the platform correctly
234
- run : python -c "from zulipterminal.platform_code import detected_platform; import os; e, d = os.environ['EXPECT'], detected_platform(); assert d == e, f'{d} != {e}'"
235
157
- name : Install test dependencies
236
158
run : pip install .[testing]
237
159
- name : Run tests with pytest
238
- run : pytest --cov-report=
160
+ run : pytest --cov-report=xml
161
+ - name : Upload coverage to Codecov
162
+ uses : codecov/codecov-action@v2
163
+ # We avoid extra work by just running codecov on one python version
164
+ if : matrix.env.CODECOV
0 commit comments