Skip to content

Use restore key

Use restore key #92

Workflow file for this run

name: Go
on:
pull_request:
types:
- opened
- synchronize
- reopened
push:
branches:
- main
release:
types:
- published
env:
IS_PR: ${{github.event_name == 'pull_request' || ''}}
IS_MAIN: ${{github.event_name == 'push' || ''}}
IS_RELEASE: ${{github.event_name == 'release' || ''}}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
path: |
~/.cache/golangci-lint
~/.cache/go-build
~/go/pkg/mod
- uses: actions/setup-go@v5
with:
go-version-file: ./go.work
cache: false
- name: Download deps
run: make download
- name: Check mod files
run: make -j2 tidy-check
- name: Lint
run: make lint # or golangci-lint doesn't like parallel runs, hence no -j flag.
- name: Test
run: make -j2 test
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./.output/coverage/*.txt
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./.output/junit/*.xml
- name: Release
if: ${{ env.IS_RELEASE }}
env:
TAG: ${{ github.ref_name }}
run: make .release
- uses: actions/cache/save@v4
if: ${{ env.IS_MAIN }}
with:
key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }}
path: |
~/.cache/golangci-lint
~/.cache/go-build
~/go/pkg/mod