This repository has been archived by the owner on Mar 22, 2024. It is now read-only.
forked from sinhrks/cesiumpy
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
111 lines (91 loc) · 3.26 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
######################################################################################################################################################
# @project CesiumPy
# @file Makefile
# @license Apache 2.0
######################################################################################################################################################
project_name := cesiumpy
project_version := $(shell git describe --tags --always)
image_registry := lucasbremond
image_url := $(image_registry)/$(project_name)
dev_image_url := $(image_url)-dev
service_name := $(project_name)
working_directory := /workspace
######################################################################################################################################################
image: ## Build production image
docker build \
--target=prod \
--tag=$(image_url) \
--tag=$(image_url):$(project_version) \
.
.PHONY: image
dev-image: ## Build development image
docker build \
--target=dev \
--tag=$(dev_image_url) \
--tag=$(dev_image_url):$(project_version) \
.
.PHONY: dev-image
run: image ## Run container
docker run \
--name=$(service_name) \
-it \
--rm \
$(image_url):$(project_version)
.PHONY: run
dev: dev-image ## Run development environment
docker run \
--name=$(service_name)-dev \
-it \
--rm \
--volume="$(CURDIR):$(working_directory)" \
--env="CESIUM_TOKEN" \
--workdir=$(working_directory) \
$(dev_image_url):$(project_version) \
/bin/bash
.PHONY: dev
check-style: dev-image ## Check code formatting
docker run \
--rm \
--volume="$(CURDIR):$(working_directory)" \
--workdir=$(working_directory) \
$(dev_image_url):$(project_version) \
/bin/bash -c "flake8"
.PHONY: check-style
check-types: dev-image ## Check types
docker run \
--rm \
--volume="$(CURDIR):$(working_directory)" \
--workdir=$(working_directory) \
$(dev_image_url):$(project_version) \
/bin/bash -c "mypy -p ccsds -p tests -p setup"
.PHONY: check-types
test: dev-image ## Run unit tests
docker run \
--rm \
--volume="$(CURDIR):$(working_directory)" \
--workdir=$(working_directory) \
$(dev_image_url):$(project_version) \
/bin/bash -c "pytest -svx --cov=."
.PHONY: test
clean: ## Clean repository
find . -type f -name ".coverage" -exec rm -rf {} +
find . -type d -name "dist" -exec rm -rf {} +
find . -type d -name "build" -exec rm -rf {} +
find . -type d -name "venv" -exec rm -rf {} +
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type d -name ".pytest_cache" -exec rm -rf {} +
find . -type d -name "*.egg-info" -exec rm -rf {} +
find . -type d -name ".mypy_cache" -exec rm -rf {} +
.PHONY: clean
reset: ## Reset repository
git clean -xdf || true
.PHONY: reset
help: ## Show help
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: help
######################################################################################################################################################
.EXPORT_ALL_VARIABLES:
DOCKER_BUILDKIT = 1
COMPOSE_DOCKER_CLI_BUILD = 1
.DEFAULT_GOAL := help
######################################################################################################################################################