summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-01-28 17:45:37 +0100
committerEven Rouault <even.rouault@spatialys.com>2020-01-28 19:15:29 +0100
commit8d75f5040e93c0e31a8c5410887fc95541c1baf1 (patch)
treeb2a9127983b41c8f0a1ca5ef8a8598d4c587a505
parent6de85e3690dab9377205adb2678aa4555a342b3c (diff)
downloadPROJ-data-8d75f5040e93c0e31a8c5410887fc95541c1baf1.tar.gz
PROJ-data-8d75f5040e93c0e31a8c5410887fc95541c1baf1.zip
Add travis/check_new_grids.sh to check new submitted grids
Simulation of adding a bad GeoTIFF file in following log: https://travis-ci.org/rouault/PROJ-data-tmp/builds/643019546
-rw-r--r--.travis.yml1
-rwxr-xr-xtravis/check_new_grids.sh38
2 files changed, 39 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml
index a7bdbd6..7197b06 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,6 +14,7 @@ before_install:
- sudo apt-get install cmake make zip unzip pyflakes3 wget
install:
+ - ./travis/check_new_grids.sh
- cd grid_tools
- pyflakes3 *.py
- wget https://github.com/OSGeo/proj-datumgrid/raw/master/north-america/ntv2_0.gsb
diff --git a/travis/check_new_grids.sh b/travis/check_new_grids.sh
new file mode 100755
index 0000000..c4f78b8
--- /dev/null
+++ b/travis/check_new_grids.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+
+# Verify that grids added or modified in a pull request are conformant
+
+set -eu
+
+if [ -z "$TRAVIS_COMMIT_RANGE" ]; then
+ echo "No commit range given"
+ exit 0
+fi
+
+if [[ -n $TRAVIS_PULL_REQUEST_BRANCH ]]; then
+ # if on a PR, just analyze the changed files
+ echo "TRAVIS PR BRANCH: $TRAVIS_PULL_REQUEST_BRANCH"
+ FILES=$(git diff --diff-filter=AM --name-only $(git merge-base HEAD ${TRAVIS_BRANCH}) | tr '\n' ' ' )
+elif [[ -n $TRAVIS_COMMIT_RANGE ]]; then
+ echo "TRAVIS COMMIT RANGE: $TRAVIS_COMMIT_RANGE"
+ FILES=$(git diff --diff-filter=AM --name-only ${TRAVIS_COMMIT_RANGE/.../..} | tr '\n' ' ' )
+fi
+
+for f in $FILES; do
+ if ! [ -f "$f" ]; then
+ continue
+ fi
+
+ case "$f" in
+ *.tif)
+ ;;
+
+ *)
+ continue
+ ;;
+ esac
+
+ echo "Checking $f"
+ docker run --rm -v /home:/home osgeo/gdal:alpine-normal-latest gdalinfo $PWD/$f
+ docker run --rm -v /home:/home osgeo/gdal:alpine-normal-latest python3 $PWD/grid_tools/check_gtiff_grid.py $PWD/$f
+done