Skip to content

Commit 4e4e1d0

Browse files
committed
chore: optimize build file make it error sooner on flake8 tests
Move: pip update, pip install of required python test modules (pytest, flake8 ...) flake8 sanity test before all the code that sets installs xapian, whoosh, databases etc. This should make a syntax error creeping in fail faster.
1 parent a2c4b2f commit 4e4e1d0

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

.github/workflows/ci-test.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,21 @@ jobs:
113113
python -c "import sqlite3; print('sqlite version: ', sqlite3.sqlite_version)"
114114
python -c "import setuptools; print('setuptools version: ', setuptools.__version__);"
115115
116+
- name: Update pip
117+
run: python -m pip install --upgrade pip
118+
119+
- name: Install pytest and other packages needed for running tests
120+
run: pip install flake8 mock pytest pytest-cov requests sphinx-tabs
121+
122+
- name: run flake8 - abort for syntax error, otherwise warn only
123+
run: |
124+
# stop the build for Python syntax errors or undefined names
125+
# talgettext is a utility function ignore it.
126+
flake8 roundup --count --select=E9,F63,F7,F82 --show-source --statistics --extend-exclude talgettext.py
127+
# exit-zero treats all errors as warnings.
128+
# The GitHub editor is 127 chars wide
129+
flake8 roundup --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
130+
116131
# Install the databases
117132
- name: Install mysql/mariadb
118133
run: |
@@ -162,9 +177,6 @@ jobs:
162177
sudo apt-get install redis
163178
pip install redis
164179
165-
- name: Update pip
166-
run: python -m pip install --upgrade pip
167-
168180
- name: Install python db libraries
169181
run: pip install psycopg2 mysqlclient
170182

@@ -218,24 +230,12 @@ jobs:
218230
fi
219231
case "$PYTHON_VERSION" in nightly) echo skipping xapian build;; *) make && sudo make install; esac
220232
221-
- name: Install pytest and other packages needed for running tests
222-
run: pip install flake8 mock pytest pytest-cov requests sphinx-tabs
223-
224233
- name: Test build roundup and install locale so lang tests work.
225234
run: |
226235
sudo apt-get install gettext
227236
python setup.py build
228237
(cd locale; make local_install; ls -lR locale/de/LC_MESSAGES)
229238
230-
- name: run flake8 - abort for syntax error, otherwise warn only
231-
run: |
232-
# stop the build for Python syntax errors or undefined names
233-
# talgettext is a utility function ignore it.
234-
flake8 roundup --count --select=E9,F63,F7,F82 --show-source --statistics --extend-exclude talgettext.py
235-
# exit-zero treats all errors as warnings.
236-
# The GitHub editor is 127 chars wide
237-
flake8 roundup --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
238-
239239
# Run the tests using pytest with test files in tests directory.
240240
- name: Run tests
241241
run: |

0 commit comments

Comments
 (0)