memgraph/release/examples/build_examples
Teon Banek 939056eac7 Add single node memgraph binary
Summary:
This binary is installed and packaged for release. This is just a quick
solution for releasing the Community 0.10 version. We still need to
setup the installation and packaging for both the Enterprise and
Community versions. Additionally, the automated build system needs to
test both binaries for correct behaviour. Obviously, some tests can only
be run on one of the 2 versions.

Reviewers: mferencevic, buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1363
2018-04-23 14:05:23 +02:00

63 lines
1.3 KiB
Bash
Executable File

#!/bin/bash -e
function print_help () {
echo "Usage: $0 MEMGRAPH_EXE BOLT_CLIENT_EXE"
echo "Build example snapshots using the compiled memgraph."
}
if [[ $# -ne 2 ]]; then
print_help
exit 1
fi
memgraph_exe="$1"
if [[ ! -x ${memgraph_exe} ]]; then
echo "Expected memgraph executable at '${memgraph_exe}'"
exit 1
fi
bolt_client_exe="$2"
if [[ ! -x ${bolt_client_exe} ]]; then
echo "Expected bolt_client executable at '${bolt_client_exe}'"
exit 1
fi
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
build_dir="build"
query="populate.cyp"
cd $script_dir
if [ -d "$build_dir" ]; then
rm -rf "$build_dir"
fi
mkdir "$build_dir"
for dir in queries/*/
do
cd $script_dir # position to script execution dir
dir=${dir%*/}
example=${dir#*/}
# create snapshots directory for each example
snapshots_dir="$build_dir/$example"
mkdir -p "$snapshots_dir"
# run memgraph with durability_directory pointing
# to examples snapshots_dir
${memgraph_exe} --durability-directory "$script_dir/$snapshots_dir/" \
--snapshot-on-exit > /dev/null 2>&1 &
memgraph_pid=$!
sleep 2 # wait for memgraph to start
# create data using bolt-client
${bolt_client_exe} < "$script_dir/$dir/$query" > /dev/null 2>&1 || exit 1
# kill memgraph
kill $memgraph_pid
# wait for memgraph to terminate
wait $memgraph_pid
done