Skip to content

Commit

Permalink
Set cache option on setup-go action in workflows (radius-project#8280)
Browse files Browse the repository at this point in the history
# Description

This PR sets the `cache: true` option on the `setup-go` actions in the
workflows. Previously we used a common caching technique to cache the go
install and modules folders, but this feature is now built into the
[`setup-go`
action](https://github.com/actions/setup-go/blob/main/docs/adrs/0000-caching-dependencies.md).
This change was tested with PR radius-project#8276. Following that, this PR updates
the remaining workflows to use the new caching feature.

The default value for the `cache` option is `true` on the `setup-go@v5`
action. This PR explicitly sets the value to `true` on the action where
it is not specified so that the option will be obvious, even though it
will not change the behavior of the action for cases when the option was
not set.

- `build.yaml`: Explicitly set cache option to true, which is the same
as the default value.
- `functional-test-cloud.yaml`: Changed the cache option from false to
true and removed the original caching actions.
- `lint.yaml`: Explicitly set cache option to true, which is the same as
the default value.
- `long-running-azure.yaml`: Explicitly set cache option to true, which
is the same as the default value.
- `publish-docs.yaml`: Explicitly set cache option to true, which is the
same as the default value.

> NOTE: This PR is created from a branch in this repo instead of a fork
from an external repo to allow us to run the cloud test workflows.

## Type of change

- This pull request adds or changes features of Radius and has an
approved issue (issue link required).

Related to issue: radius-project#8274
Related to PR radius-project#8276

## Contributor checklist
Please verify that the PR meets the following requirements, where
applicable:

- [ ] An overview of proposed schema changes is included in a linked
GitHub issue.
- [ ] A design document PR is created in the [design-notes
repository](https://github.com/radius-project/design-notes/), if new
APIs are being introduced.
- [ ] If applicable, design document has been reviewed and approved by
Radius maintainers/approvers.
- [ ] A PR for the [samples
repository](https://github.com/radius-project/samples) is created, if
existing samples are affected by the changes in this PR.
- [ ] A PR for the [documentation
repository](https://github.com/radius-project/docs) is created, if the
changes in this PR affect the documentation or any user facing updates
are made.
- [ ] A PR for the [recipes
repository](https://github.com/radius-project/recipes) is created, if
existing recipes are affected by the changes in this PR.

---------

Signed-off-by: Brooke Hamilton <[email protected]>
  • Loading branch information
brooke-hamilton authored Feb 25, 2025
1 parent 0c818cc commit bbb1d24
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 54 deletions.
38 changes: 0 additions & 38 deletions .github/actions/setup-rad-cli/action.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ jobs:
with:
go-version: ${{ env.GOVER }}
cache-dependency-path: go.sum
cache: true
- name: Parse release version and set environment variables
run: python ./.github/scripts/get_release_version.py
- name: Make build
Expand Down Expand Up @@ -179,6 +180,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOVER }}
cache: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
Expand Down Expand Up @@ -271,6 +273,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOVER }}
cache: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down
18 changes: 2 additions & 16 deletions .github/workflows/functional-test-cloud.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOVER }}
cache: true

- name: Generate ID for release
id: gen-id
Expand Down Expand Up @@ -493,22 +494,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOVER }}
cache: false

- name: Get Go Cache path
id: go-cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: |
${{ steps.go-cache-paths.outputs.go-build }}
${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
cache: true

- name: Download rad CLI
uses: actions/download-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOVER }}
cache: true
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/long-running-azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOVER }}
cache: true
- name: Log the summary of build info for new version.
if: steps.skip-build.outputs.SKIP_BUILD != 'true'
continue-on-error: true
Expand Down Expand Up @@ -345,6 +346,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOVER }}
cache: true
- name: Download rad CLI
if: env.SKIP_BUILD != 'true'
uses: actions/download-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
with:
go-version: ${{ env.GOVER }}
cache-dependency-path: radius/go.sum
cache: true
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
Expand Down

0 comments on commit bbb1d24

Please sign in to comment.