diff options
-rw-r--r-- | .gitlab-ci.yml | 24 | ||||
-rwxr-xr-x | .tools/jobs/newlines.sh | 10 | ||||
-rwxr-xr-x | .tools/jobs/spaces.sh | 10 |
3 files changed, 44 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c34b06fcb..b1b219fb5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,6 +14,7 @@ variables: .build_test: stage: build + script: - export CC=gcc-6 - ./.tools/jobs/install.sh "mysql-client @@ -173,6 +174,29 @@ licensecheck: - ./.tools/jobs/licensecheck.sh image: debian:stable +newlines: + stage: test + script: + - ./.tools/jobs/install.sh "dos2unix git-core" + - ./.tools/jobs/newlines.sh + image: debian:unstable + artifacts: + untracked: true + when: always + expire_in: 3 week + +spaces: + stage: test + script: + - ./.tools/jobs/install.sh "sed git-core" + - cd npc + - ../.tools/jobs/spaces.sh + image: debian:unstable + artifacts: + untracked: true + when: always + expire_in: 3 week + ok_job: stage: ok script: diff --git a/.tools/jobs/newlines.sh b/.tools/jobs/newlines.sh new file mode 100755 index 000000000..23309f70d --- /dev/null +++ b/.tools/jobs/newlines.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +find -H . -type f -name "*.txt" -o -name "*.conf" -exec dos2unix {} \; + +export RES=$(git diff --name-only) +if [[ -n "${RES}" ]]; then + echo "Wrong new lines detected in files:" + git diff --name-only + exit 1 +fi diff --git a/.tools/jobs/spaces.sh b/.tools/jobs/spaces.sh new file mode 100755 index 000000000..b0f485dbe --- /dev/null +++ b/.tools/jobs/spaces.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +find -H . -type f -name "*.txt" -exec sed -i 's/[[:blank:]]*$//' {} \; + +export RES=$(git diff --name-only) +if [[ -n "${RES}" ]]; then + echo "Extra spaces before new lines detected in files:" + git diff --name-only + exit 1 +fi |