Skip to content

Commit

Permalink
Cache Go dependencies and build outputs in ci-go workflow (#75)
Browse files Browse the repository at this point in the history
To improve workflow execution time for the `ci-go` workflow [1] the
`actions/cache` [2] GitHub action is now used to cache Go dependencies
and build outputs. Also see the detailed documentation about
"Caching dependencies to speed up workflows" [3] to learn more about the
way `action/cache` works.

[1]: https://github.com/svengreb/tmpl-go/blob/c099c6ee246eb402b63f7a605ca647c481a02eab/.github/workflows/ci-go.yaml
[2]: https://github.com/actions/cache
[3]: https://docs.github.com/en/actions/advanced-guides/caching-dependencies-to-speed-up-workflows

Resolves GH-74
  • Loading branch information
svengreb authored Nov 21, 2021
1 parent c099c6e commit 05c0d38
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,23 @@ jobs:
go-version: "1.17.x"
- name: Run tests with coverage and race detector
run: go test -cover -race -v ./...

post-tasks:
runs-on: ubuntu-latest
steps:
- name: Print metadata and context information
run: |
echo "Git SHA: $GITHUB_SHA"
echo "Git Ref: $GITHUB_REF"
echo "Workflow Actor: $GITHUB_ACTOR"
- name: Checkout repository
uses: actions/checkout@v2
- name: Cache Go dependencies and build outputs
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

0 comments on commit 05c0d38

Please sign in to comment.