summaryrefslogtreecommitdiff
path: root/tools/travis-ci
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2017-05-09 15:28:09 +0200
committerEven Rouault <even.rouault@spatialys.com>2017-05-09 20:46:16 +0200
commitd4e54e9f35d532062533f1d369c159810b01d224 (patch)
tree7046ff72a41a8b0ad2e40e1d4aa3b191d03f6380 /tools/travis-ci
parent8650b70e06408d394c1708846b6fc2d86cf14079 (diff)
Add mechanisms to reformant and check code style (#128)
Use an internal version of astyle (astyle 3.0). Scripts taken from QGIS. astyle.options from https://github.com/uclouvain/openjpeg/issues/128 scripts/prepare-commit.sh can be used locally to automatically reformat edited files. Travis-CI will run scripts/verify-indentation.sh to verify committed files.
Diffstat (limited to 'tools/travis-ci')
-rwxr-xr-xtools/travis-ci/install.sh4
-rwxr-xr-xtools/travis-ci/run.sh19
2 files changed, 23 insertions, 0 deletions
diff --git a/tools/travis-ci/install.sh b/tools/travis-ci/install.sh
index b1921844..2664eb03 100755
--- a/tools/travis-ci/install.sh
+++ b/tools/travis-ci/install.sh
@@ -115,3 +115,7 @@ if [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ]; then
fi
fi
fi
+
+if [ "${OPJ_CI_CHECK_STYLE:-}" == "1" ]; then
+ pip install --user autopep8
+fi
diff --git a/tools/travis-ci/run.sh b/tools/travis-ci/run.sh
index 35d2473e..950a0ee9 100755
--- a/tools/travis-ci/run.sh
+++ b/tools/travis-ci/run.sh
@@ -30,6 +30,16 @@ if [ "${OPJ_CI_ABI_CHECK:-}" == "1" ]; then
exit 0
fi
+if [ "${OPJ_CI_CC:-}" != "" ]; then
+ export CC=${OPJ_CI_CC}
+ echo "Using ${CC}"
+fi
+
+if [ "${OPJ_CI_CXX:-}" != "" ]; then
+ export CXX=${OPJ_CI_CXX}
+ echo "Using ${CXX}"
+fi
+
# Set-up some variables
if [ "${OPJ_CI_BUILD_CONFIGURATION:-}" == "" ]; then
export OPJ_CI_BUILD_CONFIGURATION=Release #default
@@ -191,6 +201,15 @@ fi
# ignore ctest exit code & parse this ourselves
set +x
+
+
+if [ "${OPJ_CI_CHECK_STYLE:-}" == "1" ]; then
+ export OPJSTYLE=${PWD}/scripts/opjstyle
+ export PATH=${HOME}/.local/bin:${PATH}
+ scripts/verify-indentation.sh
+fi
+
+
# Deployment if needed
#---------------------
if [ "${TRAVIS_TAG:-}" != "" ]; then