Skip to content

Commit

Permalink
chore: improve pre-commit setup (#167)
Browse files Browse the repository at this point in the history
* chore: ensure poetry install in .venv

* chore: update pre-commit setup
  • Loading branch information
jooola authored Mar 2, 2024
1 parent d7affcf commit d54f859
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/actions/python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ runs:
with:
python-version: ${{ inputs.python-version }}

- uses: snok/install-poetry@v1
with:
virtualenvs-in-project: true
- run: pipx install poetry
shell: bash

- uses: actions/cache@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
with:
python-version: "3.10"

- run: make install

- uses: pre-commit/[email protected]

- uses: pre-commit-ci/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ repos:
- id: format
name: Format code
description: Format code
entry: bash -c '[[ "$CI" != "true" ]] && make format || true'
entry: make format
language: system
pass_filenames: false
always_run: true

- id: lint
name: Lint code
description: Lint code
entry: bash -c '[[ "$CI" != "true" ]] && make lint || true'
entry: make lint
language: system
pass_filenames: false
always_run: true
20 changes: 9 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,29 @@ all: install format lint test
install-poetry:
curl -sSL https://install.python-poetry.org | python3 -

POETRY_VIRTUALENVS_IN_PROJECT = true
export POETRY_VIRTUALENVS_IN_PROJECT = true

INSTALL_STAMP := .installed
install: $(INSTALL_STAMP)
$(INSTALL_STAMP):
install: .venv
.venv:
poetry install
touch $(INSTALL_STAMP)

format: install
format: .venv
poetry run black .
poetry run isort --profile black .

lint: install
lint: .venv
poetry run black . --diff --check
poetry run pylint gh_release_install tests
poetry run mypy gh_release_install tests

test: install
test: .venv
poetry run pytest -n $(CPU_CORES) --color=yes -v --cov=gh_release_install tests

e2e: install
e2e: .venv
poetry run pytest -n $(CPU_CORES) --color=yes -v --cov=gh_release_install e2e

examples: install
examples: .venv
poetry run ./examples.sh

ci-publish: install
ci-publish: .venv
poetry publish --no-interaction --build

0 comments on commit d54f859

Please sign in to comment.