forked from mikedh/trimesh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (65 loc) · 1.86 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
# See: https://clarkgrubb.com/makefile-style-guide
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := all
.DELETE_ON_ERROR:
.SUFFIXES:
# get the git short hash and trimesh semver.
VERSION := $(shell python trimesh/version.py)
GIT_SHA := $(shell git rev-parse --short HEAD)
# for coverage reports
GIT_SHA_FULL := $(shell git rev-parse HEAD)
GIT_REPO := "mikedh/trimesh"
# the name of the docker images
NAME=trimesh/trimesh
REPO=docker.io
IMAGE=$(REPO)/$(NAME)
# the tags we'll be applying
TAG_LATEST=$(IMAGE):latest
TAG_GIT_SHA=$(IMAGE):$(GIT_SHA)
TAG_VERSION=$(IMAGE):$(VERSION)
# This will output the help for each task
# See: https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help: ## Print usage help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help
# build the output stage image using buildkit
.PHONY: build
build: ## Build the docker images
DOCKER_BUILDKIT=1 \
docker build \
--progress=plain \
--target output \
--tag $(TAG_LATEST) \
--tag $(TAG_VERSION) \
--tag $(TAG_GIT_SHA) \
.
# build the tests stage of the image
.PHONY: tests
tests: ## Run unit tests inside docker images.
DOCKER_BUILDKIT=1 \
docker build \
--target tests \
--progress=plain \
--build-arg "CODECOV_TOKEN=$(CODECOV_TOKEN)" \
.
# build the docs inside our image and eject the contents
# into `./html` directory
.PHONY: docs
docs: ## Build trimesh's sphinx docs
DOCKER_BUILDKIT=1 \
docker build \
--target docs \
--progress=plain \
--output html \
.
.PHONY: bash
bash: build ## Start a bash terminal in the image.
docker run -it $(TAG_LATEST) /bin/bash
.PHONY: publish-docker
publish-docker: build ## Publish Docker images.
docker push $(TAG_LATEST)
docker push $(TAG_VERSION)
docker push $(TAG_GIT_SHA)