From 8a9fdef90868f6c6089210cb5dbd522cc9f73699 Mon Sep 17 00:00:00 2001 From: Johan Viklund Date: Fri, 6 Apr 2018 11:20:45 +0200 Subject: [PATCH 1/3] Only run patch test for non-master branches --- test/travis_script.sh | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/test/travis_script.sh b/test/travis_script.sh index 34f904dc0..c8ed66487 100755 --- a/test/travis_script.sh +++ b/test/travis_script.sh @@ -11,18 +11,20 @@ echo "SETTINGS" cat settings.json echo "/SETTINGS" -echo ">>> Test 1. The SQL Patch" - -git fetch origin refs/heads/master:master -git show master:sql/swefreq.sql > master-schema.sql - -mysql -u swefreq -h 127.0.0.1 -P 3366 swefreq_test < master-schema.sql -mysql -u swefreq -h 127.0.0.1 -P 3366 swefreq_test < sql/patch-master-db.sql -# Empty the database -mysql -u swefreq -h 127.0.0.1 -P 3366 swefreq_test <<__END__ -DROP DATABASE swefreq_test; -CREATE DATABASE swefreq_test; -__END__ +echo ">>> Test 1. The SQL Patch ($TRAVIS_BRANCH)" + +if [ "$TRAVIS_BRANCH" == "master" ]; then + git fetch origin refs/heads/master:master + git show master:sql/swefreq.sql > master-schema.sql + + mysql -u swefreq -h 127.0.0.1 -P 3366 swefreq_test < master-schema.sql + mysql -u swefreq -h 127.0.0.1 -P 3366 swefreq_test < sql/patch-master-db.sql + # Empty the database + mysql -u swefreq -h 127.0.0.1 -P 3366 swefreq_test <<__END__ + DROP DATABASE swefreq_test; + CREATE DATABASE swefreq_test; + __END__ +fi echo ">>> Test 2. Load the swefreq schema" From 4f46b3b7fbfc448ac09c775ceb4eca2b2d246441 Mon Sep 17 00:00:00 2001 From: Johan Viklund Date: Fri, 6 Apr 2018 11:21:31 +0200 Subject: [PATCH 2/3] It should be not-equals not equals --- test/travis_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/travis_script.sh b/test/travis_script.sh index c8ed66487..2df57334b 100755 --- a/test/travis_script.sh +++ b/test/travis_script.sh @@ -13,7 +13,7 @@ echo "/SETTINGS" echo ">>> Test 1. The SQL Patch ($TRAVIS_BRANCH)" -if [ "$TRAVIS_BRANCH" == "master" ]; then +if [ "$TRAVIS_BRANCH" != "master" ]; then git fetch origin refs/heads/master:master git show master:sql/swefreq.sql > master-schema.sql From 344289d574588024a2b447b24af17bee11558245 Mon Sep 17 00:00:00 2001 From: Johan Viklund Date: Fri, 6 Apr 2018 11:35:44 +0200 Subject: [PATCH 3/3] Check patch against the latest release instead --- test/travis_script.sh | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/test/travis_script.sh b/test/travis_script.sh index 2df57334b..2ec534f29 100755 --- a/test/travis_script.sh +++ b/test/travis_script.sh @@ -11,20 +11,18 @@ echo "SETTINGS" cat settings.json echo "/SETTINGS" -echo ">>> Test 1. The SQL Patch ($TRAVIS_BRANCH)" - -if [ "$TRAVIS_BRANCH" != "master" ]; then - git fetch origin refs/heads/master:master - git show master:sql/swefreq.sql > master-schema.sql - - mysql -u swefreq -h 127.0.0.1 -P 3366 swefreq_test < master-schema.sql - mysql -u swefreq -h 127.0.0.1 -P 3366 swefreq_test < sql/patch-master-db.sql - # Empty the database - mysql -u swefreq -h 127.0.0.1 -P 3366 swefreq_test <<__END__ - DROP DATABASE swefreq_test; - CREATE DATABASE swefreq_test; - __END__ -fi +echo ">>> Test 1. The SQL Patch" + +LATEST_RELEASE=$(git tag | grep '^v' | sort -V | tail -n 1) +git show ${LATEST_RELEASE}:sql/swefreq.sql > master-schema.sql + +mysql -u swefreq -h 127.0.0.1 -P 3366 swefreq_test < master-schema.sql +mysql -u swefreq -h 127.0.0.1 -P 3366 swefreq_test < sql/patch-master-db.sql +# Empty the database +mysql -u swefreq -h 127.0.0.1 -P 3366 swefreq_test <<__END__ +DROP DATABASE swefreq_test; +CREATE DATABASE swefreq_test; +__END__ echo ">>> Test 2. Load the swefreq schema"