Skip to content

Commit

Permalink
feat: use gotoolchain
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <troian.ap@gmail.com>
  • Loading branch information
troian committed Aug 10, 2023
1 parent 1b02811 commit 066a38c
Show file tree
Hide file tree
Showing 10 changed files with 162 additions and 83 deletions.
5 changes: 3 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
GOLANG_VERSION=1.20.2
KIND_VERSION=0.11.1
GO111MODULE=on

KIND_VERSION=0.11.1
ROOT_DIR=${AKASH_ROOT}

AKASH_DEVCACHE_BASE=${AKASH_ROOT}/.cache
AKASH_DEVCACHE=${AKASH_DEVCACHE_BASE}
AKASH_DEVCACHE_BIN=${AKASH_DEVCACHE}/bin
Expand Down
10 changes: 9 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,24 @@ if ! has readlink ; then
echo "readlink is not installed"; exit 1
fi


AKASH_ROOT=$(pwd)

export AKASH_ROOT

dotenv
dotenv_if_exists dev.env

GOROOT=$HOME/sdk/go1.21.0

PATH_add "$GOROOT/bin"

PATH_add "$AKASH_DEVCACHE_NODE_BIN"
PATH_add "$AKASH_DEVCACHE_BIN"

export AKASH=$AKASH_DEVCACHE_BIN/akash
AKASH=$AKASH_DEVCACHE_BIN/akash

export GOROOT
export AKASH

make cache
32 changes: 32 additions & 0 deletions .github/workflows/dispatch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: dispatch

defaults:
run:
shell: bash

on:
push:

jobs:
dispatch-akash:
runs-on: ubuntu-latest
steps:
- name: notify goreleaser-cross with new release
uses: benc-uk/workflow-dispatch@v1
with:
token: ${{ secrets.GORELEASER_ACCESS_TOKEN }}
repo: akash-network/homebrew-tap
workflow: akash
ref: refs/heads/main
inputs: '{ "tag" : "${{ env.RELEASE_TAG }}" }'
dispatch-provider:
runs-on: ubuntu-latest
steps:
- name: notify homebrew with new release
uses: benc-uk/workflow-dispatch@v1
with:
token: ${{ secrets.GORELEASER_ACCESS_TOKEN }}
repo: akash-network/homebrew-tap
workflow: provider-services
ref: refs/heads/main
inputs: '{"tag": "${{ env.RELEASE_TAG }}"}'
23 changes: 16 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .env
- uses: actions/setup-go@v3
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
echo "GOROOT=/opt/hostedtoolcache/go/${toolchain}/x64" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOLANG_VERSION }}"
go-version: "${{ env.GOVERSION }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand Down Expand Up @@ -49,9 +53,14 @@ jobs:
- run: git fetch --prune --unshallow
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- uses: actions/setup-go@v3
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
echo "GOROOT=/opt/hostedtoolcache/go/${toolchain}/x64" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOLANG_VERSION }}"
go-version: "${{ env.GOVERSION }}"
- name: detect release tag
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: configure variables
Expand Down
127 changes: 82 additions & 45 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,38 @@ jobs:
build-macos:
runs-on: macos-latest
steps:
- run: |
brew install bash direnv
sudo chsh -s /usr/local/bin/bash
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- name: set environment
run: direnv allow
- run: |
while IFS='' read -r LINE || [ -n "${LINE}" ]; do
echo "$LINE" >> $GITHUB_ENV;
done < .env
- run: |
brew install bash
sudo chsh -s /usr/local/bin/bash
- uses: actions/setup-go@v3
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
echo "GOROOT= /Users/runner/hostedtoolcache/go/${toolchain}/x64" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOLANG_VERSION }}"
go-version: "${{ env.GOVERSION }}"
- run: make bins
build-bins:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .env
- uses: actions/setup-go@v3
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
echo "GOROOT=/opt/hostedtoolcache/go/${toolchain}/x64" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOLANG_VERSION }}"
go-version: "${{ env.GOVERSION }}"
check-latest: true
- run: make bins
- run: make docker-image

Expand All @@ -49,25 +57,33 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .env
- uses: actions/setup-go@v3
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
echo "GOROOT=/opt/hostedtoolcache/go/${toolchain}/x64" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOLANG_VERSION }}"
go-version: "${{ env.GOVERSION }}"
- run: make test-full

coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .env
- uses: actions/setup-go@v3
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
echo "GOROOT=/opt/hostedtoolcache/go/${toolchain}/x64" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOLANG_VERSION }}"
go-version: "${{ env.GOVERSION }}"
- run: make test-coverage
- uses: codecov/codecov-action@v3

Expand All @@ -76,12 +92,16 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .env
- uses: actions/setup-go@v3
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
echo "GOROOT=/opt/hostedtoolcache/go/${toolchain}/x64" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOLANG_VERSION }}"
go-version: "${{ env.GOVERSION }}"
- run: make deps-tidy
- run: make build
- run: make test-vet
Expand All @@ -95,12 +115,16 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .env
- uses: actions/setup-go@v3
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
echo "GOROOT=/opt/hostedtoolcache/go/${toolchain}/x64" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOLANG_VERSION }}"
go-version: "${{ env.GOVERSION }}"
- run: make shellcheck

sims:
Expand All @@ -110,12 +134,16 @@ jobs:
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v3
- uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .env
- uses: actions/setup-go@v3
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
echo "GOROOT=/opt/hostedtoolcache/go/${toolchain}/x64" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOLANG_VERSION }}"
go-version: "${{ env.GOVERSION }}"
- name: test-sim-nondeterminism
run: make test-sim-nondeterminism
- name: test-sim-import-export
Expand All @@ -130,12 +158,16 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .env
- uses: actions/setup-go@v3
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
echo "GOROOT=/opt/hostedtoolcache/go/${toolchain}/x64" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOLANG_VERSION }}"
go-version: "${{ env.GOVERSION }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand Down Expand Up @@ -175,9 +207,14 @@ jobs:
- run: git fetch --prune --unshallow
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- uses: actions/setup-go@v3
- run: |
toolchain=$(cat go.mod | grep toolchain | cut -d ' ' -f 2 | sed 's/go*//')
echo "GOTOOLCHAIN=go${toolchain}" >> $GITHUB_ENV
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
echo "GOROOT=/opt/hostedtoolcache/go/${toolchain}/x64" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOLANG_VERSION }}"
go-version: "${{ env.GOVERSION }}"
- name: configure variables
run: |
test_required=$(./script/upgrades.sh test-required ${{ github.ref }})
Expand Down
1 change: 1 addition & 0 deletions .goreleaser-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ dockers:

archives:
- format: binary
rlcp: true
2 changes: 0 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ archives:
name_template: "akash_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
wrap_in_directory: false
format: zip
rlcp: true
files:
- none*
- id: wo/version
Expand All @@ -125,7 +124,6 @@ archives:
name_template: "akash_{{ .Os }}_{{ .Arch }}"
wrap_in_directory: false
format: zip
rlcp: true
files:
- none*

Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module github.com/akash-network/node

go 1.20

toolchain go1.21.0

require (
github.com/akash-network/akash-api v0.0.26
github.com/blang/semver/v4 v4.0.0
Expand Down
Loading

0 comments on commit 066a38c

Please sign in to comment.