mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
externalTests: Add support for cloning repos at a specific commit
This commit is contained in:
parent
e2fe14b0e4
commit
b60b596741
@ -34,7 +34,8 @@ function test_fn { yarn run test:contracts; }
|
||||
function colony_test
|
||||
{
|
||||
local repo="https://github.com/solidity-external-tests/colonyNetwork.git"
|
||||
local branch=develop_080
|
||||
local ref_type=branch
|
||||
local ref="develop_080"
|
||||
local config_file="truffle.js"
|
||||
|
||||
local compile_only_presets=(
|
||||
@ -54,7 +55,7 @@ function colony_test
|
||||
print_optimizer_presets_or_exit "$selected_optimizer_presets"
|
||||
|
||||
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
||||
download_project "$repo" "$branch" "$DIR"
|
||||
download_project "$repo" "$ref_type" "$ref" "$DIR"
|
||||
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
|
||||
|
||||
neutralize_package_json_hooks
|
||||
|
@ -77,12 +77,24 @@ function setup_solc
|
||||
function download_project
|
||||
{
|
||||
local repo="$1"
|
||||
local solcjs_branch="$2"
|
||||
local test_dir="$3"
|
||||
local ref_type="$2"
|
||||
local solcjs_ref="$3"
|
||||
local test_dir="$4"
|
||||
|
||||
printLog "Cloning $solcjs_branch of $repo..."
|
||||
git clone --depth 1 "$repo" -b "$solcjs_branch" "$test_dir/ext"
|
||||
cd ext
|
||||
[[ $ref_type == commit || $ref_type == branch || $ref_type == tag ]] || assertFail
|
||||
|
||||
printLog "Cloning ${ref_type} ${solcjs_ref} of ${repo}..."
|
||||
if [[ $ref_type == commit ]]; then
|
||||
mkdir ext
|
||||
cd ext
|
||||
git init
|
||||
git remote add origin "$repo"
|
||||
git fetch --depth 1 origin "$solcjs_ref"
|
||||
git reset --hard FETCH_HEAD
|
||||
else
|
||||
git clone --depth 1 "$repo" -b "$solcjs_ref" "$test_dir/ext"
|
||||
cd ext
|
||||
fi
|
||||
echo "Current commit hash: $(git rev-parse HEAD)"
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,8 @@ function test_fn { yarn test; }
|
||||
function ens_test
|
||||
{
|
||||
local repo="https://github.com/ensdomains/ens-contracts.git"
|
||||
local branch="v0.0.8" # The project is in flux right now and master might be too unstable for us
|
||||
local ref_type=tag
|
||||
local ref="v0.0.8" # The project is in flux right now and master might be too unstable for us
|
||||
local config_file="hardhat.config.js"
|
||||
|
||||
local compile_only_presets=(
|
||||
@ -54,7 +55,7 @@ function ens_test
|
||||
print_optimizer_presets_or_exit "$selected_optimizer_presets"
|
||||
|
||||
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
||||
download_project "$repo" "$branch" "$DIR"
|
||||
download_project "$repo" "$ref_type" "$ref" "$DIR"
|
||||
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
|
||||
|
||||
neutralize_package_lock
|
||||
|
@ -34,7 +34,8 @@ function test_fn { npm test; }
|
||||
function gnosis_safe_test
|
||||
{
|
||||
local repo="https://github.com/solidity-external-tests/safe-contracts.git"
|
||||
local branch=v2_080
|
||||
local ref_type=branch
|
||||
local ref="v2_080"
|
||||
local config_file="truffle-config.js"
|
||||
|
||||
local compile_only_presets=(
|
||||
@ -54,7 +55,7 @@ function gnosis_safe_test
|
||||
print_optimizer_presets_or_exit "$selected_optimizer_presets"
|
||||
|
||||
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
||||
download_project "$repo" "$branch" "$DIR"
|
||||
download_project "$repo" "$ref_type" "$ref" "$DIR"
|
||||
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
|
||||
|
||||
sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_080|g' package.json
|
||||
|
@ -34,7 +34,8 @@ function test_fn { npm test; }
|
||||
function gnosis_safe_test
|
||||
{
|
||||
local repo="https://github.com/solidity-external-tests/safe-contracts.git"
|
||||
local branch=development_080
|
||||
local ref_type=branch
|
||||
local ref="development_080"
|
||||
local config_file="truffle-config.js"
|
||||
|
||||
local compile_only_presets=()
|
||||
@ -53,7 +54,7 @@ function gnosis_safe_test
|
||||
print_optimizer_presets_or_exit "$selected_optimizer_presets"
|
||||
|
||||
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
||||
download_project "$repo" "$branch" "$DIR"
|
||||
download_project "$repo" "$ref_type" "$ref" "$DIR"
|
||||
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
|
||||
|
||||
sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_080|g' package.json
|
||||
|
@ -42,7 +42,8 @@ function test_fn {
|
||||
function trident_test
|
||||
{
|
||||
local repo="https://github.com/sushiswap/trident"
|
||||
local branch=master
|
||||
local ref_type=branch
|
||||
local ref="master"
|
||||
local config_file="hardhat.config.ts"
|
||||
local config_var=config
|
||||
|
||||
@ -62,7 +63,7 @@ function trident_test
|
||||
print_optimizer_presets_or_exit "$selected_optimizer_presets"
|
||||
|
||||
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
||||
download_project "$repo" "$branch" "$DIR"
|
||||
download_project "$repo" "$ref_type" "$ref" "$DIR"
|
||||
|
||||
# TODO: Currently tests work only with the exact versions from yarn.lock.
|
||||
# Re-enable this when https://github.com/sushiswap/trident/issues/284 is fixed.
|
||||
|
@ -34,7 +34,8 @@ function test_fn { npm test; }
|
||||
function zeppelin_test
|
||||
{
|
||||
local repo="https://github.com/OpenZeppelin/openzeppelin-contracts.git"
|
||||
local branch=master
|
||||
local ref_type=branch
|
||||
local ref="master"
|
||||
local config_file="hardhat.config.js"
|
||||
|
||||
local compile_only_presets=(
|
||||
@ -54,7 +55,7 @@ function zeppelin_test
|
||||
print_optimizer_presets_or_exit "$selected_optimizer_presets"
|
||||
|
||||
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
||||
download_project "$repo" "$branch" "$DIR"
|
||||
download_project "$repo" "$ref_type" "$ref" "$DIR"
|
||||
|
||||
neutralize_package_json_hooks
|
||||
force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH"
|
||||
|
Loading…
Reference in New Issue
Block a user