summaryrefslogtreecommitdiff
path: root/travis/check_new_grids.sh
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 /travis/check_new_grids.sh
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
Diffstat (limited to 'travis/check_new_grids.sh')
-rwxr-xr-xtravis/check_new_grids.sh38
1 files changed, 38 insertions, 0 deletions
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