Skip to content

Commit 83cd9fc

Browse files
committed
chore: update abigen build script and go version src in ci
1 parent 6272fc5 commit 83cd9fc

File tree

3 files changed

+7
-42
lines changed

3 files changed

+7
-42
lines changed

.github/actions/setup-go/action.yml

+1-13
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,10 @@ inputs:
2929
runs:
3030
using: composite
3131
steps:
32-
- name: Get Go Version
33-
shell: bash
34-
id: go-version
35-
run: |
36-
version=$(sed -ne '/^toolchain /s/^toolchain go//p' ${{ inputs.go-version-file }})
37-
if [ -z "$version" ]; then
38-
version=$(sed -ne '/^go /s/^go //p' ${{ inputs.go-version-file }})
39-
echo "Toolchain version not found in ${{ inputs.go-version-file }}, using go directive instead."
40-
fi
41-
echo "Go Version: $version"
42-
echo "version=$version" >> "$GITHUB_OUTPUT"
43-
4432
- name: Set up Go
4533
uses: actions/setup-go@v5
4634
with:
47-
go-version: ${{ steps.go-version.outputs.version }}
35+
go-version-file: ${{ inputs.go-version-file }}
4836
cache: false
4937
check-latest: true
5038

core/gethwrappers/abigen.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"go/token"
1010
"os"
1111
"os/exec"
12-
"path/filepath"
1312
"regexp"
1413
"strings"
1514

@@ -40,8 +39,7 @@ type AbigenArgs struct {
4039
// Check whether native abigen is installed, and has correct version
4140
func Abigen(a AbigenArgs) {
4241
var versionResponse bytes.Buffer
43-
abigenExecutablePath := filepath.Join(GetProjectRoot(), "tools/bin/abigen")
44-
abigenVersionCheck := exec.Command(abigenExecutablePath, "--version")
42+
abigenVersionCheck := exec.Command("abigen", "--version")
4543
abigenVersionCheck.Stdout = &versionResponse
4644
if err := abigenVersionCheck.Run(); err != nil {
4745
Exit("no native abigen; you must install it (`make abigen` in the "+
@@ -64,7 +62,7 @@ func Abigen(a AbigenArgs) {
6462
if a.Bin != "-" {
6563
args = append(args, "-bin", a.Bin)
6664
}
67-
buildCommand := exec.Command(abigenExecutablePath, args...)
65+
buildCommand := exec.Command("abigen", args...)
6866
var buildResponse bytes.Buffer
6967
buildCommand.Stderr = &buildResponse
7068
if err := buildCommand.Run(); err != nil {

tools/bin/build_abigen

+4-25
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,19 @@
33
# Checks that the correct abigen is installed in this directory, and installs it
44
# if not.
55

6-
set -e
6+
set -euo pipefail
77

88
# Version of abigen to install. Must be run within chainlink project
99
GETH_VERSION=$(go list -json -m github.com/ethereum/go-ethereum | jq -r .Version)
10-
GETH_REPO_URL="https://github.com/ethereum/go-ethereum"
11-
12-
function realpath { echo $(cd $(dirname $1); pwd)/$(basename $1); }
13-
THIS_DIR="$(realpath "$(dirname $0)")"
1410

1511
NATIVE_ABIGEN_VERSION=v"$(
16-
"$THIS_DIR/abigen" --version 2> /dev/null | \
17-
grep -E -o '([0-9]+\.[0-9]+\.[0-9]+)'
12+
abigen --version 2>/dev/null |
13+
grep -E -o '([0-9]+\.[0-9]+\.[0-9]+)'
1814
)" || true
1915

2016
if [ "$NATIVE_ABIGEN_VERSION" == "$GETH_VERSION" ]; then
2117
echo "Correct abigen version already installed."
2218
exit 0
2319
fi
2420

25-
function cleanup() {
26-
rm -rf "$TMPDIR"
27-
}
28-
29-
trap cleanup EXIT
30-
31-
TMPDIR="$(mktemp -d)"
32-
33-
pushd "$TMPDIR"
34-
35-
git clone --depth=1 --single-branch --branch "$GETH_VERSION" "$GETH_REPO_URL"
36-
cd go-ethereum/cmd/abigen
37-
go build
38-
rm -f "$THIS_DIR/abigen" # necessary on MacOS for code signing
39-
cp ./abigen "$THIS_DIR"
40-
41-
popd
42-
21+
go install github.com/ethereum/go-ethereum/cmd/abigen@$GETH_VERSION

0 commit comments

Comments
 (0)