forked from astronomer/astronomer-providers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (46 loc) · 2.47 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.PHONY: dev clean stop build build-run restart restart-all run-mypy run-tests run-static-checks help
# If the first argument is "run"...
ifeq (run-mypy,$(firstword $(MAKECMDGOALS)))
# use the rest as arguments for "run"
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
ifndef RUN_ARGS
RUN_ARGS := .
endif
# ...and turn them into do-nothing targets
$(eval $(RUN_ARGS):;@:)
endif
dev: ## Create a development Environment using `docker-compose` file.
docker-compose -f dev/docker-compose.yaml up -d
logs: ## View logs of the all the containers
docker-compose -f dev/docker-compose.yaml logs --follow
stop: ## Stop all the containers
docker-compose -f dev/docker-compose.yaml down
clean: ## Remove all the containers along with volumes
docker-compose -f dev/docker-compose.yaml down --volumes --remove-orphans
rm -rf dev/logs
build: ## Build the Docker image (ignoring cache)
docker build -f dev/Dockerfile . -t astronomer-providers-dev:latest --no-cache
build-run: ## Build the Docker Image & then run the containers
docker-compose -f dev/docker-compose.yaml up --build -d
restart: ## Restart Triggerer & Scheduler container
docker-compose -f dev/docker-compose.yaml restart airflow-triggerer airflow-scheduler
restart-all: ## Restart all the containers
docker-compose -f dev/docker-compose.yaml restart
run-tests: ## Run CI tests
docker build -f dev/Dockerfile . -t astronomer-providers-dev
docker run -v `pwd`:/usr/local/airflow/astronomer_providers -v `pwd`/dev/.cache:/home/astro/.cache \
-w /usr/local/airflow/astronomer_providers \
--rm -it astronomer-providers-dev -- pytest tests
run-static-checks: ## Run CI static code checks
docker build -f dev/Dockerfile . -t astronomer-providers-dev
docker run -v `pwd`:/usr/local/airflow/astronomer_providers -v `pwd`/dev/.cache:/home/astro/.cache \
-w /usr/local/airflow/astronomer_providers \
--rm -it astronomer-providers-dev -- pre-commit run --all-files --show-diff-on-failure
run-mypy: ## Run MyPy in Container
docker build -f dev/Dockerfile . -t astronomer-providers-dev
docker run -v `pwd`:/usr/local/airflow/astronomer_providers -v `pwd`/dev/.cache:/home/astro/.cache \
-w /usr/local/airflow/astronomer_providers \
--rm -it astronomer-providers-dev \
-- mypy --install-types --cache-dir /home/astro/.cache/.mypy_cache $(RUN_ARGS)
help: ## Prints this message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'