summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-03-01 21:37:31 +0300
committerAndrei Karas <akaras@inbox.ru>2019-03-01 21:50:37 +0300
commitb426d92dcbb6e760ed20cc02b93fb180e3c950a7 (patch)
tree03b6b454807ac9e9f3ec92daa581966c88533324
parent65d6304993a13247311f6c7d98debcb9964b1134 (diff)
downloadserverdata-citest.tar.gz
serverdata-citest.tar.bz2
serverdata-citest.tar.xz
serverdata-citest.zip
Add ci checks for bad new lines or trailing white spacescitest
-rw-r--r--.gitlab-ci.yml23
-rwxr-xr-x.tools/jobs/newlines.sh10
-rwxr-xr-x.tools/jobs/spaces.sh10
3 files changed, 43 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4216c7f1..8650a016 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -14,6 +14,29 @@ variables:
MYSQL_ROOT_PASSWORD: root
packetver: "20150513"
+newlines:
+ stage: build
+ 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: build
+ 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
+
build_test:
stage: build
script:
diff --git a/.tools/jobs/newlines.sh b/.tools/jobs/newlines.sh
new file mode 100755
index 00000000..23309f70
--- /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 00000000..b0f485db
--- /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