Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alternate way to install gotip #5618

Merged
merged 12 commits into from
Jun 15, 2024
26 changes: 21 additions & 5 deletions .github/actions/setup-go-tip/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ description: 'Install Go Tip toolchain'
runs:
using: "composite"
steps:
- name: Install Go Tip
- name: Download Go Tip
id: download-go-tip
shell: bash
run: |
set -euo pipefail
Expand All @@ -22,11 +23,12 @@ runs:
echo "Failed to download. Retrying in $wait_time seconds..."
sleep $wait_time
done
echo "download_status=${success}" >> $GITHUB_OUTPUT

if [[ "$success" == false ]]; then
echo "Failed to download Go Tip after $retries attempts"
exit 1
fi
- name: Install Go Tip
if: steps.download-go-tip.outputs.download_status == 'true'
shell: bash
run: |
echo "Downloaded bundle:"
ls -lah gotip.tar.gz
export GOROOT="$HOME/sdk/gotip"
Expand All @@ -37,5 +39,19 @@ runs:
echo "GOROOT=$GOROOT" >> $GITHUB_ENV
echo "GOPATH=$GOPATH" >> $GITHUB_ENV
echo "PATH=$PATH" >> $GITHUB_ENV

- name: Build Go Tip from source
if: steps.download-go-tip.outputs.download_status == 'false'
shell: bash
run: |
go install golang.org/dl/gotip@latest
gotip download
echo "GOROOT=$(go env GOROOT)" >> $GITHUB_ENV
echo "GOTIP_BIN=$(go env GOPATH)/bin/gotip" >> $GITHUB_ENV
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this in your run https://github.com/EraKin575/test-project/actions/runs/9504391060/job/26196935810#step:7:66

Success. You may now run 'gotip'!
Run echo "Active Go version:"
Active Go version:
go version go1.22.4 linux/amd[64](https://github.com/EraKin575/test-project/actions/runs/9504391060/job/26196935810#step:7:67)

This isn't gotip. And I was expecting that, because you're not setting up env vars the same way as we do in L38-41. For example, you do GOROOT=$(go env GOROOT) - that's just default Go version, nothing to do with gotip.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
Someting like this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note - we could still make it work, I suppose, but then we need to change how the tests are run, e.g. make test GO=gotip

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this?

I don't like "designing by screenshots" - you should test it out. This is why we have the final step to print go version


- name: Check Go Version
shell: bash
run: |
echo "Active Go version:"
go version

EraKin575 marked this conversation as resolved.
Show resolved Hide resolved