|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# ------------------------------------------------------------------------------ |
| 4 | +# This file is part of solidity. |
| 5 | +# |
| 6 | +# solidity is free software: you can redistribute it and/or modify |
| 7 | +# it under the terms of the GNU General Public License as published by |
| 8 | +# the Free Software Foundation, either version 3 of the License, or |
| 9 | +# (at your option) any later version. |
| 10 | +# |
| 11 | +# solidity is distributed in the hope that it will be useful, |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | +# GNU General Public License for more details. |
| 15 | +# |
| 16 | +# You should have received a copy of the GNU General Public License |
| 17 | +# along with solidity. If not, see <http://www.gnu.org/licenses/> |
| 18 | +# |
| 19 | +# (c) 2022 solidity contributors. |
| 20 | +#------------------------------------------------------------------------------ |
| 21 | + |
| 22 | +set -e |
| 23 | + |
| 24 | +source scripts/common.sh |
| 25 | +source test/externalTests/common.sh |
| 26 | + |
| 27 | +verify_input "$@" |
| 28 | +BINARY_TYPE="$1" |
| 29 | +BINARY_PATH="$2" |
| 30 | + |
| 31 | +function compile_fn { npm run compile; } |
| 32 | +function test_fn { npm run test; } |
| 33 | + |
| 34 | +function bleeps_test |
| 35 | +{ |
| 36 | + local repo="https://github.com/wighawag/bleeps" |
| 37 | + local ref_type=tag |
| 38 | + local ref=bleeps_migrations # TODO: There's a 0.4.19 contract in 'main' that would need patching for the latest compiler. |
| 39 | + local config_file="hardhat.config.ts" |
| 40 | + local config_var=config |
| 41 | + |
| 42 | + local compile_only_presets=() |
| 43 | + local settings_presets=( |
| 44 | + "${compile_only_presets[@]}" |
| 45 | + #ir-no-optimize # Compilation fails with: "YulException: Variable param_0 is 2 slot(s) too deep inside the stack." |
| 46 | + #ir-optimize-evm-only # Compilation fails with: "YulException: Variable param_0 is 2 slot(s) too deep inside the stack." |
| 47 | + ir-optimize-evm+yul |
| 48 | + #legacy-no-optimize # Compilation fails with: "CompilerError: Stack too deep, try removing local variables." |
| 49 | + #legacy-optimize-evm-only # Compilation fails with: "CompilerError: Stack too deep, try removing local variables." |
| 50 | + legacy-optimize-evm+yul |
| 51 | + ) |
| 52 | + |
| 53 | + [[ $SELECTED_PRESETS != "" ]] || SELECTED_PRESETS=$(circleci_select_steps_multiarg "${settings_presets[@]}") |
| 54 | + print_presets_or_exit "$SELECTED_PRESETS" |
| 55 | + |
| 56 | + setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH" |
| 57 | + download_project "$repo" "$ref_type" "$ref" "$DIR" |
| 58 | + |
| 59 | + pushd "common-lib/" |
| 60 | + neutralize_package_json_hooks |
| 61 | + npm install |
| 62 | + npm run build |
| 63 | + popd |
| 64 | + |
| 65 | + pushd "contracts/" |
| 66 | + sed -i 's|"bleeps-common": "workspace:\*",|"bleeps-common": "file:../common-lib/",|g' package.json |
| 67 | + |
| 68 | + neutralize_package_lock |
| 69 | + neutralize_package_json_hooks |
| 70 | + force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH" |
| 71 | + force_hardhat_compiler_settings "$config_file" "$(first_word "$SELECTED_PRESETS")" "$config_var" |
| 72 | + npm install npm-run-all |
| 73 | + npm install |
| 74 | + |
| 75 | + replace_version_pragmas |
| 76 | + |
| 77 | + for preset in $SELECTED_PRESETS; do |
| 78 | + hardhat_run_test "$config_file" "$preset" "${compile_only_presets[*]}" compile_fn test_fn "$config_var" |
| 79 | + done |
| 80 | + |
| 81 | + popd |
| 82 | +} |
| 83 | + |
| 84 | +external_test Bleeps bleeps_test |
0 commit comments