This repository has been archived by the owner on Oct 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
57 lines (40 loc) · 1.74 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
NAME = bobcat-miner-python
VERSION = $(shell poetry version -s)
SHELL := /bin/bash
.PHONY: help all
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help
all: build tests run
# linux/amd64
build: ## Build lint and test images and build Docker Compose services
docker build -f Dockerfile.dev . -t $(NAME)-lint --target lint
docker build -f Dockerfile.dev . -t $(NAME)-test --target test
docker-compose build
build-release: ## Build multi-platform release images
docker buildx build . -t bobcat --platform linux/amd64,linux/arm/v7
up: ## Spin up local development stack
docker-compose up -d
dev: up ## Attach to the bobcat-miner-python dev container
docker-compose exec $(NAME)-dev poetry run /bin/bash
dev-bobcat: up ## Attach to the fancy-awesome-bobcat dev container
docker-compose exec fancy-awesome-bobcat /bin/bash
down: ## Spin down local dev services
docker-compose down
lint: ## Lint with black
docker run --rm -it -v "$$(pwd)":/app $(NAME)-lint
test: ## Run unittests
docker run --rm -it -v "$$(pwd)":/app $(NAME)-test
tests: lint test ## Lint and Test
run: ## Run the 'bobcat autopilot' in a container
docker run --rm -it --env-file .env bobcat autopilot
release: tests ## Push tags and trigger Github Actions release.
git tag $(VERSION)
git push --tags
clean: ## Remove Python cache files.
@rm -rf build dist .eggs *.egg-info .venv requirements.txt
@rm -rf .benchmarks .coverage coverage.xml htmlcov report.xml .tox
@find . -type d -name '.mypy_cache' -exec rm -rf {} +
@find . -type d -name '__pycache__' -exec rm -rf {} +
@find . -type d -name '*pytest_cache*' -exec rm -rf {} +
@find . -type f -name "*.py[co]" -exec rm -rf {} +