-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
97 lines (80 loc) · 2.21 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
# Set default shell to bash
SHELL := /bin/bash -o pipefail -o errexit -o nounset
addlicense=go run github.com/google/addlicense@v1.0.0 \
-ignore '**/*.yml' \
-ignore 'node_modules/**' -ignore 'testFixture/**' \
-ignore '.vscode-test/**'
terramate_ls_version=latest
terramate_ls_url=github.com/terramate-io/terramate/cmd/...@$(terramate_ls_version)
.PHONY: default
default: help
## install deps
.PHONY: deps
deps:
npm install
GOBIN=$(shell pwd)/bin go install -v "$(terramate_ls_url)"
## build code
.PHONY: build
build: deps
npm run compile
## lint code
.PHONY: lint
lint: deps
npm run lint
## test extension
.PHONY: test
test: VERSION?=stable
test: build
sh ./scripts/e2e.sh $(VERSION)
## test extension on vscode minimal supported version.
.PHONY: test-min-version
test-min-version: build
sh ./scripts/e2e.sh
## package the extension
.PHONY: package
package:
vsce package
## publish the extension in the official marketplace
.PHONY: publish-official
publish-official: check-vscode-access-token
npx vsce publish -p $(VSCODE_ACCESS_TOKEN)
## publish the extension in the community marketplace
.PHONY: publish-community
publish-community: check-open-vsx-access-token
npx ovsx publish -p $(OPEN_VSX_ACCESS_TOKEN)
.PHONY: check-vscode-access-token
check-vscode-access-token:
ifndef VSCODE_ACCESS_TOKEN
$(error VSCODE_ACCESS_TOKEN environment variable is not set)
endif
.PHONY: check-open-vsx-access-token
check-open-vsx-access-token:
ifndef OPEN_VSX_ACCESS_TOKEN
$(error OPEN_VSX_ACCESS_TOKEN environment variable is not set)
endif
## add license to code
.PHONY: license
license:
$(addlicense) -c "Terramate GmbH" .
## check if code is licensed properly
.PHONY: license/check
license/check:
$(addlicense) --check . 2>/dev/null
## creates a new release tag
.PHONY: release/tag
release/tag: VERSION?=v$(shell npm pkg get version | tr -d '"')
release/tag:
git tag -a $(VERSION) -m "Release $(VERSION)"
git push origin $(VERSION)
## Display help for all targets
.PHONY: help
help:
@awk '/^.PHONY: / { \
msg = match(lastLine, /^## /); \
if (msg) { \
cmd = substr($$0, 9, 100); \
msg = substr(lastLine, 4, 1000); \
printf " ${GREEN}%-30s${RESET} %s\n", cmd, msg; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)