diff --git a/.github/workflows/server-ci-template.yml b/.github/workflows/server-ci-template.yml index 77a017439d..1ddb8f9ccb 100644 --- a/.github/workflows/server-ci-template.yml +++ b/.github/workflows/server-ci-template.yml @@ -51,6 +51,27 @@ jobs: run: make modules-tidy - name: Check modules run: if [[ -n $(git status --porcelain) ]]; then echo "Please tidy up the Go modules using make modules-tidy"; git diff; exit 1; fi + golangci: + name: golangci-lint + runs-on: ubuntu-22.04 + defaults: + run: + working-directory: server + steps: + - name: Checkout mattermost-server + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + - name: Setup Go + uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 + with: + go-version: ${{ env.go-version }} + cache-dependency-path: | + server/go.sum + server/public/go.sum + - name: Setup go.work + run: make setup-go-work + - name: Run golangci + run: make golangci-lint + check-gen-serialized: name: Check serialization methods for hot structs runs-on: ubuntu-22.04 diff --git a/server/.golangci.yml b/server/.golangci.yml index 8c1d0ce2aa..96672a2550 100644 --- a/server/.golangci.yml +++ b/server/.golangci.yml @@ -1,5 +1,5 @@ run: - timeout: 5m + timeout: 10m skip-dirs: - channels/store/storetest/mocks diff --git a/server/Makefile b/server/Makefile index b477ee8855..a413efd2c6 100644 --- a/server/Makefile +++ b/server/Makefile @@ -294,11 +294,11 @@ else endif golangci-lint: ## Run golangci-lint on codebase - @# Keep the version in sync with the command in .circleci/config.yml $(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2 @echo Running golangci-lint $(GOBIN)/golangci-lint run ./... + $(GOBIN)/golangci-lint run ./public/... ifeq ($(BUILD_ENTERPRISE_READY),true) ifneq ($(MM_NO_ENTERPRISE_LINT),true) $(GOBIN)/golangci-lint run $(BUILD_ENTERPRISE_DIR)/... @@ -415,7 +415,7 @@ ifeq ($(BUILD_ENTERPRISE_READY),true) endif endif -check-style: golangci-lint plugin-checker vet ## Runs style/lint checks +check-style: plugin-checker vet golangci-lint ## Runs style/lint checks do-cover-file: ## Creates the test coverage report file.