mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 08:17:56 +00:00
feat(CI): improve Travis configuration (#1486)
- use random DB names in order to detect statements which address a specific DB - split compilation and DB check (DB check and dry run only have to run once) - use separate shell scripts for easier module Travis integration
This commit is contained in:
24
apps/ci/ci-before_install.sh
Executable file
24
apps/ci/ci-before_install.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$TRAVIS_BUILD_ID" = "1" ]
|
||||
then
|
||||
export CCOMPILERC="clang-3.8"
|
||||
export CCOMPILERCXX="clang++-3.8"
|
||||
|
||||
echo "set root password"
|
||||
export DB_RND_NAME=$(cat /dev/urandom | tr -dc 'a-z' | fold -w 5 | head -n 1)
|
||||
sudo mysql -e "use mysql; update user set authentication_string=PASSWORD('$DB_RND_NAME') where User='root'; update user set plugin='mysql_native_password';FLUSH PRIVILEGES;"
|
||||
sudo mysql_upgrade -u root -p$DB_RND_NAME
|
||||
sudo service mysql restart
|
||||
printf "[client]\npassword=%s" "$DB_RND_NAME" >~/.my.cnf
|
||||
chmod 400 ~/.my.cnf
|
||||
elif [ "$TRAVIS_BUILD_ID" = "2" ]
|
||||
then
|
||||
export CCOMPILERC="clang-7"
|
||||
export CCOMPILERCXX="clang++-7"
|
||||
|
||||
echo "add custom APT repository llvm-toolchain-xenial-7"
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main" | sudo tee -a /etc/apt/sources.list
|
||||
sudo apt-get update -qq
|
||||
fi
|
||||
18
apps/ci/ci-error-check.sh
Executable file
18
apps/ci/ci-error-check.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DB_ERRORS_FILE="/home/travis/build/azerothcore/azerothcore-wotlk/env/dist/bin/DBErrors.log";
|
||||
#DB_ERRORS_FILE="./env/dist/bin/DBErrors.log";
|
||||
|
||||
if [[ ! -f ${DB_ERRORS_FILE} ]]; then
|
||||
echo "File ${DB_ERRORS_FILE} not found!";
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -s ${DB_ERRORS_FILE} ]]; then
|
||||
printf "The DBErrors.log file contains startup errors:\n\n";
|
||||
cat ${DB_ERRORS_FILE};
|
||||
printf "\nPlease solve the startup errors listed above!\n";
|
||||
exit 1;
|
||||
else
|
||||
echo "No startup errors found in DBErrors.log, good job!";
|
||||
fi
|
||||
42
apps/ci/ci-install.sh
Executable file
42
apps/ci/ci-install.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "install OS deps (apt-get)"
|
||||
bash ./acore.sh "install-deps"
|
||||
|
||||
if [ "$TRAVIS_BUILD_ID" = "1" ]
|
||||
then
|
||||
echo "install clang-3.8"
|
||||
sudo apt-get install clang-3.8
|
||||
elif [ "$TRAVIS_BUILD_ID" = "2" ]
|
||||
then
|
||||
echo "install clang-7"
|
||||
sudo apt-get install clang-7
|
||||
fi
|
||||
|
||||
echo "create config.sh"
|
||||
cat >>conf/config.sh <<CONFIG_SH
|
||||
CCOMPILERC=$CCOMPILERC
|
||||
CCOMPILERCXX=$CCOMPILERCXX
|
||||
MTHREADS=4
|
||||
CWARNINGS=ON
|
||||
CDEBUG=OFF
|
||||
CTYPE=Release
|
||||
CSCRIPTS=ON
|
||||
CSERVERS=ON
|
||||
CTOOLS=ON
|
||||
CSCRIPTPCH=OFF
|
||||
CCOREPCH=OFF
|
||||
CCUSTOMOPTIONS='-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror"'
|
||||
DB_CHARACTERS_CONF="MYSQL_USER='root'; MYSQL_PASS='$DB_RND_NAME'; MYSQL_HOST='localhost';"
|
||||
DB_AUTH_CONF="MYSQL_USER='root'; MYSQL_PASS='$DB_RND_NAME'; MYSQL_HOST='localhost';"
|
||||
DB_WORLD_CONF="MYSQL_USER='root'; MYSQL_PASS='$DB_RND_NAME'; MYSQL_HOST='localhost';"
|
||||
DB_AUTH_NAME=auth_$DB_RND_NAME
|
||||
DB_CHARACTERS_NAME=characters_$DB_RND_NAME
|
||||
DB_WORLD_NAME=world_$DB_RND_NAME
|
||||
CONFIG_SH
|
||||
|
||||
if [ "$TRAVIS_BUILD_ID" = "1" ]
|
||||
then
|
||||
echo "import DB"
|
||||
bash ./acore.sh "db-assembler" "import-all"
|
||||
fi
|
||||
16
apps/ci/ci-script.sh
Executable file
16
apps/ci/ci-script.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "compile core"
|
||||
export CCACHE_CPP2=true
|
||||
ccache -s
|
||||
timeout 2580 bash ./acore.sh "compiler" "all"
|
||||
ccache -s
|
||||
|
||||
if [ "$TRAVIS_BUILD_ID" = "1" ]
|
||||
then
|
||||
echo "start worldserver dry-run"
|
||||
git clone --depth=1 --branch=master --single-branch https://github.com/ac-data/ac-data.git /home/travis/build/azerothcore/azerothcore-wotlk/env/dist/data
|
||||
sed -e "s/;;acore_auth/;$DB_RND_NAME;auth_$DB_RND_NAME/" -e "s/;;acore_world/;$DB_RND_NAME;world_$DB_RND_NAME/" -e "s/;;acore_characters/;$DB_RND_NAME;characters_$DB_RND_NAME/" ./data/travis/worldserver.conf >./env/dist/etc/worldserver.conf
|
||||
./env/dist/bin/worldserver --dry-run
|
||||
./apps/ci/ci-error-check.sh
|
||||
fi
|
||||
Reference in New Issue
Block a user