Skip to content

Instantly share code, notes, and snippets.

@cvvergara
Created February 14, 2017 00:00
Show Gist options
  • Save cvvergara/752a267cd97e32030a27108e85871ea4 to your computer and use it in GitHub Desktop.
Save cvvergara/752a267cd97e32030a27108e85871ea4 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [[ -z $1 ]]; then
echo "Mayor missing";
exit 1;
fi
if [[ -z $2 ]]; then
echo "Minor missing";
exit 1;
fi
if [[ -z $3 ]]; then
echo "Last Micro missing";
exit 1;
fi
MAYOR=$1
MINOR=$2
MICRO=0
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
echo "Branch: $BRANCH";
if [[ "release/$1.$2" == "$BRANCH" ]]; then
echo "already in branch $BRANCH";
else
echo "creating branch";
git checkout release/$MAYOR.$MINOR
fi
#---------------------------------------------------------------------
# Verify typos
#---------------------------------------------------------------------
sh tools/scripts/fix_typos.sh
if [[ $? != 0 ]]; then
echo "FATAL: Typos were found"
exit 1
else
echo "Typos checked: OK"
fi
echo "Checking NEWS file"
CURRENTNEWS=$(grep $MAYOR.$MINOR.$MICRO NEWS)
if [[ $? != 0 ]]; then
echo "FATAL: Current $MAYOR.$MINOR.$MICRO in NEWS file are missing"
exit 1
else
echo " Current news: OK"
fi
OLDNEWS=$(grep $3 NEWS)
if [[ $? != 0 ]]; then
echo "$3 NEWS are missing in NEWS file"
echo "TODO: Verify the OLD NEWS apply to the current version"
echo "TODO: - Modify code if needed"
echo "TODO: - Copy the old NEWS"
exit 1
else
echo " Last micro news: OK"
fi
echo "Checking release_notes.rst file"
CURRENTNEWS=$(grep $MAYOR.$MINOR.$MICRO doc/src/changelog/release_notes.rst | grep ref)
if [[ $? != 0 ]]; then
echo "FATAL: Current $MAYOR.$MINOR.$MICRO in release_notes.rst file are missing"
exit 1
else
#echo "------------"
#echo " $CURRENTNEWS"
#echo "------------"
echo " Current release notes: OK"
fi
OLDNEWS=$(grep $3 doc/src/changelog/release_notes.rst | grep ref)
if [[ $? != 0 ]]; then
echo "$3 NEWS are missing in release_notes.rst file"
echo "TODO: Verify the OLD NEWS apply to the current version"
echo "TODO: - Modify code if needed"
echo "TODO: - Copy the old NEWS"
exit 1
else
#echo "------------"
#echo " $OLDNEWS"
#echo "------------"
echo " Last micro release_notes: OK"
fi
echo "Checking index.rst file"
CURRENTNEWS=$(grep $MAYOR.$MINOR.$MICRO doc/index.rst | grep ref)
if [[ $? != 0 ]]; then
echo "FATAL: Current $MAYOR.$MINOR.$MICRO in index.rst file are missing"
exit 1
else
#echo "------------"
#echo " $CURRENTNEWS"
#echo "------------"
echo " Current index reference: OK"
fi
OLDNEWS=$(grep $3 doc/index.rst | grep ref)
if [[ $? != 0 ]]; then
echo "$3 NEWS are missing in index.rst file"
echo "TODO: Verify the OLD NEWS apply to the current version"
echo "TODO: - Modify code if needed"
echo "TODO: - Copy the old NEWS"
exit 1
else
#echo "------------"
#echo " $OLDNEWS"
#echo "------------"
echo " Last micro index reference: OK"
fi
#---------------------------------------------------------------------
echo "Checking version information"
if [[ $(cat CMakeLists.txt | grep 'set(PGROUTING_VERSION_MAJOR' | grep $MAYOR) != "set(PGROUTING_VERSION_MAJOR \"$MAYOR\")" ]]; then
echo "FATAL: PGROUTING_VERSION_MAJOR is not $MAYOR"
exit 1
else
echo " MAYOR: OK"
fi
if [[ $(cat CMakeLists.txt | grep 'set(PGROUTING_VERSION_MINOR' | grep $MINOR) != "set(PGROUTING_VERSION_MINOR \"$MINOR\")" ]]; then
echo "FATAL: PGROUTING_VERSION_MINOR is not $MINOR"
exit 1
else
echo " MINOR: OK"
fi
if [[ $(cat CMakeLists.txt | grep 'set(PGROUTING_VERSION_PATCH' | grep $MICRO) != "set(PGROUTING_VERSION_PATCH \"$MICRO\")" ]]; then
echo "FATAL: PGROUTING_VERSION_PATCH is not $MICRO"
exit 1
else
echo " PATCH: OK"
fi
if [[ $(cat doc/test/utilities-any.result | grep "$MAYOR.$MINOR.$MICRO") != "$MAYOR.$MINOR.$MICRO" ]]; then
echo "FATAL: doc/test/utilities-any.result is not $MAYOR.$MINOR.$MICRO"
exit 1
else
echo " pgr_version result in doc/test/utilities-any.result file: OK"
fi
if [[ $(cat VERSION | grep "$MAYOR.$MINOR") != *"release/$MAYOR.$MINOR" ]]; then
echo "FATAL: VERSION branch should be release/$MAYOR.$MINOR"
exit 1
else
echo " VERSION file branch: OK"
fi
#---------------------------------------------------------------------
function test_file {
if [ -f tools/sigs/pgrouting--$1.sig ]
then
echo " tools/sigs/pgrouting--$1.sig: OK"
else
echo " FATAL: tools/sigs/pgrouting--$1.sig Not found"
fi
}
echo "Checking signature files"
test_file 2.3.2
test_file 2.3.1
test_file 2.3.0
test_file 2.2.4
test_file 2.2.3
test_file 2.2.2
test_file 2.2.1
test_file 2.2.0
test_file 2.1.0
test_file 2.0.1
test_file 2.0.0
#---------------------------------------------------------------------
#clean build
#---------------------------------------------------------------------
sudo rm -f /usr/lib/postgresql/9.3/lib/libpgrouting-2.4.so
sudo rm -f /usr/share/postgresql/9.3/extension/pgrouting*2.4.0*
#---------------------------------------------------------------------
# Building as Debug
#---------------------------------------------------------------------
#cd build
#rm -rf ./*
#cmake -DWITH_DOC=ON -DBUILD_DOXY=ON -DCMAKE_BUILD_TYPE=Debug ..
#make
#sudo make install
#cd ..
#bash tools/testers/update-tester.sh
#echo "Testing as Debug: OK"
#---------------------------------------------------------------------
# Building as Release
#---------------------------------------------------------------------
cd build
cmake -DWITH_DOC=ON -DBUILD_DOXY=ON -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install
make doc
make doxy
cd ..
#---------------------------------------------------------------------
# Building as Release
#---------------------------------------------------------------------
bash tools/testers/update-tester.sh
if [[ $? != 0 ]]; then
echo "FATAL on the update-tester"
exit 1
fi
tools/testers/algorithm-tester.pl -alg common
if [[ $? != 0 ]]; then
echo "FATAL errors found checking common"
exit 1
fi
tools/testers/algorithm-tester.pl -documentation
if [[ $? != 0 ]]; then
echo "FATAL errors found generating documentation result files"
exit 1
fi
if [[ $(git status | grep 'Changes not staged for commit:') ]]; then
echo "FATAL: at least one result file changed"
echo "TODO: tools/testers/algorithm-tester.pl -documentation"
echo "verify and change manualy to correct results"
exit 1
fi
dropdb --if-exists ___pgr___test___
createdb ___pgr___test___
sh ./tools/testers/pg_prove_tests.sh vicky
if [[ $? != 0 ]]; then
echo "FATAL errors found generating documentation result files"
exit 1
fi
dropdb ___pgr___test___
tools/testers/algorithm-tester.pl
if [[ $? != 0 ]]; then
echo "FATAL: errors found on documentation tests"
exit 1
fi
echo "End of code"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment