diff options
| -rw-r--r-- | .travis.yml | 1 | ||||
| -rwxr-xr-x | travis/check_new_grids.sh | 38 |
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 |
