From b3cfd122288210cc24468cd5be91b17097e8dc55 Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Fri, 1 Dec 2017 18:50:34 +0100 Subject: [PATCH] Added the custom and test scripts to the buildbot (#2658) * Added the custom and test scripts to the buildbot All scripts inside the custom and test npc directory are now parsed and executed automatically by the buildbot. The only exceptions are the custom battleground scripts that would cause duplication warnings. Thanks to @Jeybla for the Unix script! --- .travis.yml | 1 + appveyor.yml | 4 ++++ tools/ci/npc.bat | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ tools/ci/npc.sh | 12 +++++++++++ 4 files changed, 69 insertions(+) create mode 100644 tools/ci/npc.bat create mode 100755 tools/ci/npc.sh diff --git a/.travis.yml b/.travis.yml index 963fe75d9b..461a9d8ba9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,6 +34,7 @@ before_script: script: - ./configure $CONFIGURE_FLAGS + - ./tools/ci/npc.sh - make clean - make server - ./map-server --run-once diff --git a/appveyor.yml b/appveyor.yml index a70cec5ec3..03a26634bb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -102,6 +102,10 @@ test_script: %MYSQL% -u %DB_ROOT% -p%DB_ROOTPW% -e "GRANT ALL ON *.* TO '%DB_USER%'@'%DB_HOST%' IDENTIFIED BY '%DB_USERPW%';" + rem Activate all custom and test scripts + + start /d tools\ci npc.bat + rem Start the map server map-server.exe --run-once diff --git a/tools/ci/npc.bat b/tools/ci/npc.bat new file mode 100644 index 0000000000..5e0b611e80 --- /dev/null +++ b/tools/ci/npc.bat @@ -0,0 +1,52 @@ +@echo off + +setlocal enabledelayedexpansion + +rem switch to the npc folder +cd ..\..\npc\ + +rem store the output destination +set OUT=%CD%\scripts_custom.conf + +rem switch to the custom folder +cd custom\ + +rem newline +echo. >> !OUT! +rem header +echo // Custom Scripts >> !OUT! + +rem store the current directory +set C=%CD% +rem make sure that no paranthesis close is unescaped inside the path +set C=!C:^)=^^^)! + +for /R . %%f in (*.txt) do ( + rem store it to allow delayed expansion + set B=%%f + rem store relative path for compare + set R=!B:%C%\=! + + rem all except the battleground scripts + if "!R:~0,12!" neq "battleground" ( + echo npc: npc\custom\!R!>>!OUT! + ) +) + +rem switch to the test folder +cd ..\test + +rem header +echo // Test scripts >> !OUT! + +rem store the current directory +set C=%CD% +rem make sure that no paranthesis close is unescaped inside the path +set C=!C:^)=^^^)! + +for /R . %%f in (*.txt) do ( + rem store it to allow delayed expansion + set B=%%f + + echo npc: npc\test\!B:%C%\=!>>!OUT! +) diff --git a/tools/ci/npc.sh b/tools/ci/npc.sh new file mode 100755 index 0000000000..22f7f83bdd --- /dev/null +++ b/tools/ci/npc.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +out=npc/scripts_custom.conf + +printf "\n" >> $out +echo "// Custom Scripts" >> $out + +find npc/custom \( -name "*.txt" -and -not -wholename "*/battleground/*" \) | xargs -I % echo "npc: %" >> $out + +echo "// Test Scripts" >> $out + +find npc/test \( -name "*.txt" \) | xargs -I % echo "npc: %" >> $out