mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-24 22:58:18 +01:00
To avoid build caches getting larger and larger, causing our builds to fail, we separate the caches of the different job types. If we don't separate them, then the caches can end up being a combination of the different jobs, which isn't useful (for example the build cache of the cross compilation build isn't useful in an integration test and vice versa).
41 lines
1.3 KiB
YAML
41 lines
1.3 KiB
YAML
name: "Setup Golang environment"
|
|
description: "A reusable workflow that's used to set up the Go environment and cache."
|
|
inputs:
|
|
go-version:
|
|
description: "The version of Golang to set up"
|
|
required: true
|
|
key-prefix:
|
|
description: "A prefix to use for the cache key, to separate cache entries from other workflows"
|
|
required: false
|
|
|
|
runs:
|
|
using: "composite"
|
|
|
|
steps:
|
|
- name: setup go ${{ inputs.go-version }}
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: '${{ inputs.go-version }}'
|
|
|
|
- name: go cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
# In order:
|
|
# * Module download cache
|
|
# * Build cache (Linux)
|
|
# * Build cache (Mac)
|
|
# * Build cache (Windows)
|
|
path: |
|
|
~/go/pkg/mod
|
|
~/.cache/go-build
|
|
~/Library/Caches/go-build
|
|
~\AppData\Local\go-build
|
|
key: ${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-${{ github.job }}-
|
|
${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-
|
|
|
|
- name: set GOPATH
|
|
shell: bash
|
|
run: |
|
|
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
|