Skip to content

Commit

Permalink
use built-in cache of actions/setup-go
Browse files Browse the repository at this point in the history
From [actions/setup-go@v4.0.0](https://github.com/actions/setup-go/releases/tag/v4.0.0), the action caches the dependencies by default.
We don't need to use actions/cache any more.

In addition, caching the dependencies requires `go.sum`.
actions/checkout should precede actions/setup-go.
  • Loading branch information
shogo82148 committed Jul 21, 2023
1 parent de438f1 commit 1b8d28b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Load cached dependencies
uses: actions/cache@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: 1.20.x

- name: Prepare release
run: |
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ jobs:
runs-on: ${{ matrix.os }}
steps:

- name: Checkout code
uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}

- name: Checkout code
uses: actions/checkout@v3
cache-dependency-path: '**/go.sum'

- name: Vet and build
run: |
Expand Down

0 comments on commit 1b8d28b

Please sign in to comment.