script: test enforced push to master
enforced building and test with a pre-push hook IMPORTANT: cmake is needed in PATH
This commit is contained in:
@@ -7,4 +7,5 @@ Exec=/usr/bin/coati
|
||||
Icon=coati
|
||||
Terminal=true
|
||||
Type=Application
|
||||
MimeType=application/x-coati
|
||||
StartupNotify=true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
MY_PATH=`dirname "$0"`
|
||||
MY_PATH=../$MY_PATH
|
||||
MY_PATH=../$MY_PATH
|
||||
|
||||
echo "Remove coati form system"
|
||||
printf 'enter [y/n] '
|
||||
@@ -16,4 +16,5 @@ rm /usr/share/icons/coati.png
|
||||
rm /usr/share/icons/project-coati.png
|
||||
rm /opt/coati -rf
|
||||
update-mime/database /usr/share/mime
|
||||
update-desktop-database
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ cp $MY_PATH/setup/coati.desktop /usr/share/applications/ > /dev/null
|
||||
cp $MY_PATH/data/gui/icon/logo_1024_1024.png /usr/share/icons/coati.png > /dev/null
|
||||
cp $MY_PATH/data/gui/icon/project_256_256.png /usr/share/icons/project-coati.png > /dev/null
|
||||
update-mime-database /usr/share/mime > /dev/null
|
||||
update-desktop-database > /dev/null
|
||||
|
||||
ln -s /opt/coati/coati.sh /usr/bin/coati > /dev/null
|
||||
ln -s /opt/coati/Coati.sh /usr/bin/coati > /dev/null
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<module>: <title>
|
||||
|
||||
<description>
|
||||
|
||||
# bug id = <id>
|
||||
# review id = <id>
|
||||
|
||||
# fortune cookie message = <message>
|
||||
|
||||
# modules: build, src, logic, ui, data, utility, test, script
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
ABORT="\033[31mAbort:\033[00m"
|
||||
SUCCESS="\033[32mSuccess:\033[00m"
|
||||
INFO="\033[33mInfo:\033[00m"
|
||||
|
||||
BRANCH_NAME=$(git symbolic-ref -q --short HEAD)
|
||||
|
||||
if [ -z $BRANCH_NAME ]
|
||||
then
|
||||
echo -e $ABORT "You are not on any branch."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $BRANCH_NAME == "master" ]
|
||||
then
|
||||
echo -e $ABORT "Commiting to master is prohibited."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $BRANCH_NAME == "public_beta" ]
|
||||
then
|
||||
echo -e $ABORT "Commiting to public_beta is prohibited."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Executable
+91
@@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This hook enforces to run builds and test when pushed to the $protected_branch
|
||||
|
||||
proteced_branches=("forced_tests" "master")
|
||||
|
||||
#proteced_branch='master'
|
||||
current_branch=$(git symbolic-ref -q --short HEAD)
|
||||
|
||||
FAIL="\033[31mFail:\033[00m"
|
||||
PASS="\033[32mPass:\033[00m"
|
||||
INFO="\033[33mInfo:\033[00m"
|
||||
|
||||
ROOTDIR=$(pwd)
|
||||
|
||||
# Determine current platform
|
||||
PLATFORM='unknown'
|
||||
if [ "$(uname)" == "Darwin" ]; then
|
||||
PLATFORM='MacOS'
|
||||
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
|
||||
PLATFORM='Linux'
|
||||
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
|
||||
PLATFORM='Windows'
|
||||
fi
|
||||
|
||||
function build {
|
||||
echo -e $INFO Building $1 \($2\)
|
||||
cmake --build build/$2 --target $1 > /dev/null
|
||||
#output to commandline for debugging
|
||||
#cmake --build build/$2 --target $1
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo -e $PASS Building $1 \($2\) passed
|
||||
else
|
||||
echo -e $FAIL Building $1 \($2\) failed
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function build_type {
|
||||
echo -e $INFO Starting with buildtype: $1
|
||||
if [ "$PLATFORM" == "Windows" ]
|
||||
then
|
||||
echo -e $INFO Builing the Coati VS Solution
|
||||
cmake --build build --config $1 > /dev/null
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo -e $FAIL At least one build or test failed, no push to $branch
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
build Coati $1
|
||||
build Coati_trial $1
|
||||
build Coati_test $1
|
||||
build Coati_license_generator $1
|
||||
run_tests $1
|
||||
fi
|
||||
}
|
||||
|
||||
function run_tests {
|
||||
echo -e $INFO Run $1 Tests
|
||||
|
||||
cd bin/test
|
||||
echo $1/Coati_test
|
||||
$1/Coati_test
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo -e $PASS $1 Tests passed
|
||||
else
|
||||
echo -e $FAIL $1 Tests failed
|
||||
exit 1
|
||||
fi
|
||||
cd $ROOTDIR
|
||||
}
|
||||
|
||||
for branch in "${proteced_branches[@]}"
|
||||
do
|
||||
if [ $current_branch == $branch ]
|
||||
then
|
||||
echo Try to push to $branch
|
||||
echo Run builds and test
|
||||
echo This will take a while
|
||||
# build_type Debug
|
||||
build_type Release
|
||||
echo -e $PASS All builds and tests passed pushing to $branch
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user