Skip to content

Run pre-commit with poetry in CI workflows #131

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,28 @@ jobs:
id: python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")

- name: Restore cache
- name: Install Poetry
uses: snok/install-poetry@v1.1.8
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Restore poetry cache
id: cache
uses: actions/cache@v2.1.6
with:
path: |
~/.cache/pip
~/.cache/pre-commit
path: .venv
key: poetry-${{ runner.os }}-${{ steps.python-version.outputs.version }}-${{ hashFiles('poetry.lock') }}

- name: Restore pre-commit cache
uses: actions/cache@v2.1.6
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ steps.python-version.outputs.version }}-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: poetry install

- name: Run pre-commit
uses: pre-commit/action@v2.0.3
with:
extra_args: --all-files --show-diff-on-failure
run: poetry run pre-commit run --all-files --show-diff-on-failure
26 changes: 19 additions & 7 deletions .github/workflows/update-pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,31 @@ jobs:
id: python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")

- name: Restore cache
- name: Install Poetry
uses: snok/install-poetry@v1.1.8
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Restore poetry cache
id: cache
uses: actions/cache@v2.1.6
with:
path: .venv
key: poetry-${{ runner.os }}-${{ steps.python-version.outputs.version }}-${{ hashFiles('poetry.lock') }}

- name: Restore pre-commit cache
uses: actions/cache@v2.1.6
with:
path: |
~/.cache/pip
~/.cache/pre-commit
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ steps.python-version.outputs.version }}-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Install pre-commit
run: pip install pre-commit
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: poetry install

- name: Update pre-commit hooks
run: pre-commit autoupdate
run: poetry run pre-commit autoupdate

- name: Get commit message and pull request body
id: messages
Expand Down