freechat/server-api/build.sh
2020-10-21 22:32:43 -07:00

34 lines
709 B
Bash
Executable File

#!/bin/bash
_help() {
cat <<EOF
Usage: ./build.sh [-h|-t|-b|-r]
h Help : shows this command
t Test : Runs All tests from cargo tests to client tests
b Build : Builds dev build with 'cargo build'
r Release : Builds release build with --release flag
EOF
}
[[ -z $1 ]] && _help && exit 0
while getopts ":htbr" arg; do
case ${arg} in
h)echo help command;;
t)
cargo build 1>/dev/null 2>&1
cargo test 1>/dev/null 2>&1
cargo run -- -s &
server=$!
echo Waiting on server to spin up && sleep 2
export CARGO_BIN=$HOME/.cargo/bin/cargo
python3 client-tests/client.py > 'test.log'
kill -9 $server
;;
b)cargo build;;
r)cargo build --release;;
*) _help;;
esac
done