This repository has been archived by the owner on Dec 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
88 lines (69 loc) · 2.16 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
COMPOSE_USER=$(shell id -u):$(shell id -g)
DOCKER_COMPOSE_CHECK := docker compose run --rm --user=$(COMPOSE_USER)
PANTS_SHELL_FILTER := ./pants --filter-target-type=shell_source,shunit2_test
.DEFAULT_GOAL=all
.PHONY: all
all: format
all: lint
all: test
all: image
all: ## Run (almost!) everything
.PHONY: help
help: ## Print this help
@awk 'BEGIN {FS = ":.*##"; printf "Usage: make <target>\n"} \
/^[a-zA-Z0-9_-]+:.*?##/ { printf " %-46s %s\n", $$1, $$2 } \
/^##@/ { printf "\n%s\n", substr($$0, 5) } ' \
$(MAKEFILE_LIST)
@printf '\n'
##@ Linting
########################################################################
.PHONY: lint
lint: lint-docker
lint: lint-hcl
lint: lint-plugin
lint: lint-shell
lint: ## Perform lint checks on all files
.PHONY: lint-docker
lint-docker: ## Lint Dockerfiles
./pants --filter-target-type=docker_image lint ::
.PHONY: lint-hcl
lint-hcl: ## Lint HCL files
$(DOCKER_COMPOSE_CHECK) hcl-linter
.PHONY: lint-plugin
lint-plugin: ## Lint the Buildkite plugin metadata
$(DOCKER_COMPOSE_CHECK) plugin-linter
.PHONY: lint-shell
lint-shell: ## Lint shell scripts
$(PANTS_SHELL_FILTER) lint ::
##@ Formatting
########################################################################
.PHONY: format
format: format-hcl
format: format-shell
format: ## Automatically format all code
.PHONY: format-hcl
format-hcl: ## Format HCL files
$(DOCKER_COMPOSE_CHECK) hcl-formatter
.PHONY: format-shell
format-shell: ## Format shell scripts
$(PANTS_SHELL_FILTER) fmt ::
##@ Testing
########################################################################
.PHONY: test
test: test-plugin
test: test-shell
test: ## Run all tests
.PHONY: test-plugin
test-plugin: ## Test the Buildkite plugin locally (does *not* run a Buildkite pipeline)
$(DOCKER_COMPOSE_CHECK) plugin-tester
.PHONY: test-shell
test-shell: ## Unit test shell scripts
$(PANTS_SHELL_FILTER) test ::
##@ Container Images
########################################################################
.PHONY: image
image: ## Build the Cloudsmith container image
docker buildx bake
.PHONY: image-push
image-push: ## Build *and* push the Cloudsmith container image to a repository
docker buildx bake --push