Skip to content

Commit 2b618e7

Browse files
committed
split execute spectests playbook for concurrent execution
1 parent 64fcb9c commit 2b618e7

File tree

1 file changed

+76
-26
lines changed

1 file changed

+76
-26
lines changed

playbooks/dev/execution-spec-tests-execute.yaml

Lines changed: 76 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ config:
1010
seedPrivateKey: ""
1111
seedAmount: "1" # (In Wei). Amount used to seed child accounts for test execution. Can also use "1 ether" or "10000 gwei" as input
1212
extraFlags: ""
13+
runSetup: true
14+
runTests: true
15+
specTestsPath: ""
16+
cleanupTestsPath: true
1317
solcVersion: "0.8.24"
1418
tasks:
1519
- name: generate_child_wallet
@@ -22,8 +26,64 @@ tasks:
2226
prefundMinBalance: "seedAmount"
2327

2428
- name: run_shell
25-
title: "Execute tests: ${gitRepo}@${gitBranch} [${testPath}]"
29+
title: "Clone and prepare execution spec tests: ${gitRepo}@${gitBranch}"
30+
id: setup
31+
if: runSetup
32+
config:
33+
shell: bash
34+
shellArgs: [--login]
35+
envVars:
36+
GIT_REPO: gitRepo
37+
GIT_BRANCH: gitBranch
38+
SOLC_VERSION: "solcVersion"
39+
SPEC_TESTS_PATH: specTestsPath
40+
command: |
41+
set -e
42+
43+
# Convert env vars. They are passed as RAW JSON values
44+
45+
GIT_REPO=$(echo $GIT_REPO | jq -r)
46+
GIT_BRANCH=$(echo $GIT_BRANCH | jq -r)
47+
SOLC_VERSION=$(echo $SOLC_VERSION | jq -r)
48+
SPEC_TESTS_PATH=$(echo $SPEC_TESTS_PATH | jq -r)
49+
50+
# Check if pip (python package manager) is installed
51+
if ! command -v pip &> /dev/null
52+
then
53+
echo "pip could not be found. Please install python3-pip"
54+
exit 1
55+
fi
56+
57+
# Create dir for temp files
58+
if [ -z "$SPEC_TESTS_PATH" ]; then
59+
tmp_dir=$(mktemp -d -t execution-spec-tests-XXXXXXXXXX)
60+
61+
echo "============================"
62+
echo "Temp dir created: ${tmp_dir}"
63+
echo "============================"
64+
65+
echo "::set-var specTestsPath ${tmp_dir}"
66+
fi
67+
68+
echo "============================"
69+
echo "Clone git repo ${GIT_REPO} @ ${GIT_BRANCH}"
70+
echo "============================"
71+
git clone ${GIT_REPO} --branch ${GIT_BRANCH} --single-branch $SPEC_TESTS_PATH
72+
73+
cd $SPEC_TESTS_PATH
74+
export HOME=$SPEC_TESTS_PATH
75+
76+
echo "============================"
77+
echo "Installing dependencies"
78+
echo "============================"
79+
pip install uv
80+
uv sync --all-extras
81+
uv run solc-select use "${SOLC_VERSION}" --always-install
82+
83+
- name: run_shell
84+
title: "Execute tests: [${testPath}]"
2685
id: execute
86+
if: runTests
2787
config:
2888
shell: bash
2989
shellArgs: [--login]
@@ -37,6 +97,8 @@ tasks:
3797
SEED_AMOUNT: seedAmount
3898
EXTRA_FLAGS: extraFlags
3999
SOLC_VERSION: "solcVersion"
100+
SPEC_TESTS_PATH: specTestsPath
101+
CLEANUP_TESTS_PATH: cleanupTestsPath
40102
command: |
41103
set -e
42104
@@ -51,6 +113,8 @@ tasks:
51113
SEED_AMOUNT=$(echo $SEED_AMOUNT | jq -r)
52114
EXTRA_FLAGS=$(echo $EXTRA_FLAGS | jq -r)
53115
SOLC_VERSION=$(echo $SOLC_VERSION | jq -r)
116+
SPEC_TESTS_PATH=$(echo $SPEC_TESTS_PATH | jq -r)
117+
CLEANUP_TESTS_PATH=$(echo $CLEANUP_TESTS_PATH | jq -r)
54118
55119
echo "RPC_ENDPOINT: ${RPC_ENDPOINT}"
56120
echo "CHAIN_ID: ${CHAIN_ID}"
@@ -73,34 +137,20 @@ tasks:
73137
fi
74138
75139
# Create dir for temp files
76-
tmp_dir=$(mktemp -d -t execution-spec-tests-XXXXXXXXXX)
77-
cd $tmp_dir
78-
export HOME=$tmp_dir
79-
echo "============================"
80-
echo "Temp dir created: ${tmp_dir}"
81-
echo "============================"
140+
cd $SPEC_TESTS_PATH
141+
export HOME=$SPEC_TESTS_PATH
82142
83-
function cleanup {
84-
rv=$?
85-
rm -rf "$tmp_dir"
86-
echo "tmpdir removed"
87-
exit $rv
88-
}
143+
if [ "$CLEANUP_TESTS_PATH" == "true" ]; then
144+
function cleanup {
145+
rv=$?
146+
rm -rf "$SPEC_TESTS_PATH"
147+
echo "tmpdir removed"
148+
exit $rv
149+
}
89150
90-
trap cleanup EXIT # always remove tempdir on exit
91-
92-
echo "============================"
93-
echo "Clone git repo ${GIT_REPO} @ ${GIT_BRANCH}"
94-
echo "============================"
95-
git clone ${GIT_REPO} --branch ${GIT_BRANCH} --single-branch
96-
cd execution-spec-tests
151+
trap cleanup EXIT # always remove tempdir on exit
152+
fi
97153
98-
echo "============================"
99-
echo "Installing dependencies"
100-
echo "============================"
101-
pip install uv
102-
uv sync --all-extras
103-
uv run solc-select use "${SOLC_VERSION}" --always-install
104154
source .venv/bin/activate
105155
106156
echo "============================"

0 commit comments

Comments
 (0)