Skip to content

Commit

Permalink
ci: configure environment after installing go
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 29, 2023
1 parent 149f22e commit 2985176
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 31 deletions.
6 changes: 6 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ if ! has readlink ; then
echo "readlink is not installed"; exit 1
fi

if [ -z "$GOPATH" ]; then
GOPATH=$(go env GOPATH)
export GOPATH
fi


AKASH_ROOT=$(pwd)

export AKASH_ROOT
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- 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.GOVERSION }}"
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand Down Expand Up @@ -51,16 +50,15 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- 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.GOVERSION }}"
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- name: detect release tag
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: configure variables
Expand Down
48 changes: 23 additions & 25 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
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.GOVERSION }}"
Expand All @@ -39,17 +38,16 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- 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.GOVERSION }}"
check-latest: true
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- run: make bins
- run: make docker-image

Expand All @@ -58,33 +56,31 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- 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.GOVERSION }}"
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- run: make test-full

coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- 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.GOVERSION }}"
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- run: make test-coverage
- uses: codecov/codecov-action@v3

Expand All @@ -93,16 +89,15 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- 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.GOVERSION }}"
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- run: make deps-tidy
- run: make build
- run: make test-vet
Expand All @@ -116,16 +111,15 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- 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.GOVERSION }}"
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- run: make shellcheck

sims:
Expand All @@ -135,16 +129,15 @@ jobs:
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@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.GOVERSION }}"
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- name: test-sim-nondeterminism
run: make test-sim-nondeterminism
- name: test-sim-import-export
Expand All @@ -159,16 +152,15 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- 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.GOVERSION }}"
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand All @@ -186,6 +178,13 @@ 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
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}"
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- name: Ensure only directories exists in upgrades dir
Expand All @@ -206,16 +205,15 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- 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.GOVERSION }}"
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- name: configure variables
run: |
test_required=$(./script/upgrades.sh test-required ${{ github.ref }})
Expand Down

0 comments on commit 2985176

Please sign in to comment.