From fafa925b267b6ae21a5c5240e9f1371668d27962 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Thu, 30 Jul 2026 12:37:04 +0800 Subject: [PATCH] perf(ci): speed up App workflow Go dependency caching Use setup-go v6 default go.mod cache key instead of go.sum, warm the module cache with an explicit go mod download step, and scope vet to the same package set as tests. --- .github/workflows/app.yml | 18 ++++++++++++------ .github/workflows/docreader.yml | 6 +++++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index 56fe362f..1e104800 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -39,6 +39,7 @@ permissions: env: GO_VERSION: "1.26" + GOPROXY: https://proxy.golang.org,direct # Keep tests independent of a developer machine's custom log template. LOG_FORMAT: "" BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} @@ -56,7 +57,11 @@ jobs: - uses: actions/setup-go@v6 with: go-version: ${{ env.GO_VERSION }} - cache-dependency-path: go.sum + cache: true + # v6 defaults to go.mod for the cache key (more stable than go.sum). + + - name: Download modules + run: go mod download - name: Check formatting shell: bash @@ -75,11 +80,12 @@ jobs: exit 1 fi - - name: Vet - run: go vet ./... - - - name: Test - run: go test $(go list ./... | grep -v '/docreader/') + - name: Vet and test + shell: bash + run: | + mapfile -t pkgs < <(go list ./... | grep -v '/docreader/') + go vet "${pkgs[@]}" + go test "${pkgs[@]}" - name: Build server run: go build ./cmd/server diff --git a/.github/workflows/docreader.yml b/.github/workflows/docreader.yml index 4fb92cce..93ece72b 100644 --- a/.github/workflows/docreader.yml +++ b/.github/workflows/docreader.yml @@ -34,6 +34,7 @@ permissions: env: PYTHON_VERSION: "3.10.18" GO_VERSION: "1.26" + GOPROXY: https://proxy.golang.org,direct jobs: verify: @@ -65,7 +66,10 @@ jobs: - uses: actions/setup-go@v6 with: go-version: ${{ env.GO_VERSION }} - cache-dependency-path: go.sum + cache: true + + - name: Download Go modules + run: go mod download - name: Start DocReader gRPC server run: |