From 189141901a60217a080f8a3af0a6231bae9ca714 Mon Sep 17 00:00:00 2001 From: Cameron Schultz Date: Fri, 1 Sep 2023 14:10:14 -0400 Subject: [PATCH 1/3] export portable blst vars --- scripts/constants.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/constants.sh b/scripts/constants.sh index 14a0d5e6..13e34050 100755 --- a/scripts/constants.sh +++ b/scripts/constants.sh @@ -22,3 +22,12 @@ relayer_dockerhub_repo=${DOCKER_REPO:-"awm-relayer"} current_branch=$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match || true) git_commit=${RELAYER_COMMIT:-$( git rev-list -1 HEAD )} + +# Set the CGO flags to use the portable version of BLST +# +# We use "export" here instead of just setting a bash variable because we need +# to pass this flag to all child processes spawned by the shell. +export CGO_CFLAGS="-O -D__BLST_PORTABLE__" +# While CGO_ENABLED doesn't need to be explicitly set, it produces a much more +# clear error due to the default value change in go1.20. +export CGO_ENABLED=1 \ No newline at end of file From 4951363bec9a4a92261aa240daf3f4e03746ef0d Mon Sep 17 00:00:00 2001 From: Cameron Schultz Date: Fri, 1 Sep 2023 14:10:41 -0400 Subject: [PATCH 2/3] source constants.sh in unit tests --- .github/workflows/test.yml | 2 +- CONTRIBUTING.md | 2 +- scripts/build.sh | 7 ++++--- scripts/test.sh | 14 ++++++++++++++ 4 files changed, 20 insertions(+), 5 deletions(-) create mode 100755 scripts/test.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 20a117a8..edb8ce27 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,5 +32,5 @@ jobs: - name: Run Relayer Unit Tests run: | cd awm-relayer - go test ./... + ./scripts/test.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 34126291..99620918 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,7 +35,7 @@ To start developing on AWM Relayer, you'll need Golang >= v1.18.1. - Run the unit tests ```sh -go test ./... +./scripts/test.sh ``` ### Continuous Integration (CI) diff --git a/scripts/build.sh b/scripts/build.sh index 322ff9d5..4c03ade9 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -30,13 +30,14 @@ if version_lt "$(go_version)" "$go_version_minimum"; then fi # Root directory -AWM_RELAYER_PATH=$( +RELAYER_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" cd .. && pwd ) -# Load the versions -source "$AWM_RELAYER_PATH"/scripts/versions.sh +# Load the versions and constants +source "$RELAYER_PATH"/scripts/versions.sh +source "$RELAYER_PATH"/scripts/constants.sh if [[ $# -eq 1 ]]; then binary_path=$1 diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 00000000..6f16e730 --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. +# See the file LICENSE for licensing terms. + +set -o errexit +set -o nounset +set -o pipefail + +# Directory above this script +RELAYER_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) + +source "$RELAYER_PATH"/scripts/constants.sh + +go test ./... \ No newline at end of file From ccbc8de188478db7a962a011a02cff488760f359 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Tue, 5 Sep 2023 14:41:27 +0000 Subject: [PATCH 3/3] relayer path command on two lines --- scripts/build_local_image.sh | 6 ++++-- scripts/constants.sh | 5 ++++- scripts/test.sh | 6 ++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/build_local_image.sh b/scripts/build_local_image.sh index 71a8fa0f..aae95bf8 100755 --- a/scripts/build_local_image.sh +++ b/scripts/build_local_image.sh @@ -7,8 +7,10 @@ set -o nounset set -o pipefail # Directory above this script -RELAYER_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) - +RELAYER_PATH=$( + cd "$(dirname "${BASH_SOURCE[0]}")" + cd .. && pwd +) # Load the constants source "$RELAYER_PATH"/scripts/constants.sh diff --git a/scripts/constants.sh b/scripts/constants.sh index 13e34050..bfb90688 100755 --- a/scripts/constants.sh +++ b/scripts/constants.sh @@ -5,7 +5,10 @@ # Use lower_case variables in the scripts and UPPER_CASE variables for override # Use the constants.sh for env overrides -RELAYER_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) # Directory above this script +RELAYER_PATH=$( + cd "$(dirname "${BASH_SOURCE[0]}")" + cd .. && pwd +) # Where AWM Relayer binary goes relayer_path="$RELAYER_PATH/build/awm-relayer" diff --git a/scripts/test.sh b/scripts/test.sh index 6f16e730..c402fedb 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -7,8 +7,10 @@ set -o nounset set -o pipefail # Directory above this script -RELAYER_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) - +RELAYER_PATH=$( + cd "$(dirname "${BASH_SOURCE[0]}")" + cd .. && pwd +) source "$RELAYER_PATH"/scripts/constants.sh go test ./... \ No newline at end of file