Merge pull request #7295 from guggero/build-cache

GitHub: fix Golang build cache in actions
This commit is contained in:
Oliver Gugger authored and GitHub committed 2023-01-06 14:11:34 +01:00
commit ef8cf73d4c
3 files changed
+48 -36

No files matched your search

+16 -6
View File
@@ -1,14 +1,18 @@
# A resuable workflow that's used to setup the go enviroment and cache. name: "Setup Golang environment"
name: Setup go enviroment 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
runs: runs:
using: "composite" using: "composite"
steps: steps:
- name: setup go ${{ env.GO_VERSION }} - name: setup go ${{ inputs.go-version }}
uses: actions/setup-go@v3 uses: actions/setup-go@v3
with: with:
go-version: '${{ env.GO_VERSION }}' go-version: '${{ inputs.go-version }}'
- name: go cache - name: go cache
uses: actions/cache@v3 uses: actions/cache@v3
@@ -23,6 +27,12 @@ runs:
~/.cache/go-build ~/.cache/go-build
~/Library/Caches/go-build ~/Library/Caches/go-build
~\AppData\Local\go-build ~\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-go-${{ inputs.go-version }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
restore-keys: | restore-keys: |
${{ runner.os }}-go-${{ env.GO_VERSION }}- ${{ runner.os }}-go-${{ inputs.go-version }}-${{ github.job }}-
${{ runner.os }}-go-${{ inputs.go-version }}-
- name: set GOPATH
shell: bash
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
+30 -29
View File
@@ -18,9 +18,6 @@ defaults:
shell: bash shell: bash
env: env:
# go needs absolute directories, using the $HOME variable doesn't work here.
GOCACHE: /home/runner/work/go/pkg/build
GOPATH: /home/runner/work/go
BITCOIN_VERSION: "23.0" BITCOIN_VERSION: "23.0"
# If you change this value, please change it in the following files as well: # If you change this value, please change it in the following files as well:
@@ -42,9 +39,10 @@ jobs:
- name: git checkout - name: git checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- id: setup - name: setup go ${{ env.GO_VERSION }}
name: Setup go env
uses: ./.github/actions/setup-go uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: run check - name: run check
run: make rpc-check run: make rpc-check
@@ -71,9 +69,10 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- id: setup - name: setup go ${{ env.GO_VERSION }}
name: Setup go env
uses: ./.github/actions/setup-go uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: fetch and rebase on ${{ github.base_ref }} - name: fetch and rebase on ${{ github.base_ref }}
run: | run: |
@@ -98,9 +97,10 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- id: setup - name: setup go ${{ env.GO_VERSION }}
name: Setup go env
uses: ./.github/actions/setup-go uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: check code format - name: check code format
run: make fmt-check run: make fmt-check
@@ -118,9 +118,10 @@ jobs:
- name: git checkout - name: git checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- id: setup - name: setup go ${{ env.GO_VERSION }}
name: Setup go env
uses: ./.github/actions/setup-go uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: build release for all architectures - name: build release for all architectures
run: make release run: make release
@@ -135,9 +136,10 @@ jobs:
- name: git checkout - name: git checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- id: setup - name: setup go ${{ env.GO_VERSION }}
name: Setup go env
uses: ./.github/actions/setup-go uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: check all command line flags exist in sample-lnd.conf file - name: check all command line flags exist in sample-lnd.conf file
run: make sample-conf-check run: make sample-conf-check
@@ -161,9 +163,10 @@ jobs:
- name: git checkout - name: git checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- id: setup - name: setup go ${{ env.GO_VERSION }}
name: Setup go env
uses: ./.github/actions/setup-go uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: install bitcoind - name: install bitcoind
run: ./scripts/install_bitcoind.sh run: ./scripts/install_bitcoind.sh
@@ -207,9 +210,10 @@ jobs:
- name: git checkout - name: git checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- id: setup - name: setup go ${{ env.GO_VERSION }}
name: Setup go env
uses: ./.github/actions/setup-go uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: install bitcoind - name: install bitcoind
run: ./scripts/install_bitcoind.sh run: ./scripts/install_bitcoind.sh
@@ -236,16 +240,14 @@ jobs:
windows-integration-test: windows-integration-test:
name: run windows itest name: run windows itest
runs-on: windows-latest runs-on: windows-latest
env:
GOCACHE: ${{ github.workspace }}/go/pkg/build
GOPATH: ${{ github.workspace }}/go
steps: steps:
- name: git checkout - name: git checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- id: setup - name: setup go ${{ env.GO_VERSION }}
name: Setup go env
uses: ./.github/actions/setup-go uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: run itest - name: run itest
run: make itest-parallel windows=1 tranches=2 parallel=2 run: make itest-parallel windows=1 tranches=2 parallel=2
@@ -291,9 +293,10 @@ jobs:
- name: git checkout - name: git checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- id: setup - name: setup go ${{ env.GO_VERSION }}
name: Setup go env
uses: ./.github/actions/setup-go uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: install bitcoind - name: install bitcoind
run: ./scripts/install_bitcoind.sh run: ./scripts/install_bitcoind.sh
@@ -320,16 +323,14 @@ jobs:
new-windows-integration-test: new-windows-integration-test:
name: run new windows itest name: run new windows itest
runs-on: windows-latest runs-on: windows-latest
env:
GOCACHE: ${{ github.workspace }}/go/pkg/build
GOPATH: ${{ github.workspace }}/go
steps: steps:
- name: git checkout - name: git checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- id: setup - name: setup go ${{ env.GO_VERSION }}
name: Setup go env
uses: ./.github/actions/setup-go uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: run new itest - name: run new itest
run: make itest-parallel temptest=true windows=1 tranches=2 parallel=2 run: make itest-parallel temptest=true windows=1 tranches=2 parallel=2
+2 -1
View File
@@ -312,7 +312,8 @@ certain large transactions](https://github.com/lightningnetwork/lnd/pull/7100).
branch](https://github.com/lightningnetwork/lnd/pull/7103) rather than just branch](https://github.com/lightningnetwork/lnd/pull/7103) rather than just
using the master branch. And [skip the commit using the master branch. And [skip the commit
check](https://github.com/lightningnetwork/lnd/pull/7114) for all non-PR check](https://github.com/lightningnetwork/lnd/pull/7114) for all non-PR
events. events. The Golang build cache [was also optimized to speed up tests and
builds](https://github.com/lightningnetwork/lnd/pull/7295).
* Fixed docker image version used in * Fixed docker image version used in
[`tools`](https://github.com/lightningnetwork/lnd/pull/7254). [`tools`](https://github.com/lightningnetwork/lnd/pull/7254).