mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 12:51:55 +00:00
ci: cache golangci-lint cache across builds (#46043)
This commit is contained in:
parent
373b795ee2
commit
6ee33f77f8
3
.gitignore
vendored
3
.gitignore
vendored
@ -171,6 +171,9 @@ annotations/
|
||||
# Buildkite analytics files
|
||||
test-reports/
|
||||
|
||||
# CI linter cache (used only in CI)
|
||||
.golangci-lint-cache
|
||||
|
||||
# go workspace files shouldn't be committed
|
||||
go.work
|
||||
go.work.sum
|
||||
|
||||
@ -14,6 +14,7 @@ import (
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/dev/ci/runtype"
|
||||
"github.com/sourcegraph/sourcegraph/enterprise/dev/ci/images"
|
||||
"github.com/sourcegraph/sourcegraph/enterprise/dev/ci/internal/buildkite"
|
||||
bk "github.com/sourcegraph/sourcegraph/enterprise/dev/ci/internal/buildkite"
|
||||
"github.com/sourcegraph/sourcegraph/enterprise/dev/ci/internal/ci/changed"
|
||||
"github.com/sourcegraph/sourcegraph/enterprise/dev/ci/internal/ci/operations"
|
||||
@ -128,8 +129,17 @@ func addSgLints(targets []string) func(pipeline *bk.Pipeline) {
|
||||
cmd = cmd + "lint -annotations -fail-fast=false " + formatCheck + strings.Join(targets, " ")
|
||||
|
||||
return func(pipeline *bk.Pipeline) {
|
||||
lintCachePath := "/root/buildkite/build/sourcegraph/.golangci-lint-cache"
|
||||
pipeline.AddStep(":pineapple::lint-roller: Run sg lint",
|
||||
withYarnCache(),
|
||||
bk.Env("GOLANGCI_LINT_CACHE", lintCachePath),
|
||||
buildkite.Cache(&bk.CacheOptions{
|
||||
ID: "golangci-lint",
|
||||
Key: "golangci-lint-{{ git.branch }}",
|
||||
RestoreKeys: []string{"golangci-lint-{{ git.branch }}", "golangci-lint-main"},
|
||||
Paths: []string{".golangci-lint-cache"},
|
||||
Compress: true,
|
||||
}),
|
||||
bk.AnnotatedCmd(cmd, bk.AnnotatedCmdOpts{
|
||||
Annotations: &bk.AnnotationOpts{
|
||||
IncludeNames: true,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user