Skip to content

Commit 58b456f

Browse files
authored
fix caching in magic-modules (#16594)
1 parent 542155d commit 58b456f

15 files changed

Lines changed: 74 additions & 58 deletions

.github/actions/build-downstream/action.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,13 @@ runs:
1717
fetch-depth: 0
1818

1919
- name: Set up Go
20-
uses: actions/setup-go@v4
20+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
2121
with:
22-
go-version: '^1.20'
22+
go-version: '^1.24'
23+
cache-dependency-path: |
24+
mmv1/go.mod
25+
tpgtools/go.mod
2326
24-
# Cache Go modules
25-
- name: Cache Go modules
26-
uses: actions/cache@v3
27-
with:
28-
path: ~/go/pkg/mod
29-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
30-
restore-keys: |
31-
${{ runner.os }}-go-
32-
33-
- run: go install golang.org/x/tools/cmd/goimports@latest
34-
shell: bash
3527
- name: Build ${{ inputs.repo }}
3628
shell: bash
3729
env:

.github/workflows/build-downstream.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,12 @@ jobs:
2222
fetch-depth: 0
2323

2424
- name: Set up Go
25-
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
25+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
2626
with:
2727
go-version: '^1.24'
28-
29-
# Cache Go modules
30-
- name: Cache Go modules
31-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
32-
with:
33-
path: ~/go/pkg/mod
34-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
35-
restore-keys: |
36-
${{ runner.os }}-go-
37-
38-
- run: go install golang.org/x/tools/cmd/goimports@7656c4c657688cae30795365d2a5f30d6f18be7f # v0.19.0
28+
cache-dependency-path: |
29+
mmv1/go.mod
30+
tpgtools/go.mod
3931
4032
- name: Build ${{ inputs.repo }}
4133
run: |
@@ -53,7 +45,7 @@ jobs:
5345
export OUTPUT_PATH=$GOPATH/src/github.com/$UPSTREAM_OWNER/$GH_REPO
5446
GITHUB_PATH=https://x-access-token:$GITHUB_TOKEN@github.com/$UPSTREAM_OWNER/$GH_REPO
5547
mkdir -p "$(dirname $OUTPUT_PATH)"
56-
git clone $GITHUB_PATH $OUTPUT_PATH --branch $BASE_BRANCH
48+
git clone --depth 1 $GITHUB_PATH $OUTPUT_PATH --branch $BASE_BRANCH
5749
}
5850
5951
GH_REPO="${INPUTS_REPO}"
@@ -86,7 +78,7 @@ jobs:
8678
exit 1
8779
fi
8880
89-
(current_dir=$(pwd) && cd $OUTPUT_PATH && zip -r "$current_dir/output.zip" .)
81+
(current_dir=$(pwd) && cd $OUTPUT_PATH && zip -r -q "$current_dir/output.zip" . -x "*.git/*")
9082
env:
9183
INPUTS_REPO: ${{ inputs.repo }}
9284

.github/workflows/changelog-checker.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ jobs:
1616
path: repo
1717

1818
- name: Set up Go
19-
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
19+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
2020
with:
21-
go-version: '^1.24.0'
21+
go-version: '^1.24'
22+
cache-dependency-path: |
23+
repo/tools/go-changelog/go.mod
2224
2325
- name: Build
2426
run: |

.github/workflows/ensure-service-team-labels.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ jobs:
2020
with:
2121
repository: GoogleCloudPlatform/magic-modules
2222
- name: Set up Go
23-
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
23+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
2424
with:
25-
go-version: '^1.24.0'
25+
go-version: '^1.24'
26+
cache-dependency-path: |
27+
tools/issue-labeler/go.mod
2628
- name: Build issue-labeler
2729
run: |
2830
cd tools/issue-labeler

.github/workflows/gofmt.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ jobs:
2424
git fetch origin ${GITHUB_BASE_REF} # Fetch the base branch
2525
git merge --no-ff origin/${GITHUB_BASE_REF} # Merge with the base branch
2626
- name: Set up Go
27-
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
27+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
2828
with:
29-
cache: false
3029
go-version: '^1.24'
3130
- name: gofmt
3231
run: |

.github/workflows/magician-commands.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ jobs:
3030

3131
- name: Set up Go
3232
if: steps.read-comment.outputs.match != ''
33-
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
33+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
3434
with:
35-
go-version: '^1.21'
35+
go-version: '^1.24'
36+
cache-dependency-path: |
37+
.ci/magician/go.mod
38+
3639
3740
- name: Build magician
3841
if: steps.read-comment.outputs.match != ''

.github/workflows/request-reviewer.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ jobs:
2727
with:
2828
ref: main
2929
- name: Set up Go
30-
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
30+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
3131
with:
3232
go-version: '^1.24'
33-
# Disable caching for now due to issues with large provider dependency caches
34-
cache: false
33+
cache-dependency-path: |
34+
.ci/magician/go.mod
3535
- name: Build magician
3636
run: |
3737
cd .ci/magician

.github/workflows/scheduled-pr-reminders.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ jobs:
1818
- name: Checkout Repository
1919
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
2020
- name: Set up Go
21-
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
21+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
2222
with:
2323
go-version: '^1.24'
24-
# Disable caching for now due to issues with large provider dependency caches
25-
cache: false
24+
cache-dependency-path: |
25+
.ci/magician/go.mod
2626
- name: Build magician
2727
run: |
2828
cd .ci/magician

.github/workflows/test-tgc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
fi
8080
- name: Set up Go
8181
if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }}
82-
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
82+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
8383
with:
8484
go-version: '^1.24'
8585
- name: Build Terraform Google Conversion

.github/workflows/test-tpg.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
fi
7676
- name: Set up Go
7777
if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }}
78-
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
78+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
7979
with:
8080
go-version: '^1.24'
8181
- name: Build Provider

0 commit comments

Comments
 (0)