From 8d75f5040e93c0e31a8c5410887fc95541c1baf1 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 28 Jan 2020 17:45:37 +0100 Subject: 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 --- travis/check_new_grids.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 travis/check_new_grids.sh (limited to 'travis') 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 -- cgit v1.2.3