From c7294dead8a9bf1e673ee45a1805dcd4773954bd Mon Sep 17 00:00:00 2001 From: Raul Barreras <rbarreras@nebraska.edu> Date: Tue, 17 Sep 2019 19:39:43 +0000 Subject: [PATCH] add php-lint tester [skip ci] --- .gitlab-ci.yml | 10 +++++++++- static-code-analysis/Dockerfile | 2 +- static-code-analysis/android/Dockerfile | 2 +- t/php-lint/tests.sh | 14 ++++++++++++++ 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100755 t/php-lint/tests.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f14d465..f9dd671 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,13 +27,21 @@ Make All Images: script: - make -test: +Test Sonar Scanner: stage: test tags: - dockerd script: - docker run --rm its-registry.unl.edu/unl-its/docker-ci/static-code-analysis sonar-scanner -v +Test PHP Lint: + stage: test + tags: + - linux, dockerd + script: + - t/php-lint/tests.sh + + Push to Container Registry: after_script: - rm -f /var/lib/gitlab-runner/.docker/config.json diff --git a/static-code-analysis/Dockerfile b/static-code-analysis/Dockerfile index a6524d4..6424a9a 100644 --- a/static-code-analysis/Dockerfile +++ b/static-code-analysis/Dockerfile @@ -12,7 +12,7 @@ LABEL org.label-schema.build-date=$BUILD_DATE \ org.label-schema.schema-version="1.0" \ maintainer="J.R. Barreras <barreras@unl.edu>" -ENV SONAR_SCANNER_VERSION 3.3.0.1492 +ENV SONAR_SCANNER_VERSION 4.0.0.1744 WORKDIR /opt diff --git a/static-code-analysis/android/Dockerfile b/static-code-analysis/android/Dockerfile index 7ec3ab9..3857f63 100644 --- a/static-code-analysis/android/Dockerfile +++ b/static-code-analysis/android/Dockerfile @@ -12,7 +12,7 @@ LABEL org.label-schema.build-date=$BUILD_DATE \ org.label-schema.schema-version="1.0" \ maintainer="Alan Nelson <alan.nelson@nebraska.edu>" -ENV SONAR_SCANNER_VERSION 3.2.0.1227 +ENV SONAR_SCANNER_VERSION 4.0.0.1744 ENV SONAR_HOME /opt/sonar-scanner ENV PATH ${PATH}:${SONAR_HOME} diff --git a/t/php-lint/tests.sh b/t/php-lint/tests.sh new file mode 100755 index 0000000..0828342 --- /dev/null +++ b/t/php-lint/tests.sh @@ -0,0 +1,14 @@ +TMP_DIR=`mktemp -d` +chmod 777 ${TMP_DIR} +touch "${TMP_DIR}/dumb php file with spaces.php" +touch "${TMP_DIR}/ddumb_php_file_without_spaces.php" +touch "${TMP_DIR}/$(printf '\u03c0').php" +docker run --rm -v "${TMP_DIR}:/work" its-registry.unl.edu/unl-its/docker-ci/php-lint:latest php-lint -d /work +RET=$? +rm -rf ${TMP_DIR} +if [ $RET -eq 0 ]; then + echo "PASS"; +else + echo "FAIL"; +fi +exit $RES -- GitLab