diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..eb97dd6 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,30 @@ +version: 2.1 +jobs: + lint: + docker: + - image: circleci/golang:1.12-node + + working_directory: /go/src/github.com/mattermost/mattermost-plugin-custom-attributes + steps: + - checkout + + - run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + - run: make check-style + + test: + docker: + - image: circleci/golang:1.12-node + + working_directory: /go/src/github.com/mattermost/mattermost-plugin-custom-attributes + steps: + - checkout + + - run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + - run: make test + +workflows: + version: 2 + untagged-build: + jobs: + - lint + - test diff --git a/Makefile b/Makefile index 03b0ca9..82b1bce 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,9 @@ endif govet: ifneq ($(HAS_SERVER),) @echo Running govet - @$(GO) vet -shadow $$(go list ./server/...) || exit 1 + $(GO) get -u golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow + $(GO) vet $(GOFLAGS) $$(go list ./server/...) || exit 1 + $(GO) vet -vettool=$(which shadow) $$(go list ./server/...) || exit 1 @echo Govet success endif diff --git a/README.md b/README.md index a4fb045..e546e5d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Mattermost Custom Attributes Plugin +# Mattermost Custom Attributes Plugin [![CircleCI](https://circleci.com/gh/mattermost/mattermost-plugin-custom-attributes.svg?style=svg)](https://circleci.com/gh/mattermost/mattermost-plugin-custom-attributes) This plugin allows you to add custom attributes to users in your Mattermost. Currently it only exposes those attributes in the profile popover of users but in the future the plan is to extend the plugin to allow adding badges next to usernames based on attributes and potentially display the attributes in other places. diff --git a/server/plugin_test.go b/server/plugin_test.go deleted file mode 100644 index 8bca1a6..0000000 --- a/server/plugin_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package main - -import ( - "io/ioutil" - "net/http/httptest" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestServeHTTP(t *testing.T) { - assert := assert.New(t) - plugin := Plugin{} - w := httptest.NewRecorder() - r := httptest.NewRequest("GET", "/", nil) - - plugin.ServeHTTP(nil, w, r) - - result := w.Result() - assert.NotNil(result) - bodyBytes, err := ioutil.ReadAll(result.Body) - assert.Nil(err) - bodyString := string(bodyBytes) - - assert.Equal("Hello, world!", bodyString) -}