Skip to content

Commit bdfe98c

Browse files
authored
ci: change logic of getting neard in cli tests (#100)
1 parent e0255da commit bdfe98c

File tree

5 files changed

+69
-36
lines changed

5 files changed

+69
-36
lines changed

.github/workflows/cli.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99

1010
jobs:
1111
shell_tests:
12-
name: Tests ${{ matrix.interface }} CLI
13-
runs-on: k8s-infrastructure-native
12+
name: ${{ matrix.interface }} CLI
13+
runs-on: selfhosted-heavy
1414
container: rust:latest
1515
strategy:
1616
matrix:
@@ -31,7 +31,7 @@ jobs:
3131
- name: Install dependencies
3232
run: |
3333
apt update
34-
apt install -y bash jq python3-venv
34+
apt install -y jq python3-venv
3535
- name: Install aurora-cli
3636
uses: actions-rs/cargo@v1
3737
with:

scripts/advanced.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,30 @@ AURORA_LAST_VERSION=$(curl -s https://api.github.com/repos/aurora-is-near/aurora
66
ENGINE_WASM_URL="https://github.com/aurora-is-near/aurora-engine/releases/download/$AURORA_LAST_VERSION/aurora-mainnet.wasm"
77
ENGINE_WASM_PATH="/tmp/aurora-mainnet.wasm"
88
VENV=/tmp/venv
9+
NEARD_PATH="$HOME/.nearup/near/localnet"
10+
NEARD_VERSION=2.6.5
911

1012
export NEARCORE_HOME="/tmp/localnet"
13+
export PATH="$HOME/NearProtocol/aurora/aurora-cli-rs/target/debug/:$PATH:$USER_BASE_BIN"
1114

1215
# Install `nearup` utility if not installed before.
1316
python3 -m venv $VENV
1417
source $VENV/bin/activate
1518
pip list | grep nearup > /dev/null || pip install nearup > /dev/null
1619

17-
start_node() {
18-
cmd="nearup run localnet --home $NEARCORE_HOME --num-nodes 1"
19-
20-
if [[ $(uname -m) == "arm64" ]]; then # Check for local execution
21-
cmd="$cmd --binary-path $HOME/.nearup/near/localnet"
20+
download_neard() {
21+
if [[ ! -f $NEARD_PATH/neard ]]; then
22+
mkdir -p $NEARD_PATH
23+
url="https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/$(uname)-$(uname -m)/$NEARD_VERSION/neard.tar.gz"
24+
curl -s $url -o $NEARD_PATH/neard.tar.gz || error_exit
25+
tar xvzf $NEARD_PATH/neard.tar.gz -C $NEARD_PATH --strip-components 1
26+
chmod +x $NEARD_PATH/neard
2227
fi
28+
}
2329

24-
$cmd > /dev/null 2>&1
30+
start_node() {
31+
cmd="nearup run localnet --home $NEARCORE_HOME --binary-path $NEARD_PATH --num-nodes 1"
32+
$cmd || error_exit
2533
}
2634

2735
finish() {
@@ -47,7 +55,9 @@ wait_for_block() {
4755
}
4856

4957
# Download `neard` and preparing config files.
58+
download_neard
5059
start_node
60+
sleep 3
5161
nearup stop > /dev/null 2>&1
5262
wait_for_block
5363

scripts/different-outputs.sh

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,29 @@ AURORA_SECRET_KEY=27cb3ddbd18037b38d7fb9ae3433a9d6f5cd554a4ba5768c8a15053f688ee1
1919
ENGINE_ACCOUNT=aurora.node0
2020
MANAGER_ACCOUNT=key-manager.aurora.node0
2121
VENV=/tmp/venv
22+
NEARD_PATH="$HOME/.nearup/near/localnet"
23+
NEARD_VERSION=2.6.5
2224

2325
export PATH="$HOME/NearProtocol/aurora/aurora-cli-rs/target/debug/:$PATH:$USER_BASE_BIN"
2426

25-
2627
# Install `nearup` utility if not installed before.
2728
python3 -m venv $VENV
2829
source $VENV/bin/activate
2930
pip list | grep nearup > /dev/null || pip install nearup > /dev/null
3031

31-
start_node() {
32-
cmd="nearup run localnet --home $NEARCORE_HOME"
33-
34-
if [[ $(uname -m) == "arm64" ]]; then # Check for local execution
35-
cmd="$cmd --binary-path $HOME/.nearup/near/localnet --num-nodes 1"
32+
download_neard() {
33+
if [[ ! -f $NEARD_PATH/neard ]]; then
34+
mkdir -p $NEARD_PATH
35+
url="https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/$(uname)-$(uname -m)/$NEARD_VERSION/neard.tar.gz"
36+
curl -s $url -o $NEARD_PATH/neard.tar.gz || error_exit
37+
tar xvzf $NEARD_PATH/neard.tar.gz -C $NEARD_PATH --strip-components 1
38+
chmod +x $NEARD_PATH/neard
3639
fi
40+
}
3741

38-
$cmd > /dev/null 2>&1
42+
start_node() {
43+
cmd="nearup run localnet --home $NEARCORE_HOME --binary-path $NEARD_PATH --num-nodes 1"
44+
$cmd || error_exit
3945
}
4046

4147
stop_node() {
@@ -68,8 +74,9 @@ assert_eq() {
6874
}
6975

7076
# Start NEAR node.
77+
download_neard
7178
start_node
72-
sleep 1
79+
sleep 3
7380

7481
# Download Aurora EVM.
7582
curl -sL $ENGINE_PREV_WASM_URL -o $ENGINE_WASM_PATH || error_exit
@@ -132,7 +139,7 @@ export NEAR_KEY_PATH=$RELAYER_KEY_PATH
132139
aurora-cli --engine $ENGINE_ACCOUNT deploy --code "$EVM_CODE" --aurora-secret-key $AURORA_SECRET_KEY || error_exit
133140
sleep 1
134141
result=$(aurora-cli --engine $ENGINE_ACCOUNT view-call -a 0xa3078bf607d2e859dca0b1a13878ec2e607f30de -f greet \
135-
--abi-path $ABI_PATH || error_exit)
142+
--abi-path $ABI_PATH --from 0x1B16948F011686AE64BB2Ba0477aeFA2Ea97084D || error_exit)
136143
assert_eq "$result" "Hello, World!"
137144
sleep 1
138145

@@ -149,23 +156,23 @@ aurora-cli --engine $ENGINE_ACCOUNT deploy --code $EVM_CODE --abi-path $ABI_PATH
149156
--aurora-secret-key $AURORA_SECRET_KEY || error_exit
150157
sleep 1
151158
result=$(aurora-cli --engine $ENGINE_ACCOUNT view-call -a 0x4cf003049d1a9c4918c73e9bf62464d904184555 -f value \
152-
--abi-path $ABI_PATH || error_exit)
159+
--abi-path $ABI_PATH --from 0x1B16948F011686AE64BB2Ba0477aeFA2Ea97084D|| error_exit)
153160
assert_eq "$result" "5"
154161
sleep 1
155162
aurora-cli --engine $ENGINE_ACCOUNT call -a 0x4cf003049d1a9c4918c73e9bf62464d904184555 -f increment \
156163
--abi-path $ABI_PATH \
157164
--aurora-secret-key 611830d3641a68f94a690dcc25d1f4b0dac948325ac18f6dd32564371735f32c || error_exit
158165
sleep 1
159166
result=$(aurora-cli --engine $ENGINE_ACCOUNT view-call -a 0x4cf003049d1a9c4918c73e9bf62464d904184555 -f value \
160-
--abi-path $ABI_PATH || error_exit)
167+
--abi-path $ABI_PATH --from 0x1B16948F011686AE64BB2Ba0477aeFA2Ea97084D || error_exit)
161168
assert_eq "$result" "6"
162169
sleep 1
163170
aurora-cli --engine $ENGINE_ACCOUNT call -a 0x4cf003049d1a9c4918c73e9bf62464d904184555 -f decrement \
164171
--abi-path $ABI_PATH \
165172
--aurora-secret-key 611830d3641a68f94a690dcc25d1f4b0dac948325ac18f6dd32564371735f32c || error_exit
166173
sleep 1
167174
result=$(aurora-cli --engine $ENGINE_ACCOUNT view-call -a 0x4cf003049d1a9c4918c73e9bf62464d904184555 -f value \
168-
--abi-path $ABI_PATH || error_exit)
175+
--abi-path $ABI_PATH --from 0x1B16948F011686AE64BB2Ba0477aeFA2Ea97084D || error_exit)
169176
assert_eq "$result" "5"
170177
sleep 1
171178

scripts/simple-silo.sh

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,29 @@ AURORA_KEY_PATH=$NEARCORE_HOME/node0/aurora_key.json
1010
AURORA_SECRET_KEY=27cb3ddbd18037b38d7fb9ae3433a9d6f5cd554a4ba5768c8a15053f688ee167
1111
ENGINE_ACCOUNT=aurora.node0
1212
VENV=/tmp/venv
13+
NEARD_PATH="$HOME/.nearup/near/localnet"
14+
NEARD_VERSION=2.6.5
1315

16+
export PATH="$HOME/NearProtocol/aurora/aurora-cli-rs/target/debug/:$PATH:$USER_BASE_BIN"
1417

1518
# Install `nearup` utility if not installed before.
1619
python3 -m venv $VENV
1720
source $VENV/bin/activate
1821
pip list | grep nearup > /dev/null || pip install nearup > /dev/null
1922

20-
start_node() {
21-
cmd="nearup run localnet --home $NEARCORE_HOME"
22-
23-
if [[ $(uname -m) == "arm64" ]]; then # Check for local execution
24-
cmd="$cmd --binary-path $HOME/.nearup/near/localnet --num-nodes 1"
23+
download_neard() {
24+
if [[ ! -f $NEARD_PATH/neard ]]; then
25+
mkdir -p $NEARD_PATH
26+
url="https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/$(uname)-$(uname -m)/$NEARD_VERSION/neard.tar.gz"
27+
curl -s $url -o $NEARD_PATH/neard.tar.gz || error_exit
28+
tar xvzf $NEARD_PATH/neard.tar.gz -C $NEARD_PATH --strip-components 1
29+
chmod +x $NEARD_PATH/neard
2530
fi
31+
}
2632

27-
$cmd > /dev/null 2>&1
33+
start_node() {
34+
cmd="nearup run localnet --home $NEARCORE_HOME --binary-path $NEARD_PATH --num-nodes 1"
35+
$cmd || error_exit
2836
}
2937

3038
stop_node() {
@@ -61,8 +69,9 @@ wait_for_block() {
6169
}
6270

6371
# Start NEAR node.
72+
download_neard
6473
start_node
65-
sleep 2
74+
sleep 3
6675

6776
export NEAR_KEY_PATH=$NODE_KEY_PATH
6877
# Create an account for Aurora EVM.

scripts/simple.sh

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,29 @@ AURORA_SECRET_KEY=27cb3ddbd18037b38d7fb9ae3433a9d6f5cd554a4ba5768c8a15053f688ee1
1919
ENGINE_ACCOUNT=aurora.node0
2020
MANAGER_ACCOUNT=key-manager.aurora.node0
2121
VENV=/tmp/venv
22+
NEARD_PATH="$HOME/.nearup/near/localnet"
23+
NEARD_VERSION=2.6.5
2224

2325
export PATH="$HOME/NearProtocol/aurora/aurora-cli-rs/target/debug/:$PATH:$USER_BASE_BIN"
2426

25-
2627
# Install `nearup` utility if not installed before.
2728
python3 -m venv $VENV
2829
source $VENV/bin/activate
2930
pip list | grep nearup > /dev/null || pip install nearup > /dev/null
3031

31-
start_node() {
32-
cmd="nearup run localnet --home $NEARCORE_HOME"
33-
34-
if [[ $(uname -m) == "arm64" ]]; then # Check for local execution
35-
cmd="$cmd --binary-path $HOME/.nearup/near/localnet --num-nodes 1"
32+
download_neard() {
33+
if [[ ! -f $NEARD_PATH/neard ]]; then
34+
mkdir -p $NEARD_PATH
35+
url="https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/$(uname)-$(uname -m)/$NEARD_VERSION/neard.tar.gz"
36+
curl -s $url -o $NEARD_PATH/neard.tar.gz || error_exit
37+
tar xvzf $NEARD_PATH/neard.tar.gz -C $NEARD_PATH --strip-components 1
38+
chmod +x $NEARD_PATH/neard
3639
fi
40+
}
3741

38-
$cmd > /dev/null 2>&1
42+
start_node() {
43+
cmd="nearup run localnet --home $NEARCORE_HOME --binary-path $NEARD_PATH --num-nodes 1"
44+
$cmd || error_exit
3945
}
4046

4147
stop_node() {
@@ -72,8 +78,9 @@ wait_for_block() {
7278
}
7379

7480
# Start NEAR node.
81+
download_neard
7582
start_node
76-
wait_for_block
83+
sleep 3
7784

7885
# Download Aurora EVM.
7986
curl -sL $ENGINE_PREV_WASM_URL -o $ENGINE_WASM_PATH || error_exit

0 commit comments

Comments
 (0)