Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ci): use composite actions for Go build cache
- Loading branch information
Showing
8 changed files
with
74 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: 'Set up Go' | ||
description: 'Install Go and set up cache' | ||
inputs: | ||
cache-key-prefix: | ||
description: 'Cache key prefix' | ||
required: false | ||
default: setup-go-with-cache-${{ github.workflow }}-${{ github.job }} | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v3.2.0 | ||
with: | ||
go-version-file: .go-version | ||
- name: Get Go cache paths | ||
id: go-cache | ||
shell: bash | ||
run: | | ||
echo "::set-output name=cache::$(go env GOCACHE)" | ||
echo "::set-output name=modcache::$(go env GOMODCACHE)" | ||
- name: Set up Go cache | ||
uses: actions/cache@v3.0.2 | ||
with: | ||
key: ${{ inputs.cache-key-prefix }}-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }} | ||
restore-keys: | | ||
${{ inputs.cache-key-prefix }}-${{ runner.os }}-${{ github.run_id }}- | ||
${{ inputs.cache-key-prefix }}-${{ runner.os }}- | ||
path: | | ||
${{ steps.go-cache.outputs.cache }} | ||
${{ steps.go-cache.outputs.modcache }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: 'Set up golangci-lint' | ||
description: 'Install golangci-lint and set up cache' | ||
inputs: | ||
cache-key-prefix: | ||
description: 'Cache key prefix' | ||
required: false | ||
default: setup-golangci-lint-${{ github.workflow }}-${{ github.job }} | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Install golangci-lint | ||
shell: bash | ||
run: | | ||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.46.2 | ||
- name: Get golangci-lint cache path | ||
id: golangci-lint-cache-status | ||
shell: bash | ||
run: | | ||
echo "::set-output name=dir::$(golangci-lint cache status | head -1 | sed 's/^Dir: //')" | ||
- name: Set up golangci-lint cache | ||
uses: actions/cache@v3.0.2 | ||
with: | ||
key: ${{ inputs.cache-key-prefix }}-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }} | ||
restore-keys: | | ||
${{ inputs.cache-key-prefix }}-${{ runner.os }}-${{ github.run_id }}- | ||
${{ inputs.cache-key-prefix }}-${{ runner.os }}- | ||
path: ${{ steps.golangci-lint-cache-status.outputs.dir }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters