Skip to content

Commit

Permalink
style: made shell scripts all have 4 spaces for indentation; fixes #272
Browse files Browse the repository at this point in the history
Signed-off-by: Morgan Rockett <morgan.rockett@tufts.edu>
  • Loading branch information
rockett-m authored and HalosGhost committed Jun 28, 2024
1 parent 9624329 commit d792c5e
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 64 deletions.
47 changes: 24 additions & 23 deletions scripts/install-build-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 10 additions & 10 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,26 @@ 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" \
| grep -E "\..*pp")
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"
48 changes: 24 additions & 24 deletions scripts/setup-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -78,18 +78,18 @@ make INSTALL_TOP=$PREFIX install
cd ..

if [[ "$OSTYPE" != "darwin"* ]]; then
# <NOTE> 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 ../..
# <NOTE> 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"
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions scripts/test-e2e-minikube.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d792c5e

Please sign in to comment.