Skip to content

Commit

Permalink
build: use direnv to set up gotoolchain version (#1896)
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Sep 19, 2023
1 parent 6952ec2 commit 7fe0bae
Show file tree
Hide file tree
Showing 9 changed files with 174 additions and 86 deletions.
20 changes: 19 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,35 @@ if [ -z "$GOPATH" ]; then
fi

AKASH_ROOT=$(pwd)

export AKASH_ROOT

dotenv
dotenv_if_exists dev.env

TOOLS=${AKASH_ROOT}/script/tools.sh
SEMVER=${AKASH_ROOT}/script/semver.sh

GOTOOLCHAIN=$(${TOOLS} gotoolchain)
GOTOOLCHAIN_SEMVER=$(echo "${GOTOOLCHAIN}" | sed 's/go*/v/' | tr -d '\n')

if [[ "$OSTYPE" == "darwin"* ]]; then
# on MacOS disable deprecation warnings security framework
CGO_CFLAGS=-Wno-deprecated-declarations

export CGO_CFLAGS
fi

export SEMVER
export GOTOOLCHAIN
export GOTOOLCHAIN_SEMVER

PATH_add "$AKASH_DEVCACHE_NODE_BIN"
PATH_add "$AKASH_DEVCACHE_BIN"

AKASH_DIRENV_SET=1
AKASH=$AKASH_DEVCACHE_BIN/akash

export AKASH_DIRENV_SET
export AKASH

make cache
12 changes: 6 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
Expand Down Expand Up @@ -50,9 +50,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
Expand Down
71 changes: 38 additions & 33 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,35 @@ jobs:
build-macos:
runs-on: macos-latest
steps:
- run: |
- name: Install dependencies
run: |
brew install bash direnv
sudo chsh -s /usr/local/bin/bash
- name: Hook direnv to bash
run: echo 'eval "$(direnv hook bash)"' >> $HOME/.bashrc
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- name: set environment
run: direnv allow
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}"
check-latest: true
- name: Setup direnv
run: |
direnv allow
direnv export gha >> "$GITHUB_ENV"
- run: make bins
build-bins:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
Expand All @@ -56,9 +61,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
Expand All @@ -72,9 +77,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
Expand All @@ -89,9 +94,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
Expand All @@ -111,9 +116,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
Expand All @@ -129,9 +134,9 @@ jobs:
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v3
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
Expand All @@ -152,9 +157,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
Expand All @@ -178,9 +183,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
Expand All @@ -205,9 +210,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
Expand Down
9 changes: 6 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/akash-network/node

go 1.20

toolchain go1.21.0
go 1.21

require (
github.com/akash-network/akash-api v0.0.27
Expand Down Expand Up @@ -38,6 +36,11 @@ require (
gopkg.in/yaml.v3 v3.0.1
)

retract (
v0.22.1
v0.26.0
)

replace (
// use cosmos fork of keyring
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
Expand Down
Loading

0 comments on commit 7fe0bae

Please sign in to comment.