46 lines
952 B
Bash
Executable File
46 lines
952 B
Bash
Executable File
#!/bin/bash
|
|
|
|
_help() {
|
|
cat <<EOF
|
|
Usage: ./build.sh [-h|-t|-b|-r]
|
|
h Help : shows this command
|
|
f Full : Runs all available tests including the cargo ones
|
|
t Test : Runs All tests from cargo tests to client tests
|
|
T Test Realse : Runs tests against release build
|
|
b Build : Builds dev build with 'cargo build'
|
|
r Release : Builds release build with --release flag
|
|
EOF
|
|
}
|
|
|
|
[[ -z $1 ]] && _help && exit 0
|
|
|
|
diesel database reset
|
|
export CARGO_BIN=$HOME/.cargo/bin/cargo
|
|
full=
|
|
|
|
testing() {
|
|
release_opt=$1
|
|
cargo build $release_opt
|
|
cargo run $release_opt -- -s &
|
|
server=$!
|
|
echo Waiting on server to spin up && sleep 2
|
|
|
|
python3 client-tests/client.py
|
|
kill -9 $server 2> /dev/null
|
|
if [ ! -z $full ];then
|
|
cargo test $release_opt
|
|
fi
|
|
}
|
|
|
|
while getopts ":fhtTbr" arg; do
|
|
case ${arg} in
|
|
f) full=true;;
|
|
h) echo help command;;
|
|
t) testing;;
|
|
T) testing --release;;
|
|
b) cargo build;;
|
|
r) cargo build --release;;
|
|
*) _help;;
|
|
esac
|
|
done
|