Skip to content

Commit

Permalink
Fix style and clean up Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Donnype committed Mar 25, 2024
1 parent afb7eaf commit 7fe5403
Show file tree
Hide file tree
Showing 4 changed files with 302 additions and 326 deletions.
34 changes: 17 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,33 @@ export PROJECT=api
targets: help

up: ## Run the application
docker-compose up --build api
docker compose up --build api


done: lint test ## Prepare for a commit
test: utest itest ## Run unit and integration tests

ci-docker-compose := docker-compose -f .ci/docker-compose.yml
ci-compose := docker compose -f .ci/docker-compose.yml

utest: cleantest ## Run unit tests
$(ci-docker-compose) run --rm unit pytest -m unit .
$(ci-compose) run --rm unit pytest -m unit .

itest: cleantest ## Run integration tests
$(ci-docker-compose) run --rm integration pytest -m integration .
$(ci-compose) run --rm integration pytest -m integration .

check: cleantest ## Check the code base
$(ci-docker-compose) run --rm unit black ./$(PROJECT) --check --diff
$(ci-docker-compose) run --rm unit isort ./$(PROJECT) --check --diff
$(ci-docker-compose) run --rm -v mypycache:/home/user/.mypy_cache unit mypy ./$(PROJECT)
check: ## Check the code base
$(ci-compose) run --rm unit black ./$(PROJECT) --check --diff
$(ci-compose) run --rm unit isort ./$(PROJECT) --check --diff
$(ci-compose) run --rm -v mypycache:/home/user/.mypy_cache unit mypy ./$(PROJECT)

lint: cleantest ## Check the code base, and fix it
$(ci-docker-compose) run --rm unit black ./$(PROJECT)
$(ci-docker-compose) run --rm unit isort ./$(PROJECT)
$(ci-docker-compose) run --rm -v mypycache:/home/user/.mypy_cache unit mypy ./$(PROJECT)
lint: ## Check the code base, and fix it
$(ci-compose) run --rm unit black ./$(PROJECT)
$(ci-compose) run --rm unit isort ./$(PROJECT)
$(ci-compose) run --rm -v mypycache:/home/user/.mypy_cache unit mypy ./$(PROJECT)

cleantest: ## Clean up test containers
$(ci-docker-compose) build
$(ci-docker-compose) down --remove-orphans
$(ci-compose) build
$(ci-compose) down --remove-orphans


## Migrations
Expand All @@ -46,14 +46,14 @@ ifeq ($(m),)
else ifeq ($(revid),)
@echo "Specify a message with m={message} and a rev-id with revid={revid} (e.g. 0001 etc.)"; exit 1
else
docker-compose run api alembic revision --autogenerate -m "$(m)" --rev-id="$(revid)"
docker compose run api alembic revision --autogenerate -m "$(m)" --rev-id="$(revid)"
endif

migrate: ## Run migrations upgrade using alembic
docker-compose run --rm api alembic upgrade head
docker compose run --rm api alembic upgrade head

downgrade: ## Run migrations downgrade using alembic
docker-compose run --rm api alembic downgrade -1
docker compose run --rm api alembic downgrade -1

help: ## Display this help message
@awk -F '##' '/^[a-z_]+:[a-z ]+##/ { print "\033[34m"$$1"\033[0m" "\n" $$2 }' Makefile
1 change: 1 addition & 0 deletions api/migrations/versions/0001_initial_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-10-18 11:12:22.253864
"""

import sqlalchemy as sa
from alembic import op

Expand Down
Loading

0 comments on commit 7fe5403

Please # to comment.