Skip to content

Commit

Permalink
fixup: Add repo-local action for golang setup
Browse files Browse the repository at this point in the history
  • Loading branch information
marun committed May 1, 2024
1 parent 2339866 commit 9f26677
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 10 deletions.
25 changes: 25 additions & 0 deletions .github/actions/setup-go-for-project-v3/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This action targets setup-go@v3 to support workers with old NodeJS
# incompabible with newer versions of setup-go.
#
# Since github actions do not support dynamically configuring the
# versions in a uses statement (e.g. `actions/setup-go@${{ var }}`) it
# is necessary to define an action per version rather than one action
# that can be parameterized.
#
# Must be run after actions/checkout to ensure go.mod is available to
# source the desired go version from.

name: 'Install Go toolchain with project defaults'
description: 'Install a go toolchain with project defaults'

runs:
using: composite
steps:
- name: Set the project Go version in the environment
run: .github/workflows/go_version_env.sh >> $GITHUB_ENV
shell: bash
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '${{ env.GO_VERSION }}'
check-latest: true
26 changes: 26 additions & 0 deletions .github/actions/setup-go-for-project/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This action targets the project default version of setup-go. For
# workers with old NodeJS incompabible with newer versions of
# setup-go, try setup-go-for-project-v3.
#
# Since github actions do not support dynamically configuring the
# versions in a uses statement (e.g. `actions/setup-go@${{ var }}`) it
# is necessary to define an action per version rather than one action
# that can be parameterized.
#
# Must be run after actions/checkout to ensure go.mod is available to
# source the desired go version from.

name: 'Install Go toolchain with project defaults'
description: 'Install a go toolchain with project defaults'

runs:
using: composite
steps:
- name: Set the project Go version in the environment
run: .github/workflows/go_version_env.sh >> $GITHUB_ENV
shell: bash
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '${{ env.GO_VERSION }}'
check-latest: true
12 changes: 2 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ jobs:
os: [macos-12, ubuntu-20.04, ubuntu-22.04, windows-2022, [self-hosted, linux, ARM64, focal], [self-hosted, linux, ARM64, jammy]]
steps:
- uses: actions/checkout@v4
- run: .github/workflows/go_version_env.sh >> $GITHUB_ENV
- uses: actions/setup-go@v3
with:
go-version: '${{ env.GO_VERSION }}'
check-latest: true
- uses: ./.github/actions/setup-go-for-project-v3
- name: Set timeout on Windows # Windows UT run slower and need a longer timeout
shell: bash
if: matrix.os == 'windows-2022'
Expand All @@ -61,11 +57,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: .github/workflows/go_version_env.sh >> $GITHUB_ENV
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
- uses: ./.github/actions/setup-go-for-project
- name: Build AvalancheGo Binary
shell: bash
run: ./scripts/build.sh -r
Expand Down

0 comments on commit 9f26677

Please sign in to comment.