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.
main
wizardchen 2026-07-30 12:37:04 +08:00 committed by lyingbug
parent 4efc987abb
commit fafa925b26
2 changed files with 17 additions and 7 deletions

View File

@ -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

View File

@ -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: |