-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from K-dash/improve-makefile-and-precommit
Improve makefile and pre-commit
- Loading branch information
Showing
6 changed files
with
71 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
repos: | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: v0.4.6 | ||
- repo: local | ||
hooks: | ||
# Run the linter. | ||
- id: ruff | ||
entry: ruff check . --fix | ||
- id: lint | ||
name: Lint | ||
entry: make lint | ||
types: [python] | ||
language: system | ||
pass_filenames: false | ||
# Run the formatter. | ||
- id: ruff-format | ||
args: [ . ] | ||
- id: format | ||
name: Format | ||
entry: make format | ||
types: [python] | ||
language: system | ||
pass_filenames: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,68 @@ | ||
.PHONY: run run_docker test test_docker post_test docker_post_test send_email send_email_docker | ||
.DEFAULT_GOAL := all | ||
sources = src tests | ||
|
||
.PHONY: install | ||
install: | ||
poetry install | ||
poetry shell | ||
pre-commit install | ||
|
||
.PHONY: run | ||
run: | ||
poetry run python src/server.py | ||
|
||
.PHONY: format | ||
format: | ||
poetry run ruff check --fix $(sources) | ||
poetry run ruff format $(sources) | ||
|
||
.PHONY: lint | ||
lint: | ||
poetry run ruff check $(sources) | ||
poetry run ruff format --check $(sources) | ||
|
||
.PHONY: run_docker | ||
run_docker: | ||
docker compose up -d | ||
|
||
.PHONY: test | ||
test: | ||
poetry run pytest -s -x --cov=src -vv | ||
poetry run pytest | ||
|
||
.PHONY: test_docker | ||
test_docker: | ||
docker compose exec flask poetry run pytest -s -x --cov=src -vv | ||
docker compose exec flask poetry run pytest | ||
|
||
.PHONY: output_coverage | ||
output_coverage: | ||
poetry run coverage html | ||
@rm -rf htmlcov | ||
@mkdir -p htmlcov | ||
poetry run coverage run -m pytest | ||
poetry run coverage report | ||
poetry run coverage html -d htmlcov | ||
|
||
.PHONY: output_coverage_docker | ||
output_coverage_docker: | ||
docker compose exec flask poetry run coverage html | ||
@docker compose exec flask rm -rf htmlcov | ||
@docker compose exec flask mkdir -p htmlcov | ||
docker compose exec flask poetry run coverage run -m pytest | ||
docker compose exec flask poetry run coverage report | ||
docker compose exec flask poetry run coverage html -d htmlcov | ||
|
||
.PHONY: send_email | ||
send_email: | ||
poetry run python src/send_email.py | ||
|
||
.PHONY: send_email_docker | ||
send_email_docker: | ||
docker compose exec flask poetry run python src/send_email.py | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf htmlcov | ||
rm -rf .pytest_cache | ||
rm -f .coverage | ||
rm -f .coverage.* | ||
|
||
.PHONY: all | ||
all: format lint test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72e5204
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report