Adding mattermost-govet to the pipeline (#13257)
* Adding mattermost-govet to the pipeline * Trying to fix circleCI config * Trying to fix circleCI config * Trying to fix circleCI config * Trying to fix circleCI config * Update Makefile Co-Authored-By: Ben Schumacher <ben.schumacher@mattermost.com> * Update Makefile Co-Authored-By: Ben Schumacher <ben.schumacher@mattermost.com> * Addressing PR review comments * Addressing PR review comments * Addressing PR review comments * Addressing PR review comments * Addressing PR review comments * Addressing PR review comments * Adding legacy check-licenses task to legacy.mk * Removing unnecesary GO111MODULE=off lines * Adding jenkins mattermost-govet installation
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
876cf82bad
Коммит
f55a81163e
@@ -65,6 +65,8 @@ jobs:
|
||||
command: |
|
||||
echo "Installing golangci-lint"
|
||||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b /usr/local/bin v1.21.0 # Keep this in sync with .golangci.yml and Jenkinsfile.pr
|
||||
echo "Installing mattermost-govet"
|
||||
GO111MODULE=off go get -u github.com/mattermost/mattermost-govet
|
||||
cd mattermost-server
|
||||
make config-reset
|
||||
make check-style BUILD_NUMBER='${CIRCLE_BRANCH}-${CIRCLE_BUILD_NUM}'
|
||||
|
||||
15
Makefile
15
Makefile
@@ -196,13 +196,10 @@ einterfaces-mocks: ## Creates mock files for einterfaces.
|
||||
pluginapi: ## Generates api and hooks glue code for plugins
|
||||
$(GO) generate $(GOFLAGS) ./plugin
|
||||
|
||||
check-licenses: ## Checks license status.
|
||||
./scripts/license-check.sh $(TE_PACKAGES) $(EE_PACKAGES)
|
||||
|
||||
check-prereqs: ## Checks prerequisite software status.
|
||||
./scripts/prereq-check.sh
|
||||
|
||||
check-style: golangci-lint plugin-checker check-licenses ## Runs golangci against all packages
|
||||
check-style: golangci-lint plugin-checker vet ## Runs golangci against all packages
|
||||
|
||||
test-te-race: ## Checks for race conditions in the team edition.
|
||||
@echo Testing TE race conditions
|
||||
@@ -451,6 +448,16 @@ update-dependencies: ## Uses go get -u to update all the dependencies while hold
|
||||
# Copy everything to vendor directory
|
||||
$(GO) mod vendor
|
||||
|
||||
vet: ## Run mattermost go vet specific checks
|
||||
@if ! [ -x "$$(command -v mattermost-govet)" ]; then \
|
||||
echo "mattermost-govet is not installed. Please install it executing \"GO111MODULE=off go get -u github.com/mattermost/mattermost-govet\""; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
|
||||
$(GO) vet -vettool=$(GOPATH)/bin/mattermost-govet -license ./...
|
||||
ifeq ($(BUILD_ENTERPRISE_READY),true)
|
||||
$(GO) vet -vettool=$(GOPATH)/bin/mattermost-govet -enterpriseLicense ./enterprise/...
|
||||
endif
|
||||
|
||||
todo: ## Display TODO and FIXME items in the source code.
|
||||
@! ag --ignore Makefile --ignore-dir vendor --ignore-dir runtime TODO
|
||||
|
||||
@@ -102,6 +102,8 @@ pipeline {
|
||||
cd /go/src/github.com/mattermost/mattermost-server
|
||||
echo "Installing golangci-lint"
|
||||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b /usr/local/bin v1.21.0 # Keep this in sync with .golangci.yml and .circleci/config.yml
|
||||
echo "Installing mattermost-govet"
|
||||
GO111MODULE=off go get -u github.com/mattermost/mattermost-govet
|
||||
make config-reset
|
||||
make check-style BUILD_NUMBER='${BRANCH_NAME}-${BUILD_NUMBER}'
|
||||
make build BUILD_NUMBER='${BRANCH_NAME}-${BUILD_NUMBER}'
|
||||
|
||||
@@ -4,6 +4,9 @@ test-te: test-server
|
||||
# test-ee used to just run the enterprise edition tests, but now runs whatever is available
|
||||
test-ee: test-server
|
||||
|
||||
# check-licenses was used to check the license of the files, but now is done through mattermost-govet
|
||||
check-licenses: vet
|
||||
|
||||
# clean old docker images
|
||||
clean-old-docker:
|
||||
@echo Removing docker containers
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
IFS=$'\n'
|
||||
count=0
|
||||
for fileType in GoFiles; do
|
||||
for file in `go list -mod=vendor -f $'{{range .GoFiles}}{{$.Dir}}/{{.}}\n{{end}}' "$@"`; do
|
||||
case $file in
|
||||
*/utils/lru.go|*/utils/imgutils/gif.go|*/store/storetest/mocks/*|*/services/*/mocks/*|*/app/plugin/jira/plugin_*|*/plugin/plugintest/*|*/app/plugin/zoom/plugin_*|*/einterfaces/mocks/*)
|
||||
# Third-party, doesn't require a header.
|
||||
;;
|
||||
*)
|
||||
if ! grep 'Mattermost, Inc. All Rights Reserved.' $file -q; then
|
||||
>&2 echo "FAIL: $file is missing a license header."
|
||||
((count++))
|
||||
fi
|
||||
esac
|
||||
done
|
||||
done
|
||||
if [ $count -eq 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $count -gt 1 ]; then
|
||||
>&2 echo "$count files are missing license headers."
|
||||
else
|
||||
>&2 echo "$count file is missing a license header."
|
||||
fi
|
||||
exit 1
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package localcachelayer
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package localcachelayer
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user