From 7f765e83b7f44d5523e8d184ef665dc6c478d44b Mon Sep 17 00:00:00 2001 From: george Date: Sun, 6 Feb 2022 16:08:40 +0000 Subject: [PATCH] Use install-poetry to use poetry with caching. --- .flake8 | 7 ++++--- .github/workflows/main.yml | 31 ++++++++++++++++++++----------- coverage.ini | 2 ++ 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/.flake8 b/.flake8 index 0d12032b..bac582ca 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,5 @@ [flake8] -ignore = +ignore = # line length is handled by black E501, # W503 & E203 are not PEP 8 compliant and conflicts with black @@ -9,10 +9,11 @@ ignore = F541, # allow bare "except" E722 -exclude = +exclude = .git, __pycache__, .pytest_cache, + .venv, static, templates, # migrations are generated by alembic @@ -22,4 +23,4 @@ exclude = per-file-ignores = # ignore unused imports in __init__ - __init__.py:F401 \ No newline at end of file + __init__.py:F401 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 674d96ab..5ce7ede4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,25 +38,34 @@ jobs: --health-retries 5 steps: - - uses: actions/checkout@v2 + - name: Check out repository + uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - uses: actions/cache@v1 + - name: Install poetry + uses: snok/install-poetry@v1 with: - path: ~/.cache/poetry - key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} - restore-keys: | - ${{ runner.os }}-poetry- + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + + - name: Run caching + id: cached-poetry-dependencies + uses: actions/cache@v2 + with: + path: .venv + key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} - name: Install dependencies - run: | - python -m pip install poetry==1.0.10 - poetry config virtualenvs.create false - poetry install + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root + + - name: Install library + run: poetry install --no-interaction - name: Check formatting & linting run: | @@ -65,7 +74,7 @@ jobs: - name: Test with pytest run: | - pytest + poetry run pytest env: GITHUB_ACTIONS_TEST: true diff --git a/coverage.ini b/coverage.ini index dc571cc8..012c566a 100644 --- a/coverage.ini +++ b/coverage.ini @@ -1,6 +1,8 @@ [run] branch = True source = . +omit = + .venv/* [report] fail_under = 55