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
- flake8 :
34
+ ruff :
35
35
runs-on : ubuntu-latest
36
- name : Lint - PEP8 & more (flake8 )
36
+ name : Lint - PEP8 & more (ruff )
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 flake8
49
- run : flake8 zulipterminal/ tests/ setup.py `tools/python_tools.py`
48
+ - name : Run ruff
49
+ run : ruff 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.6
60
+ python-version : 3.7
61
61
cache : ' pip'
62
62
cache-dependency-path : ' setup.py'
63
63
- name : Install with linting tools
@@ -75,14 +75,31 @@ jobs:
75
75
persist-credentials : false
76
76
- uses : actions/setup-python@v4
77
77
with :
78
- python-version : 3.6
78
+ python-version : 3.7
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
+
86
103
hotkeys :
87
104
runs-on : ubuntu-latest
88
105
name : Lint - Hotkeys linting & docs sync check
@@ -92,13 +109,13 @@ jobs:
92
109
persist-credentials : false
93
110
- uses : actions/setup-python@v4
94
111
with :
95
- python-version : 3.6
112
+ python-version : 3.7
96
113
cache : ' pip'
97
114
cache-dependency-path : ' setup.py'
98
115
- name : Minimal install
99
116
run : pip install .
100
- - name : Run generate_hotkeys
101
- run : ./tools/generate_hotkeys.py --check-only
117
+ - name : Run lint-hotkeys
118
+ run : ./tools/lint-hotkeys
102
119
103
120
docstrings :
104
121
runs-on : ubuntu-latest
@@ -109,30 +126,89 @@ jobs:
109
126
persist-credentials : false
110
127
- uses : actions/setup-python@v4
111
128
with :
112
- python-version : 3.6
129
+ python-version : 3.7
113
130
cache : ' pip'
114
131
cache-dependency-path : ' setup.py'
115
132
- name : Minimal install
116
133
run : pip install .
117
134
- name : Run lint-docstring
118
135
run : ./tools/lint-docstring
119
136
120
- pytest :
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
121
197
strategy :
122
198
# Not failing fast allows all matrix jobs to try & finish even if one fails early
123
199
fail-fast : false
124
200
matrix :
125
201
env :
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)" }
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 } }
136
212
runs-on : ${{ matrix.env.OS }}
137
213
name : Install & test - ${{ matrix.env.NAME}}
138
214
steps :
@@ -154,11 +230,9 @@ jobs:
154
230
run : sudo apt install libxml2-dev libxslt1-dev
155
231
- name : Ensure regular package installs from checkout
156
232
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}'"
157
235
- name : Install test dependencies
158
236
run : pip install .[testing]
159
237
- name : Run tests with pytest
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
238
+ run : pytest --cov-report=
0 commit comments