Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

chore: improve pre-commit setup #167

Merged
merged 2 commits into from
Mar 2, 2024
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
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