forked from miZyind/mattermost-plugin-sentry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
36 lines (30 loc) · 1.05 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
# Ensure that the build tools are compiled. Go's caching makes this quick.
$(shell cd build/manifest && go build -o ../bin/manifest)
BUILD_TOOLS_DIR ?= build/bin
BUNDLE_DIR ?= build/dist
PLUGIN_ENTRYPOINT ?= $(shell build/bin/manifest entrypoint)
## Checks the code style, tests, builds and bundles the plugin.
all: prepare build bundle clean
## Runs any lints and unit tests defined for the server.
.PHONY: prepare
prepare:
find . -name ".DS_Store" -depth -exec rm {} \;
golangci-lint run
go test -v -race ./server/...
## Propagates plugin manifest information into the server folder and builds the server.
.PHONY: build
build:
mkdir $(BUNDLE_DIR)
$(BUILD_TOOLS_DIR)/manifest apply
cd server && env GOOS=linux GOARCH=amd64 go build -o ../$(BUNDLE_DIR)/$(PLUGIN_ENTRYPOINT)
## Generates a tar bundle of the plugin for install.
.PHONY: bundle
bundle:
cp plugin.json $(BUNDLE_DIR)/
cp -r assets $(BUNDLE_DIR)/
tar -cvzf plugin.tar.gz -C $(BUNDLE_DIR) .
## Clean removes all build artifacts.
.PHONY: clean
clean:
rm -rf $(BUILD_TOOLS_DIR)
rm -rf $(BUNDLE_DIR)