File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Tests
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+ workflow_dispatch :
9+
10+ jobs :
11+ test :
12+ name : Run Tests
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : Checkout code
16+ uses : actions/checkout@v4
17+ - name : Set up Go
18+ uses : actions/setup-go@v5
19+ with :
20+ go-version : ' 1.25'
21+ # Use our own cache, obviously.
22+ cache : false
23+ - name : Install gobuildcache
24+ run : go install github.com/richardartoul/gobuildcache@latest
25+ - name : Authenticate to Google Cloud
26+ uses : google-github-actions/auth@v2
27+ with :
28+ credentials_json : ${{ secrets.GCP_SA_KEY }}
29+ - name : Run short tests
30+ env :
31+ GOBUILDCACHE_BACKEND_TYPE : gcs
32+ GOBUILDCACHE_GCS_BUCKET : ${{ secrets.GCS_BUCKET }}
33+ GOBUILDCACHE_GCS_PREFIX : go-build-cache/${{ github.repository }}
34+ GOCACHEPROG : gobuildcache
35+ run : go test ./...
Original file line number Diff line number Diff line change @@ -28,9 +28,10 @@ type GCS struct {
2828func NewGCS (bucket , prefix string ) (* GCS , error ) {
2929 ctx := context .Background ()
3030
31- // Create GCS client using Application Default Credentials
32- // This will use GOOGLE_APPLICATION_CREDENTIALS env var or metadata service
33- client , err := storage .NewClient (ctx )
31+ // Create GCS client using Application Default Credentials.
32+ // WithJSONReads forces the JSON API for downloads (default is XML).
33+ // This is required for GCS Anywhere Cache compatibility.
34+ client , err := storage .NewClient (ctx , storage .WithJSONReads ())
3435 if err != nil {
3536 return nil , fmt .Errorf ("failed to create GCS client: %w" , err )
3637 }
You can’t perform that action at this time.
0 commit comments