memgraph/tests/setup.sh
Marko Barišić b0cdcd3483
Run CI in mgbuilder containers (#1749)
* Update deployment files for mgbuilders because of toolchain upgrade
* Fix args parameter in builder yaml files
* Add fedora 38, 39 and rockylinux 9.3 mgbuilder Dockerfiles
* Change format of ARG TOOLCHAIN_VERSION from toolchain-vX to vX
* Add function to check supported arch, build type, os and toolchain
* Add options to init subcommand
* Add image names to mgbuilders
* Add v2 of the run.sh script
* Add testing to run2.sh
* Add option for threads --thread
* Add options for enterprise license and organization name
* Make stop mgbuild container step run always
* Add --ci flag to init script
* Move init conditionals under build-memgraph flags
* Add --community flag to build-memgraph
* Change target dir inside mgbuild container
* Add node fix to debian 11, ubuntu 20.04 and ubuntu 22.04
* rm memgraph repo after installing deps
* Add mg user in Dockerfile
* Add step to install rust on all OSs
* Chown files copied into mgbuild container
* Add e2e tests
* Add jepsen test
* Bugfix: Using reference in a callback
* Bugfix: Broad target for e2e tests
* Up db info test limit
* Disable e2e streams tests
* Fix default THREADS
* Prioretize docker compose over docker-compose
* Improve selection between docker compose and docker-compose
* Install PyYAML as mg user
* Fix doxygen install for rocky linux 9.3
* Fix rocky-9.3 environment script to properly install sbcl
* Rename all rocky-9 mentions to rocky-9.3
* Add mgdeps-cache and benchgraph-api hostnames to mgbuild images
* Add logic to pull mgbuild image if missing
* Fix build errors on toolchain-v5 (#1806)
* Rename run2 script, remove run script, add small features to mgbuild.sh
* Add --no-copy flag to build-memgraph to resolve TODO
* Add timeouts to diff jobs
* Fix asio flaky clone, try mgdeps-cache first

---------

Co-authored-by: Andreja Tonev <andreja.tonev@memgraph.io>
Co-authored-by: Ante Pušić <ante.f.pusic@gmail.com>
Co-authored-by: antoniofilipovic <filipovicantonio1998@gmail.com>
2024-03-14 12:19:59 +01:00

97 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# shellcheck disable=1091
set -Eeuo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"
PIP_DEPS=(
"behave==1.2.6"
"ldap3==2.6"
"kafka-python==2.0.2"
"requests==2.25.1"
"neo4j-driver==4.1.1"
"parse==1.18.0"
"parse-type==0.5.2"
"pytest==7.3.2"
"pyyaml==6.0.1"
"six==1.15.0"
"networkx==2.4"
"gqlalchemy==1.3.3"
)
# Remove old and create a new virtualenv.
if [ -d ve3 ]; then
rm -rf ve3
fi
virtualenv -p python3 ve3
set +u
source "ve3/bin/activate"
set -u
# https://docs.python.org/3/library/sys.html#sys.version_info
PYTHON_MINOR=$(python3 -c 'import sys; print(sys.version_info[:][1])')
# install pulsar-client
pip --timeout 1000 install "pulsar-client==3.1.0"
for pkg in "${PIP_DEPS[@]}"; do
pip --timeout 1000 install "$pkg"
done
pip --timeout 1000 install "networkx==2.4"
# Install mgclient from source becasue of full flexibility.
pushd "$DIR/../libs/pymgclient" > /dev/null
export MGCLIENT_INCLUDE_DIR="$DIR/../libs/mgclient/include"
export MGCLIENT_LIB_DIR="$DIR/../libs/mgclient/lib"
CFLAGS="-std=c99" python3 setup.py build
CFLAGS="-std=c99" python3 setup.py install
popd > /dev/null
deactivate
"$DIR"/e2e/graphql/setup.sh
# Check if setup needs to setup additional variables
if [ $# == 1 ]; then
toolchain=$1
if [ -f "$toolchain" ]; then
# Get the LD_LIB from toolchain
set +u
OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
source $toolchain
NEW_LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"../libs/mgclient/lib"
deactivate
set -u
# Wrapper used to setup the correct libraries
tee -a ve3/bin/activate_e2e <<EOF
#!/bin/bash
# Function to set the environment variable
set_env_variable() {
export LD_LIBRARY_PATH=$NEW_LD_LIBRARY_PATH
}
# Function to activate the virtual environment and set the environment variable
activate_e2e() {
source ve3/bin/activate
set_env_variable
}
# Function to deactivate the virtual environment and unset the environment variable
deactivate_e2e() {
deactivate
export LD_LIBRARY_PATH=$OLD_LD_LIBRARY_PATH
}
# Activate the virtual environment and set the environment variable
activate_e2e
EOF
chmod +x ve3/bin/activate_e2e
else
echo "Error: The toolchain virtual enviroonment activation is not a file."
fi
fi