Skip to content

Commit

Permalink
Create Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Dozgulbas authored Apr 9, 2024
1 parent 5717349 commit 46d6575
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

.DEFAULT_GOAL := init

.PHONY += init paths checks test clean

init: # Do the initial configuration of the project
@test -e .env || cp example.env .env
ifeq ($(shell uname),Darwin)
@sed -i '' 's|^PROJECT_PATH=.*|PROJECT_PATH=$(shell pwd | sed 's/\//\\\//g')|' .env
else
@sed -i 's/^PROJECT_PATH=.*/PROJECT_PATH=$(shell pwd | sed 's/\//\\\//g')/' .env
endif

.env: init

paths: .env # Create the necessary data directories
@mkdir -p $(shell grep -E '^WEI_DATA_DIR=' .env | cut -d '=' -f 2)
@mkdir -p $(shell grep -E '^REDIS_DIR=' .env | cut -d '=' -f 2)

checks: # Runs all the pre-commit checks
@pre-commit install
@pre-commit run --all-files || { echo "Checking fixes\n" ; pre-commit run --all-files; }

test: init .env paths # Runs all the tests
@docker compose -f wei.compose.yaml --env-file .env up --build -d
@docker compose -f wei.compose.yaml --env-file .env exec fom_module pytest -p no:cacheprovider fom_module
@docker compose -f wei.compose.yaml --env-file .env down

clean:
@rm .env

0 comments on commit 46d6575

Please sign in to comment.