summaryrefslogtreecommitdiff
path: root/travis
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-01-29 12:54:11 +0100
committerGitHub <noreply@github.com>2020-01-29 12:54:11 +0100
commitf2a15bd48e737cd6e90f5a6ebf691978636bdb3c (patch)
treeb2a9127983b41c8f0a1ca5ef8a8598d4c587a505 /travis
parent324311619cf94ed024526b160282d9ae0d5a9e37 (diff)
parent8d75f5040e93c0e31a8c5410887fc95541c1baf1 (diff)
downloadPROJ-data-f2a15bd48e737cd6e90f5a6ebf691978636bdb3c.tar.gz
PROJ-data-f2a15bd48e737cd6e90f5a6ebf691978636bdb3c.zip
Merge pull request #6 from rouault/add_grid_tools
Add grid_tools/ with Python scripts to create & check grids
Diffstat (limited to 'travis')
-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