GitHub: make setup-go action more versatile

With this commit we allow the Go version that is set up to be
configurable and not dependent on a specific environment variable. This
will allow us to eventually extract the action into a tooling
repository.
This commit is contained in:
Oliver Gugger 2023-01-06 08:58:41 +01:00
parent c4ca7b99e2
commit 984fc3a2ec
No known key found for this signature in database
GPG Key ID: 8E4256593F177720
2 changed files with 40 additions and 26 deletions

View File

@ -1,14 +1,18 @@
# A resuable workflow that's used to setup the go enviroment and cache.
name: Setup go enviroment
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
runs:
using: "composite"
steps:
- name: setup go ${{ env.GO_VERSION }}
- name: setup go ${{ inputs.go-version }}
uses: actions/setup-go@v3
with:
go-version: '${{ env.GO_VERSION }}'
go-version: '${{ inputs.go-version }}'
- name: go cache
uses: actions/cache@v3
@ -23,9 +27,9 @@ runs:
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-${{ inputs.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ env.GO_VERSION }}-
${{ runner.os }}-go-${{ inputs.go-version }}-
- name: set GOPATH
shell: bash

View File

@ -39,9 +39,10 @@ jobs:
- name: git checkout
uses: actions/checkout@v3
- id: setup
name: Setup go env
- name: setup go ${{ env.GO_VERSION }}
uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: run check
run: make rpc-check
@ -68,9 +69,10 @@ jobs:
with:
fetch-depth: 0
- id: setup
name: Setup go env
- name: setup go ${{ env.GO_VERSION }}
uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: fetch and rebase on ${{ github.base_ref }}
run: |
@ -95,9 +97,10 @@ jobs:
with:
fetch-depth: 0
- id: setup
name: Setup go env
- name: setup go ${{ env.GO_VERSION }}
uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: check code format
run: make fmt-check
@ -115,9 +118,10 @@ jobs:
- name: git checkout
uses: actions/checkout@v3
- id: setup
name: Setup go env
- name: setup go ${{ env.GO_VERSION }}
uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: build release for all architectures
run: make release
@ -132,9 +136,10 @@ jobs:
- name: git checkout
uses: actions/checkout@v3
- id: setup
name: Setup go env
- name: setup go ${{ env.GO_VERSION }}
uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: check all command line flags exist in sample-lnd.conf file
run: make sample-conf-check
@ -158,9 +163,10 @@ jobs:
- name: git checkout
uses: actions/checkout@v3
- id: setup
name: Setup go env
- name: setup go ${{ env.GO_VERSION }}
uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: install bitcoind
run: ./scripts/install_bitcoind.sh
@ -204,9 +210,10 @@ jobs:
- name: git checkout
uses: actions/checkout@v3
- id: setup
name: Setup go env
- name: setup go ${{ env.GO_VERSION }}
uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: install bitcoind
run: ./scripts/install_bitcoind.sh
@ -237,9 +244,10 @@ jobs:
- name: git checkout
uses: actions/checkout@v3
- id: setup
name: Setup go env
- name: setup go ${{ env.GO_VERSION }}
uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: run itest
run: make itest-parallel windows=1 tranches=2 parallel=2
@ -285,9 +293,10 @@ jobs:
- name: git checkout
uses: actions/checkout@v3
- id: setup
name: Setup go env
- name: setup go ${{ env.GO_VERSION }}
uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: install bitcoind
run: ./scripts/install_bitcoind.sh
@ -318,9 +327,10 @@ jobs:
- name: git checkout
uses: actions/checkout@v3
- id: setup
name: Setup go env
- name: setup go ${{ env.GO_VERSION }}
uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
- name: run new itest
run: make itest-parallel temptest=true windows=1 tranches=2 parallel=2