summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2023-01-04 15:59:08 -0300
committerJesusaves <cpntb1@ymail.com>2023-01-04 15:59:08 -0300
commit299b38bd5dda1e37cd894a2907605c58b19b4f64 (patch)
treeabc64b63c06ca1817769ed10f3d4a9ff2914373b
parent3daa25760e3cd226b708a302b222314823178f7f (diff)
downloadclientdata-299b38bd5dda1e37cd894a2907605c58b19b4f64.tar.gz
clientdata-299b38bd5dda1e37cd894a2907605c58b19b4f64.tar.bz2
clientdata-299b38bd5dda1e37cd894a2907605c58b19b4f64.tar.xz
clientdata-299b38bd5dda1e37cd894a2907605c58b19b4f64.zip
Forcefully introduce the standardized CI to client-data
-rw-r--r--.gitlab-ci.yml61
-rwxr-xr-x.tools/contributors.sh24
-rwxr-xr-x.tools/deploy.sh36
-rwxr-xr-x.tools/downloadlib.sh22
-rwxr-xr-x.tools/imagemagiccheck.sh22
-rwxr-xr-x.tools/init.sh90
-rwxr-xr-x.tools/licensecheck.sh24
-rwxr-xr-x.tools/manaplus.sh33
-rwxr-xr-x.tools/newlines.sh28
-rwxr-xr-x.tools/pngcheck.sh23
-rwxr-xr-x.tools/retry.sh15
-rwxr-xr-x.tools/testxml.sh33
12 files changed, 411 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 00000000..eca9465c
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,61 @@
+stages:
+- test
+
+image: debian:buster
+before_script:
+ - uname -a
+
+pngcheck:
+ stage: test
+ script:
+ - ./.tools/pngcheck.sh
+ allow_failure: true
+
+imagemagiccheck:
+ stage: test
+ script:
+ - ./.tools/imagemagiccheck.sh
+ allow_failure: true
+
+manaplus:
+ stage: test
+ script:
+ - ./.tools/manaplus.sh
+ image: debian:stable
+ artifacts:
+ paths:
+ - shared
+ when: always
+ expire_in: 3 week
+ allow_failure: true
+
+newlines:
+ stage: test
+ tags:
+ - lightweight
+ script:
+ - ./.tools/newlines.sh
+ artifacts:
+ paths:
+ - shared
+ when: always
+ expire_in: 3 week
+ allow_failure: true
+
+licensecheck:
+ stage: test
+ tags:
+ - lightweight
+ script:
+ - ./.tools/licensecheck.sh
+ allow_failure: true
+
+testxml:
+ stage: test
+ tags:
+ - glados
+ script:
+ - ./.tools/testxml.sh
+ - pwd
+ allow_failure: true
+
diff --git a/.tools/contributors.sh b/.tools/contributors.sh
new file mode 100755
index 00000000..cbfadf1b
--- /dev/null
+++ b/.tools/contributors.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+source ./.tools/init.sh
+
+clientdata_init
+
+aptget_update
+aptget_install git-core gcc ca-certificates libxml2-utils make xsltproc
+rm -rf tools
+gitclone https://git.themanaworld.org/evolved tools.git tools
+
+cd tools/contrib_xsl
+
+make about-server
+check_error $?
+
+cd ../../clientdata
+
+export RES=$(git diff)
+if [[ -n "${RES}" ]]; then
+ echo "Contributors list not updated"
+ git diff
+ exit 1
+fi
diff --git a/.tools/deploy.sh b/.tools/deploy.sh
new file mode 100755
index 00000000..82b8c292
--- /dev/null
+++ b/.tools/deploy.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+source ./.tools/init.sh
+
+clientdata_init
+
+aptget_update
+aptget_install git-core zip gcc zlib1g-dev ca-certificates libxml2-utils python
+rm -rf tools
+gitclone https://git.themanaworld.org/evolved tools.git tools
+
+cd clientdata
+rm -rf public
+mkdir public
+
+cd ..
+
+# FIXME
+#rm -rf music
+#gitclone https://git.themanaworld.org/evolved music.git music
+
+cd tools/update
+
+# FIXME
+./createnew.sh
+check_error $?
+#./create_music.sh
+#check_error $?
+
+cp -r upload/* ../../clientdata/public
+cd ../../clientdata
+gitclone https://git.themanaworld.org/mana pagesindexgen.git pagesindexgen
+cd pagesindexgen
+./pagesindexgen.py ../public
+check_error $?
+ls ../public
diff --git a/.tools/downloadlib.sh b/.tools/downloadlib.sh
new file mode 100755
index 00000000..c1aff5a4
--- /dev/null
+++ b/.tools/downloadlib.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+export zipname="lib.zip"
+export libname="$1_$2"
+
+mkdir libdownload
+cd libdownload
+rm "${zipname}"
+../client-data/.tools/retry.sh wget -O "${zipname}" "https://git.themanaworld.org/mana/spm/builds/artifacts/$1/download?job=${libname}"
+unzip "${zipname}"
+cp -r "bin/${libname}" ..
+cd ..
+
+rm -rf /usr/local/spm/bin/${libname}
+mkdir -p /usr/local/spm/bin
+
+cp -r libdownload/bin/${libname} /usr/local/spm/bin/
+ls /usr/local/spm/bin/${libname}
+if [ "$?" != 0 ]; then
+ echo "Library $1 $2 unpack failed"
+ exit 1
+fi
diff --git a/.tools/imagemagiccheck.sh b/.tools/imagemagiccheck.sh
new file mode 100755
index 00000000..34621cdd
--- /dev/null
+++ b/.tools/imagemagiccheck.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+source ./.tools/init.sh
+
+clientdata_init
+
+aptget_update
+aptget_install git-core gcc ca-certificates imagemagick
+rm -rf tools
+gitclone https://git.themanaworld.org/evolved tools.git tools
+
+cd tools/CI/imagescheck
+
+./icccheck.sh >icccheck.log
+check_error $?
+
+export RES=$(cat icccheck.log)
+if [[ -n "${RES}" ]]; then
+ echo "Detected icc profiles"
+ cat icccheck.log
+ exit 1
+fi
diff --git a/.tools/init.sh b/.tools/init.sh
new file mode 100755
index 00000000..4fe533ef
--- /dev/null
+++ b/.tools/init.sh
@@ -0,0 +1,90 @@
+#!/bin/bash
+
+function check_error {
+ if [ "$1" != 0 ]; then
+ echo "Error $1"
+ exit $1
+ fi
+}
+
+function gitclone1 {
+ echo git clone $2 $3
+ git clone $2 $3
+ if [ "$?" != 0 ]; then
+ echo git clone $1 $3
+ git clone $1 $3
+ return $?
+ fi
+ return $?
+}
+
+function gitclone {
+ export name1=$1/$2
+ export name2=${CI_BUILD_REPO##*@}
+ export name2=https://${name2%/*}/$2
+
+ gitclone1 "$name1" "$name2" $3
+ if [ "$?" != 0 ]; then
+ sleep 1s
+ gitclone1 "$name1" "$name2" $3
+ if [ "$?" != 0 ]; then
+ sleep 3s
+ gitclone1 "$name1" "$name2" $3
+ if [ "$?" != 0 ]; then
+ sleep 5s
+ gitclone1 "$name1" "$name2" $3
+ fi
+ fi
+ fi
+ check_error $?
+}
+
+function update_repos {
+ if [ "$CI_SERVER" == "" ];
+ then
+ return
+ fi
+
+ export DATA=$(cat /etc/resolv.conf|grep "nameserver 1.10.100.101")
+ if [ "$DATA" != "" ];
+ then
+ echo "Detected local runner"
+ sed -i 's!http://httpredir.debian.org/debian!http://1.10.100.103/debian!' /etc/apt/sources.list
+ else
+ echo "Detected non local runner"
+ fi
+}
+
+function aptget_update {
+ update_repos
+ apt-get update
+ if [ "$?" != 0 ]; then
+ sleep 1s
+ apt-get update
+ if [ "$?" != 0 ]; then
+ sleep 1s
+ apt-get update
+ fi
+ fi
+ check_error $?
+}
+
+function aptget_install {
+ apt-get -y -qq install $*
+ if [ "$?" != 0 ]; then
+ sleep 1s
+ apt-get -y -qq install $*
+ if [ "$?" != 0 ]; then
+ sleep 2s
+ apt-get -y -qq install $*
+ fi
+ fi
+ check_error $?
+}
+
+function clientdata_init {
+ mkdir shared
+ cd ..
+ ln -s clientdata client-data
+ check_error $?
+}
diff --git a/.tools/licensecheck.sh b/.tools/licensecheck.sh
new file mode 100755
index 00000000..ba2be45f
--- /dev/null
+++ b/.tools/licensecheck.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+source ./.tools/init.sh
+
+clientdata_init
+
+aptget_update
+aptget_install git-core gcc ca-certificates grep
+rm -rf tools
+gitclone https://git.themanaworld.org/evolved tools.git tools
+
+cd tools/CI/licensecheck
+
+./clientdata.sh >license.log
+check_error $?
+
+export RES=$(cat license.log)
+if [[ -n "${RES}" ]]; then
+ echo "Detected missing licenses."
+ cat license.log
+ echo "Estimated total missing licenses:"
+ wc -l license.log
+ exit 1
+fi
diff --git a/.tools/manaplus.sh b/.tools/manaplus.sh
new file mode 100755
index 00000000..aeb39a86
--- /dev/null
+++ b/.tools/manaplus.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+source ./.tools/init.sh
+
+clientdata_init
+
+aptget_update
+aptget_install gcc g++ \
+ make autoconf automake autopoint gettext \
+ libxml2-dev libcurl4-gnutls-dev libpng-dev \
+ libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev \
+ wget unzip
+
+pwd
+ls
+
+./clientdata/.tools/downloadlib.sh manaplus master || exit 1
+
+export HOME=`pwd`/clientdata/shared
+
+cd manaplus_master || exit 1
+export SDL_VIDEODRIVER=dummy
+./bin/manaplus --validate -u -d ../clientdata || exit 1
+
+ls "${HOME}/.local/share/mana/manaplus.log" || exit 1
+grep -A 10 "Assert:" "${HOME}/.local/share/mana/manaplus.log"
+
+if [ "$?" == 0 ]; then
+ echo "Asserts found"
+ exit 1
+fi
+
+cd ..
diff --git a/.tools/newlines.sh b/.tools/newlines.sh
new file mode 100755
index 00000000..64cbf7e1
--- /dev/null
+++ b/.tools/newlines.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+source ./.tools/init.sh
+
+aptget_update
+aptget_install dos2unix git-core
+
+export LOG1="newlines.log"
+
+rm ${LOG1}
+
+find -H . -type f -name "*.xml" -exec dos2unix {} \; >${LOG1}
+
+export RES=$(git diff --name-only)
+if [[ -n "${RES}" ]]; then
+ echo "Wrong new lines detected in xml files:"
+ git diff --name-only
+ exit 1
+fi
+
+find -H . -type f -name "*.tmx" -exec dos2unix {} \; >>${LOG1}
+
+export RES=$(git diff --name-only)
+if [[ -n "${RES}" ]]; then
+ echo "Wrong new lines detected in tmx files:"
+ git diff --name-only
+ exit 1
+fi
diff --git a/.tools/pngcheck.sh b/.tools/pngcheck.sh
new file mode 100755
index 00000000..8955b26e
--- /dev/null
+++ b/.tools/pngcheck.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+source ./.tools/init.sh
+
+aptget_update
+aptget_install pngcheck
+
+export LOG1="pngcheck.log"
+export LOG2="pngcheck2.log"
+
+rm ${LOG1}
+rm ${LOG2}
+
+find -H . -type f -name "*.png" -exec pngcheck {} \; >${LOG1}
+
+grep -v "32-bit RGB+alpha, non-interlaced, " ${LOG1} >${LOG2}
+export DATA=$(cat pngcheck2.log)
+if [[ -n "${DATA}" ]]; then
+ echo "Images must be in 32 bit RGBA and non-interlanced"
+ echo "Wrong images format found:"
+ cat ${LOG2}
+ exit 1
+fi
diff --git a/.tools/retry.sh b/.tools/retry.sh
new file mode 100755
index 00000000..aaa50e98
--- /dev/null
+++ b/.tools/retry.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+n=0
+
+while true; do
+ $*
+ if [ "$?" == 0 ]; then
+ exit 0
+ fi
+ if [[ $n -ge 10 ]]; then
+ exit -1
+ fi
+ sleep 5s
+ n=$((n+1))
+done
diff --git a/.tools/testxml.sh b/.tools/testxml.sh
new file mode 100755
index 00000000..a0dc16b3
--- /dev/null
+++ b/.tools/testxml.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+source ./.tools/init.sh
+
+clientdata_init
+
+aptget_update
+aptget_install git-core zip gcc zlib1g-dev ca-certificates libxml2-utils python python-pyvorbis python-ogg python-pil
+rm -rf tools
+gitclone https://git.themanaworld.org/evolved tools.git tools
+
+cd tools/CI/testxml
+
+./xsdcheck.sh
+check_error $?
+export RES=$(cat errors.txt)
+if [[ -n "${RES}" ]]; then
+ echo "xml check failed" >../../../clientdata/shared/error.log
+ echo ${RES} >>../../../clientdata/shared/error.log
+ cat ../../../clientdata/shared/error.log
+ exit 1
+fi
+
+echo >../../../clientdata/shared/error.log
+./testxml.py stfu >../../../clientdata/shared/error.log
+res="$?"
+cat ../../../clientdata/shared/error.log
+if [ "$res" != 0 ]; then
+ echo "test xml error"
+ exit 1
+fi
+
+echo >../../../clientdata/shared/error.log