From fcf238523f5777172464bead034997169253f9e6 Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Fri, 6 Oct 2023 19:13:06 +0530 Subject: [PATCH] Optimize mmctl CI run (#24732) * Optimize mmctl CI run - Remove coverage mode. They increase run time by 3x. - Remove -race mode in PR builds. They increase run time by 2x and memory consumption as well. ```release-note NONE ``` * caching go.sum path ```release-note NONE ``` --- .github/workflows/mmctl-test-template.yml | 6 +++++- server/Makefile | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mmctl-test-template.yml b/.github/workflows/mmctl-test-template.yml index 775ada29753..d93d8e514e7 100644 --- a/.github/workflows/mmctl-test-template.yml +++ b/.github/workflows/mmctl-test-template.yml @@ -30,6 +30,7 @@ jobs: uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 with: go-version: ${{ env.go-version }} + cache-dependency-path: server/go.sum - name: Run setup-go-work run: | cd server @@ -47,6 +48,9 @@ jobs: docker-compose --ansi never ps - name: Run mmctl Tests run: | + if [[ ${{ github.ref_name }} == 'master' ]]; then + export MMCTL_TESTFLAGS="-timeout 30m -race" + fi docker run --net ghactions_mm-test \ --ulimit nofile=8096:8096 \ --env-file=server/build/dotenv/test.env \ @@ -56,7 +60,7 @@ jobs: -v $PWD:/mattermost \ -w /mattermost/server \ $BUILD_IMAGE \ - make test-mmctl-coverage BUILD_NUMBER=$GITHUB_HEAD_REF-$GITHUB_RUN_ID + make test-mmctl BUILD_NUMBER=$GITHUB_HEAD_REF-$GITHUB_RUN_ID - name: Stop docker compose run: | cd server/build diff --git a/server/Makefile b/server/Makefile index df4759e7bda..8e34ed47fe6 100644 --- a/server/Makefile +++ b/server/Makefile @@ -64,7 +64,7 @@ GOTESTSUM_JSONFILE ?= gotestsum.json # mmctl MMCTL_BUILD_TAGS = -MMCTL_TESTFLAGS = -timeout 30m -race +MMCTL_TESTFLAGS ?= -timeout 30m MMCTL_PKG = github.com/mattermost/mattermost/server/v8/cmd/mmctl/commands LDFLAGS += -X "$(MMCTL_PKG).gitCommit=$(BUILD_HASH)" LDFLAGS += -X "$(MMCTL_PKG).gitTreeState=$(GIT_TREESTATE)"