-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MM-36] Update plugin with respect to phase 1 upgrades (#727)
* Make use of github.com/mattermost/mattermost/server/public * [MM-36] Update plugin with respect to phase 1 upgrades * [MM-36] Update makefile command for testcases * Sync with playbooks: install-go-tools, gotestsum, and dynamic versions (#192) * Revert "Update main.go (#154)" This reverts commit be4a281d0cc791d10e6e5ae917b325b2f054e475. * Revert "[MM-33506] Use embed package to include plugin manifest (#145)" This reverts commit ca9ee3c17c6920a636a33f378e17395afd6f329f. * Revert "Don't generate manifest.ts (#127)" This reverts commit 18d30b50bc7ba800c9f05bfd82970781db0aea3e. * install-go-tools target, adopt gotestsum * bring back make apply + automatic versioning * Update build/manifest/main.go Co-authored-by: Michael Kochell <[email protected]> * suppress git describe error when no tags match * make version/release notes opt-in * fix whitespace in Makefile * document version management options --------- Co-authored-by: Michael Kochell <[email protected]> * Fetch plugin logs from server (#193) Co-authored-by: Jesse Hallam <[email protected]> * [MM-36] Update plugin.json file --------- Co-authored-by: Ben Schumacher <[email protected]> Co-authored-by: Mattermost Build <[email protected]> Co-authored-by: Jesse Hallam <[email protected]> Co-authored-by: Michael Kochell <[email protected]>
- Loading branch information
1 parent
44f9c83
commit 475c110
Showing
33 changed files
with
22,507 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
14.21.1 | ||
16.13.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ GO ?= $(shell command -v go 2> /dev/null) | |
NPM ?= $(shell command -v npm 2> /dev/null) | ||
CURL ?= $(shell command -v curl 2> /dev/null) | ||
MM_DEBUG ?= | ||
MANIFEST_FILE ?= plugin.json | ||
GOPATH ?= $(shell go env GOPATH) | ||
GO_TEST_FLAGS ?= -race | ||
GO_BUILD_FLAGS ?= | ||
|
@@ -13,6 +12,10 @@ DEFAULT_GOARCH := $(shell go env GOARCH) | |
|
||
export GO111MODULE=on | ||
|
||
# We need to export GOBIN to allow it to be set | ||
# for processes spawned from the Makefile | ||
export GOBIN ?= $(PWD)/bin | ||
|
||
# You can include assets this directory into the bundle. This can be e.g. used to include profile pictures. | ||
ASSETS_DIR ?= assets | ||
|
||
|
@@ -22,7 +25,6 @@ default: all | |
|
||
# Verify environment, and define PLUGIN_ID, PLUGIN_VERSION, HAS_SERVER and HAS_WEBAPP as needed. | ||
include build/setup.mk | ||
include build/legacy.mk | ||
|
||
BUNDLE_NAME ?= $(PLUGIN_ID)-$(PLUGIN_VERSION).tar.gz | ||
|
||
|
@@ -41,24 +43,34 @@ endif | |
.PHONY: all | ||
all: check-style test dist | ||
|
||
## Propagates plugin manifest information into the server/ and webapp/ folders. | ||
.PHONY: apply | ||
apply: | ||
./build/bin/manifest apply | ||
|
||
## Install go tools | ||
install-go-tools: | ||
@echo Installing go tools | ||
$(GO) install github.com/golangci/golangci-lint/cmd/[email protected] | ||
$(GO) install gotest.tools/[email protected] | ||
|
||
## Runs eslint and golangci-lint | ||
.PHONY: check-style | ||
check-style: webapp/node_modules | ||
check-style: apply webapp/node_modules install-go-tools | ||
@echo Checking for style guide compliance | ||
|
||
ifneq ($(HAS_WEBAPP),) | ||
cd webapp && npm run lint | ||
cd webapp && npm run check-types | ||
endif | ||
|
||
# It's highly recommended to run go-vet first | ||
# to find potential compile errors that could introduce | ||
# weird reports at golangci-lint step | ||
ifneq ($(HAS_SERVER),) | ||
@if ! [ -x "$$(command -v golangci-lint)" ]; then \ | ||
echo "golangci-lint is not installed. Please see https://github.com/golangci/golangci-lint#install for installation instructions."; \ | ||
exit 1; \ | ||
fi; \ | ||
@echo Running golangci-lint | ||
golangci-lint run ./... | ||
$(GO) vet ./... | ||
$(GOBIN)/golangci-lint run ./... | ||
endif | ||
|
||
## Builds the server, if it exists, for all supported architectures, unless MM_SERVICESETTINGS_ENABLEDEVELOPER is set | ||
|
@@ -104,7 +116,7 @@ endif | |
bundle: | ||
rm -rf dist/ | ||
mkdir -p dist/$(PLUGIN_ID) | ||
cp $(MANIFEST_FILE) dist/$(PLUGIN_ID)/ | ||
./build/bin/manifest dist | ||
ifneq ($(wildcard $(ASSETS_DIR)/.),) | ||
cp -r $(ASSETS_DIR) dist/$(PLUGIN_ID)/ | ||
endif | ||
|
@@ -125,7 +137,7 @@ endif | |
|
||
## Builds and bundles the plugin. | ||
.PHONY: dist | ||
dist: server webapp bundle | ||
dist: apply server webapp bundle | ||
|
||
## Builds and installs the plugin to a server. | ||
.PHONY: deploy | ||
|
@@ -134,7 +146,7 @@ deploy: dist | |
|
||
## Builds and installs the plugin to a server, updating the webapp automatically when changed. | ||
.PHONY: watch | ||
watch: server bundle | ||
watch: apply server bundle | ||
ifeq ($(MM_DEBUG),) | ||
cd webapp && $(NPM) run build:watch | ||
else | ||
|
@@ -188,20 +200,28 @@ detach: setup-attach | |
|
||
## Runs any lints and unit tests defined for the server and webapp, if they exist. | ||
.PHONY: test | ||
test: webapp/node_modules | ||
test: apply webapp/node_modules install-go-tools | ||
ifneq ($(HAS_SERVER),) | ||
$(GO) test -v $(GO_TEST_FLAGS) ./server/... | ||
$(GOBIN)/gotestsum -- -v ./... | ||
endif | ||
ifneq ($(HAS_WEBAPP),) | ||
cd webapp && $(NPM) run test; | ||
endif | ||
ifneq ($(wildcard ./build/sync/plan/.),) | ||
cd ./build/sync && $(GO) test -v $(GO_TEST_FLAGS) ./... | ||
|
||
## Runs any lints and unit tests defined for the server and webapp, if they exist, optimized | ||
## for a CI environment. | ||
.PHONY: test-ci | ||
test-ci: apply webapp/node_modules install-go-tools | ||
ifneq ($(HAS_SERVER),) | ||
$(GOBIN)/gotestsum --format standard-verbose --junitfile report.xml -- ./... | ||
endif | ||
ifneq ($(HAS_WEBAPP),) | ||
cd webapp && $(NPM) run test; | ||
endif | ||
|
||
## Creates a coverage report for the server code. | ||
.PHONY: coverage | ||
coverage: webapp/node_modules | ||
coverage: apply webapp/node_modules | ||
ifneq ($(HAS_SERVER),) | ||
$(GO) test $(GO_TEST_FLAGS) -coverprofile=server/coverage.txt ./... | ||
$(GO) tool cover -html=server/coverage.txt | ||
|
@@ -258,14 +278,13 @@ ifneq ($(HAS_WEBAPP),) | |
endif | ||
rm -fr build/bin/ | ||
|
||
## Sync directory with a starter template | ||
sync: | ||
ifndef STARTERTEMPLATE_PATH | ||
@echo STARTERTEMPLATE_PATH is not set. | ||
@echo Set STARTERTEMPLATE_PATH to a local clone of https://github.com/mattermost/mattermost-plugin-starter-template and retry. | ||
@exit 1 | ||
endif | ||
cd ${STARTERTEMPLATE_PATH} && go run ./build/sync/main.go ./build/sync/plan.yml $(PWD) | ||
.PHONY: logs | ||
logs: | ||
./build/bin/pluginctl logs $(PLUGIN_ID) | ||
|
||
.PHONY: logs-watch | ||
logs-watch: | ||
./build/bin/pluginctl logs-watch $(PLUGIN_ID) | ||
|
||
# Help documentation à la https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html | ||
help: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.