From 150bb1e3063b8961f229d1ee08f58919ef5c61d8 Mon Sep 17 00:00:00 2001 From: Morgan Rockett Date: Thu, 13 Jun 2024 14:05:03 -0400 Subject: [PATCH 1/3] removed references to the deleted scripts/configure.sh file and made replacements Signed-off-by: Morgan Rockett --- .github/workflows/docker-pull.yml | 1 - docs/getting-started.md | 12 ++++++++---- scripts/build.sh | 2 +- scripts/lint.sh | 3 ++- scripts/setup-dependencies.sh | 3 +-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker-pull.yml b/.github/workflows/docker-pull.yml index b2dd161c6..df696b42a 100644 --- a/.github/workflows/docker-pull.yml +++ b/.github/workflows/docker-pull.yml @@ -26,7 +26,6 @@ jobs: with: files: | Dockerfile - **/configure.sh ######################## # Build Base # diff --git a/docs/getting-started.md b/docs/getting-started.md index 6ef9063db..19b0b81f8 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -98,12 +98,15 @@ $ git push --force origin Absolutely! However, we only officially support the included docker compose files (as they mirror our automated test environment). -After cloning the code, ``scripts/configure.sh`` will attempt to configure your environment. +After cloning the code, ``scripts/install-build-tools.sh`` needs to be ran just once. It will attempt to install the necessary software tools upon which the project relies on. -**Note:** ``scripts/configure.sh`` only supports Ubuntu-based linux distributions and macOS (which depends on [Homebrew](https://brew.sh/)). +Then, ``scripts/setup-dependencies.sh`` should be run to install libraries and dependencies +to will attempt to configure your environment. + +**Note:** ``scripts/install-build-tools.sh`` only supports Ubuntu-based linux distributions and macOS (which depends on [Homebrew](https://brew.sh/)). However, it can be used as a guide to understand what you must do to get your environment setup. -In short, ``scripts/configure.sh`` does the following: +In short, ``scripts/install-build-tools.sh`` does the following: * installs a couple packages needed for building and testing (e.g., clang, LLVM, cmake, make, lcov, googletest, git) * installs the external dependencies: @@ -127,7 +130,8 @@ However, here are several things you can do to make review as easy and quick as * Keep your working branch up-to-date with our main branch and free of merge conflicts * Run ``./scripts/lint.sh`` and ``./scripts/test.sh`` and ensure both succeed before committing changes - * You can use a tool like [`act`](https://github.com/nektos/act) to run the CI locally and see if your changes would pass automated-review +* Run ``pylint $(git ls-files '*.py')`` for python code and seek scores close to 10.0. + * You can use a tool like [`act`](https://github.com/nektos/act) to run the CI locally and see if your changes would pass automated-review. ``act --list`` to see workflow jobs. * Author [good commits](#what-does-a-good-commit-look-like) diff --git a/scripts/build.sh b/scripts/build.sh index 879f346e5..90d07991d 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -33,7 +33,7 @@ fi echo "Building..." -# see PREFIX in ./scripts/configure.sh +# see PREFIX in ./scripts/setup-dependencies.sh PREFIX="$(cd "$(dirname "$0")"/.. && pwd)/prefix" if [ -z ${BUILD_DIR+x} ]; then diff --git a/scripts/lint.sh b/scripts/lint.sh index cdc566c98..515ac57b1 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -29,7 +29,8 @@ check_format_files=$(git ls-files | grep -E "tools|tests|src|cmake-tests" \ clang-format --style=file --Werror --dry-run ${check_format_files[@]} if ! command -v clang-tidy &>/dev/null; then - echo "clang-tidy does not appear to be installed. Please run ./scripts/configure.sh to install dependencies or install manually." + echo "clang-tidy does not appear to be installed" + echo "Please run ./scripts/setup-dependencies.sh to install dependencies or install manually." exit 1 fi diff --git a/scripts/setup-dependencies.sh b/scripts/setup-dependencies.sh index 1e20e131b..620eae75c 100755 --- a/scripts/setup-dependencies.sh +++ b/scripts/setup-dependencies.sh @@ -9,8 +9,7 @@ end="\033[0m" set -e # install in a custom prefix rather than /usr/local. by default, this -# chooses "prefix" directory alongside "scripts" where configure.sh -# resides. +# chooses "prefix" directory alongside "scripts" directory. PREFIX="$(cd "$(dirname "$0")"/.. && pwd)/prefix" echo "Will install local dependencies in the following prefix: $PREFIX" From 96243297aa30376be6fa2e27e0d37a5912b93991 Mon Sep 17 00:00:00 2001 From: Michael Maurer Date: Mon, 24 Jun 2024 13:38:40 -0400 Subject: [PATCH 2/3] docs: fix errant instruction in parsec user guide Co-authored-by: Nicole Li Signed-off-by: Michael Maurer --- docs/parsec_user_guide.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/parsec_user_guide.md b/docs/parsec_user_guide.md index 4a7ec7e50..b2304ea50 100644 --- a/docs/parsec_user_guide.md +++ b/docs/parsec_user_guide.md @@ -27,7 +27,8 @@ If you are using MacOS or an Ubuntu-like distribution, you can run the system wi Build and run the system: ```console -$ ./scripts/configure.sh # only necessary on initial setup +# ./scripts/install-build-tools.sh # only necessary on initial setup +$ ./scripts/setup-dependencies.sh # only necessary on initial setup $ ./scripts/build.sh $ ./scripts/parsec-run-local.sh [OPTIONS] # use --help flag for help ``` From d792c5e2f43ae17bf3a62bd01acb9eef240d324b Mon Sep 17 00:00:00 2001 From: Morgan Rockett Date: Tue, 25 Jun 2024 23:27:57 -0400 Subject: [PATCH 3/3] style: made shell scripts all have 4 spaces for indentation; fixes #272 Signed-off-by: Morgan Rockett --- scripts/install-build-tools.sh | 47 +++++++++++++++++---------------- scripts/lint.sh | 20 +++++++------- scripts/setup-dependencies.sh | 48 +++++++++++++++++----------------- scripts/test-e2e-minikube.sh | 14 +++++----- 4 files changed, 65 insertions(+), 64 deletions(-) diff --git a/scripts/install-build-tools.sh b/scripts/install-build-tools.sh index 5a96b4286..592e8929b 100755 --- a/scripts/install-build-tools.sh +++ b/scripts/install-build-tools.sh @@ -15,34 +15,35 @@ if (( $EUID != 0 )); then fi if [[ "$OSTYPE" == "darwin"* ]]; then - CPUS=$(sysctl -n hw.ncpu) - # ensure development environment is set correctly for clang - $SUDO xcode-select -switch /Library/Developer/CommandLineTools - brew install llvm@14 googletest google-benchmark lcov make wget cmake curl - CLANG_TIDY=/usr/local/bin/clang-tidy - if [ ! -L "$CLANG_TIDY" ]; then - $SUDO ln -s $(brew --prefix)/opt/llvm@14/bin/clang-tidy /usr/local/bin/clang-tidy - fi - GMAKE=/usr/local/bin/gmake - if [ ! -L "$GMAKE" ]; then - $SUDO ln -s $(xcode-select -p)/usr/bin/gnumake /usr/local/bin/gmake - fi + CPUS=$(sysctl -n hw.ncpu) + # ensure development environment is set correctly for clang + $SUDO xcode-select -switch /Library/Developer/CommandLineTools + brew install llvm@14 googletest google-benchmark lcov make wget cmake curl + CLANG_TIDY=/usr/local/bin/clang-tidy + if [ ! -L "$CLANG_TIDY" ]; then + $SUDO ln -s $(brew --prefix)/opt/llvm@14/bin/clang-tidy /usr/local/bin/clang-tidy + fi + + GMAKE=/usr/local/bin/gmake + if [ ! -L "$GMAKE" ]; then + $SUDO ln -s $(xcode-select -p)/usr/bin/gnumake /usr/local/bin/gmake + fi fi if [[ "$OSTYPE" == "linux-gnu"* ]]; then - $SUDO apt update - $SUDO apt install -y build-essential wget cmake libgtest-dev libbenchmark-dev lcov git software-properties-common rsync unzip - - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | $SUDO apt-key add - - $SUDO add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main" - $SUDO apt install -y clang-format-14 clang-tidy-14 - $SUDO ln -s -f $(which clang-format-14) /usr/local/bin/clang-format - $SUDO ln -s -f $(which clang-tidy-14) /usr/local/bin/clang-tidy + $SUDO apt update + $SUDO apt install -y build-essential wget cmake libgtest-dev libbenchmark-dev lcov git software-properties-common rsync unzip + + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | $SUDO apt-key add - + $SUDO add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main" + $SUDO apt install -y clang-format-14 clang-tidy-14 + $SUDO ln -s -f $(which clang-format-14) /usr/local/bin/clang-format + $SUDO ln -s -f $(which clang-tidy-14) /usr/local/bin/clang-tidy fi PYTHON_TIDY=/usr/local/bin/run-clang-tidy.py if [ ! -f "${PYTHON_TIDY}" ]; then - echo -e "${green}Copying run-clang-tidy to /usr/local/bin${end}" - wget https://raw.githubusercontent.com/llvm/llvm-project/e837ce2a32369b2e9e8e5d60270c072c7dd63827/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py - $SUDO mv run-clang-tidy.py /usr/local/bin + echo -e "${green}Copying run-clang-tidy to /usr/local/bin${end}" + wget https://raw.githubusercontent.com/llvm/llvm-project/e837ce2a32369b2e9e8e5d60270c072c7dd63827/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py + $SUDO mv run-clang-tidy.py /usr/local/bin fi diff --git a/scripts/lint.sh b/scripts/lint.sh index 515ac57b1..dbabe0ce1 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -21,7 +21,7 @@ if [ -n "$newline_files" ] ; then fi if [ -n "$whitespace_files" ] || [ -n "$newline_files" ] ; then - exit 1 + exit 1 fi check_format_files=$(git ls-files | grep -E "tools|tests|src|cmake-tests" \ @@ -29,18 +29,18 @@ check_format_files=$(git ls-files | grep -E "tools|tests|src|cmake-tests" \ clang-format --style=file --Werror --dry-run ${check_format_files[@]} if ! command -v clang-tidy &>/dev/null; then - echo "clang-tidy does not appear to be installed" - echo "Please run ./scripts/setup-dependencies.sh to install dependencies or install manually." - exit 1 + echo "clang-tidy does not appear to be installed" + echo "Please run ./scripts/setup-dependencies.sh to install dependencies or install manually." + exit 1 fi if [ -z ${BUILD_DIR+x} ]; then - echo "BUILD_DIR environment variable not found. Assuming default: build" - export BUILD_DIR=build - if [ ! -d "${BUILD_DIR}" ]; then - echo "${BUILD_DIR} directory not found. Please set BUILD_DIR or run \`export BUILD_DIR=${BUILD_DIR}; build.sh\` before linting." - exit 1 - fi + echo "BUILD_DIR environment variable not found. Assuming default: build" + export BUILD_DIR=build + if [ ! -d "${BUILD_DIR}" ]; then + echo "${BUILD_DIR} directory not found. Please set BUILD_DIR or run \`export BUILD_DIR=${BUILD_DIR}; build.sh\` before linting." + exit 1 + fi fi python3 /usr/local/bin/run-clang-tidy.py -p ${BUILD_DIR} "tests/.*/.*\.cpp|src/.*/.*\.cpp|tools/.*/.*\.cpp" diff --git a/scripts/setup-dependencies.sh b/scripts/setup-dependencies.sh index 620eae75c..1dfdf50a7 100755 --- a/scripts/setup-dependencies.sh +++ b/scripts/setup-dependencies.sh @@ -17,14 +17,14 @@ mkdir -p $PREFIX $PREFIX/lib $PREFIX/include CMAKE_BUILD_TYPE="Debug" if [[ "$BUILD_RELEASE" == "1" ]]; then - CMAKE_BUILD_TYPE="Release" + CMAKE_BUILD_TYPE="Release" fi CPUS=1 if [[ "$OSTYPE" == "linux-gnu"* ]]; then - CPUS=$(grep -c ^processor /proc/cpuinfo) + CPUS=$(grep -c ^processor /proc/cpuinfo) elif [[ "$OSTYPE" == "darwin"* ]]; then - CPUS=$(sysctl -n hw.ncpu) + CPUS=$(sysctl -n hw.ncpu) fi LEVELDB_VERSION="1.23" @@ -50,12 +50,12 @@ mv NuRaft-${NURAFT_VERSION} "NuRaft-${NURAFT_VERSION}-${CMAKE_BUILD_TYPE}" cd "NuRaft-${NURAFT_VERSION}-${CMAKE_BUILD_TYPE}" ./prepare.sh if [[ "$BUILD_RELEASE" == "1" ]]; then - # If we're doing a release build, remove the examples and tests - rm -rf examples tests - mkdir examples - mkdir tests - touch examples/CMakeLists.txt - touch tests/CMakeLists.txt + # If we're doing a release build, remove the examples and tests + rm -rf examples tests + mkdir examples + mkdir tests + touch examples/CMakeLists.txt + touch tests/CMakeLists.txt fi mkdir -p build cd build @@ -78,18 +78,18 @@ make INSTALL_TOP=$PREFIX install cd .. if [[ "$OSTYPE" != "darwin"* ]]; then - # For Mac Silicon: this curl install creates problems for building tools/bench/parsec/evm/ - CURL_VERSION="7.83.1" - wget https://curl.se/download/curl-${CURL_VERSION}.tar.gz - rm -rf curl-${CURL_VERSION} - tar xzvf curl-${CURL_VERSION}.tar.gz - rm -rf curl-${CURL_VERSION}.tar.gz - mkdir -p curl-${CURL_VERSION}/build - cd curl-${CURL_VERSION}/build - ../configure --prefix="${PREFIX}" --disable-shared --without-ssl --without-libpsl --without-libidn2 --without-brotli --without-zstd --without-zlib - make -j$CPUS - make install - cd ../.. + # For Mac Silicon: this curl install creates problems for building tools/bench/parsec/evm/ + CURL_VERSION="7.83.1" + wget https://curl.se/download/curl-${CURL_VERSION}.tar.gz + rm -rf curl-${CURL_VERSION} + tar xzvf curl-${CURL_VERSION}.tar.gz + rm -rf curl-${CURL_VERSION}.tar.gz + mkdir -p curl-${CURL_VERSION}/build + cd curl-${CURL_VERSION}/build + ../configure --prefix="${PREFIX}" --disable-shared --without-ssl --without-libpsl --without-libidn2 --without-brotli --without-zstd --without-zlib + make -j$CPUS + make install + cd ../.. fi JSONCPP_VERSION="1.9.5" @@ -130,10 +130,10 @@ rm -rf evmc mv ../evmc-${EVMC_VER} ./evmc mkdir ./evmc/.git if [[ "$OSTYPE" == "darwin"* ]]; then - # Mac Silicon: clang 'ar' does not allow empty member list, fails w/ -DBUILD_SHARED_LIBS=OFF - cmake -S . -B build -DCMAKE_INSTALL_PREFIX="${PREFIX}" + # Mac Silicon: clang 'ar' does not allow empty member list, fails w/ -DBUILD_SHARED_LIBS=OFF + cmake -S . -B build -DCMAKE_INSTALL_PREFIX="${PREFIX}" else - cmake -S . -B build -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="${PREFIX}" + cmake -S . -B build -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="${PREFIX}" fi cmake --build build --parallel cd build diff --git a/scripts/test-e2e-minikube.sh b/scripts/test-e2e-minikube.sh index e4135bc5b..d25900163 100755 --- a/scripts/test-e2e-minikube.sh +++ b/scripts/test-e2e-minikube.sh @@ -8,19 +8,19 @@ BUILD_DOCKER=${TESTRUN_BUILD_DOCKER:-1} # Make sure we have the necessary tools installed required_executables=(minikube docker go helm kubectl) for e in ${required_executables[@]}; do - if ! command -v $e &> /dev/null; then - echo "'$e' command not be found! This is required to run. Please install it." - exit 1 - fi + if ! command -v $e &> /dev/null; then + echo "'$e' command not be found! This is required to run. Please install it." + exit 1 + fi done # Start minikube cluster with opencbdc profile minikube_status=$(minikube -p $MINIKUBE_PROFILE status | grep apiserver | awk '{ print $2 }') if [ "$minikube_status" != "Running" ]; then - echo "🔄 Starting minkube cluster with profile '$MINIKUBE_PROFILE'..." - minikube -p $MINIKUBE_PROFILE start + echo "🔄 Starting minkube cluster with profile '$MINIKUBE_PROFILE'..." + minikube -p $MINIKUBE_PROFILE start else - echo "✅ minikube cluster with profile '$MINIKUBE_PROFILE' is currently running." + echo "✅ minikube cluster with profile '$MINIKUBE_PROFILE' is currently running." fi # Update Kubernetes context to default to this minikube cluster profile