Skip to content

Commit 08b4f27

Browse files
authored
ci: Use Poetry for CI (#86)
* ci: Use Poetry for CI Installs Poetry and uses it for dependency setup and virtualenv execution in CI. If nothing has changed in the lockfile, use cached virtual environment. * ci: Add excludes for flake8 * build: Add pytest-cov to pyproject dependencies
1 parent 66f1e33 commit 08b4f27

File tree

4 files changed

+56
-15
lines changed

4 files changed

+56
-15
lines changed

.flake8

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,12 @@ ignore = E203,E501,W503
44
max-line-length = 88
55
import-order-style = google
66
per-file-ignores = noxfile.py:ANN
7-
docstring-convention = google
7+
docstring-convention = google
8+
exclude =
9+
.git
10+
.venv
11+
__pycache__
12+
docs/source/conf.py
13+
old
14+
build
15+
dist

.github/workflows/python-package.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,29 @@ jobs:
2424
uses: actions/setup-python@v3
2525
with:
2626
python-version: ${{ matrix.python-version }}
27+
- name: Install and configure Poetry
28+
uses: snok/install-poetry@v1
29+
with:
30+
virtualenvs-create: true
31+
virtualenvs-in-project: true
32+
installer-parallel: true
33+
- name: Load cached venv
34+
id: cached-poetry-dependencies
35+
uses: actions/cache@v3
36+
with:
37+
path: .venv
38+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
2739
- name: Install dependencies
28-
run: |
29-
python -m pip install --upgrade pip
30-
python -m pip install flake8 pytest pytest-cov requests pandas
31-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
40+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
41+
run: poetry install --no-interaction --no-root --all-extras
3242
- name: Lint with flake8
3343
run: |
3444
# stop the build if there are Python syntax errors or undefined names
35-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
45+
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
3646
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
47+
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
3848
- name: Test with pytest
3949
run: |
40-
pytest --cov
50+
poetry run pytest --cov
4151
- name: Upload coverage to Codecov
4252
uses: codecov/codecov-action@v3

poetry.lock

Lines changed: 29 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ flake8-docstrings = "^1.6.0"
2929
darglint = "^1.8.1"
3030
Sphinx = "^5.2.3"
3131
sphinx-autodoc-typehints = "^1.19.4"
32+
pytest-cov = "^4.0.0"
3233

3334
[build-system]
3435
requires = ["poetry-core"]

0 commit comments

Comments
 (0)