diff options
-rw-r--r-- | .github/workflows/core_build.yml | 59 | ||||
-rw-r--r-- | .github/workflows/import_pending_sql.yml | 32 | ||||
-rw-r--r-- | .travis.yml | 84 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rwxr-xr-x | apps/ci/ci-before_install.sh | 21 | ||||
-rwxr-xr-x | apps/ci/ci-compile.sh | 3 | ||||
-rwxr-xr-x | apps/ci/ci-error-check.sh | 3 | ||||
-rwxr-xr-x | apps/ci/ci-import-db.sh | 17 | ||||
-rwxr-xr-x | apps/ci/ci-install.sh | 51 | ||||
-rwxr-xr-x | apps/ci/ci-worldserver-dry-run.sh | 15 | ||||
-rw-r--r-- | apps/db_assembler/includes/functions.sh | 1 | ||||
-rw-r--r-- | apps/installer/includes/os_configs/debian.sh | 2 | ||||
-rw-r--r-- | apps/installer/includes/os_configs/ubuntu.sh | 7 |
13 files changed, 145 insertions, 152 deletions
diff --git a/.github/workflows/core_build.yml b/.github/workflows/core_build.yml new file mode 100644 index 0000000000..e2a5085740 --- /dev/null +++ b/.github/workflows/core_build.yml @@ -0,0 +1,59 @@ +name: core-build +on: + push: + pull_request: + +jobs: + build: + strategy: + fail-fast: false + matrix: + compiler: [clang6, clang7] + modules: [with, without] + runs-on: ubuntu-18.04 + name: ${{ matrix.compiler }}-${{ matrix.modules }}-modules + env: + COMPILER: ${{ matrix.compiler }} + steps: + - uses: actions/checkout@v2 + - name: Checkout modules + run: ./apps/ci/ci-install-modules.sh + if: matrix.modules == 'with' + - name: Cache + uses: actions/cache@v1.1.2 + with: + path: /home/runner/.ccache + key: ccache:${{ matrix.compiler }}:${{ matrix.modules }}-modules:${{ github.ref }}:${{ github.sha }} + restore-keys: | + ccache:${{ matrix.compiler }}:${{ matrix.modules }}-modules:${{ github.ref }} + ccache:${{ matrix.compiler }}:${{ matrix.modules }}-modules + ccache:${{ matrix.compiler }} + ccache + - name: Configure OS + run: source ./apps/ci/ci-install.sh + env: + CONTINUOUS_INTEGRATION: true + - name: Import db + run: source ./apps/ci/ci-import-db.sh + - name: Build + run: source ./apps/ci/ci-compile.sh + - name: Dry run + run: source ./apps/ci/ci-worldserver-dry-run.sh + - name: Check startup errors + run: source ./apps/ci/ci-error-check.sh + + docker-build: + strategy: + fail-fast: false + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Configure + run: | + docker --version + docker-compose --version + ./apps/ci/docker/ci-docker-config.sh + ./bin/acore-docker-generate-etc + - name: Build + run: | + ./bin/acore-docker-build-no-scripts diff --git a/.github/workflows/import_pending_sql.yml b/.github/workflows/import_pending_sql.yml new file mode 100644 index 0000000000..42b7036ad5 --- /dev/null +++ b/.github/workflows/import_pending_sql.yml @@ -0,0 +1,32 @@ +name: import-pending-sql +on: + push: + branches: + - master + +jobs: + import-pending-sql: + strategy: + fail-fast: false + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Extract branch name + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + - name: Import and commit pending sql + run: | + git config user.email "azerothcorebot@gmail.com" && git config user.name "AzerothCoreBot" + cd bin/ + source acore-db-pendings + cd .. + git fetch --unshallow origin ${BRANCH} + git add -A . + git commit -am "Import pending SQL update file..." -m "Referenced commit(s):${GITHUB_SHA}" || true + env: + BRANCH: ${{ steps.extract_branch.outputs.branch }} + - name: Push changes + uses: ad-m/github-push-action@fe38f0a751bf9149f0270cc1fe20bf9156854365 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ steps.extract_branch.outputs.branch }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5085c19ed7..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,84 +0,0 @@ -sudo: required -dist: bionic # (18.04) - -language: cpp - -cache: ccache - -addons: - apt: - update: true - -services: - - mysql - - docker - -git: - depth: 10 - -stages: - - prepare_cache - - run - -jobs: - include: - - stage: prepare_cache - env: TRAVIS_BUILD_ID="1" - before_install: - - git config user.email "azerothcorebot@gmail.com" && git config user.name "AzerothCoreBot" - - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cd bin/; fi - # import pending sql - - if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then source acore-db-pendings; fi - - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cd ..; fi - # push changes to git if any - - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then git fetch --unshallow; fi - - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then git checkout $TRAVIS_BRANCH; fi - - if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [[ -n "$GITHUB_API_KEY" ]]; then git add -A . && git diff --cached --quiet || git commit -am "Import pending SQL update file..." -m "Referenced commit(s):$COMMIT_HASH" && git push https://$GITHUB_API_KEY@github.com/$TRAVIS_REPO_SLUG.git $TRAVIS_BRANCH; fi - # sync staging with master - # - if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ] && [[ -n "$GITHUB_API_KEY" ]]; then git fetch origin staging:staging && git checkout staging && git merge --no-edit master && git push https://$GITHUB_API_KEY@github.com/$TRAVIS_REPO_SLUG.git staging; git checkout master; fi - - source ./apps/ci/ci-before_install.sh - install: - - source ./apps/ci/ci-install.sh OFF - - source ./apps/ci/ci-install-modules.sh - script: - - source ./apps/ci/ci-compile.sh - - - stage: run - env: TRAVIS_BUILD_ID="1" - before_install: - - source ./apps/ci/ci-before_install.sh - install: - - source ./apps/ci/ci-install.sh ON - - source ./apps/ci/ci-install-modules.sh - - source ./apps/ci/ci-import-db.sh - script: - - source ./apps/ci/ci-compile.sh - - source ./apps/ci/ci-worldserver-dry-run.sh - - - stage: prepare_cache - env: TRAVIS_BUILD_ID="2" - before_install: - - source ./apps/ci/ci-before_install.sh - install: - - source ./apps/ci/ci-install.sh OFF - - source ./apps/ci/ci-install-modules.sh - script: - - source ./apps/ci/ci-compile.sh - - - stage: run - env: TRAVIS_BUILD_ID="2" - before_install: - - source ./apps/ci/ci-before_install.sh - install: - - source ./apps/ci/ci-install.sh ON - - source ./apps/ci/ci-install-modules.sh - script: - - source ./apps/ci/ci-compile.sh - - - stage: run - env: TRAVIS_BUILD_ID="3" - script: - - ./apps/ci/docker/ci-docker-config.sh - - ./bin/acore-docker-generate-etc - - ./bin/acore-docker-build-no-scripts - - docker-compose up -d ac-database @@ -1,7 +1,7 @@ #  AzerothCore [](https://app.codacy.com/app/FrancescoBorzi/azerothcore-wotlk?utm_source=github.com&utm_medium=referral&utm_content=azerothcore/azerothcore-wotlk&utm_campaign=Badge_Grade_Settings) -[](https://travis-ci.org/azerothcore/azerothcore-wotlk) +[](https://github.com/azerothcore/azerothcore-wotlk/actions?query=workflow%3Acore-build+branch%3Amaster+event%3Apush) <a href="https://scan.coverity.com/projects/azerothcore-azerothcore-wotlk"> <img alt="Coverity Scan Build Status" src="https://scan.coverity.com/projects/13814/badge.svg"/> </a> diff --git a/apps/ci/ci-before_install.sh b/apps/ci/ci-before_install.sh deleted file mode 100755 index 6874f95f03..0000000000 --- a/apps/ci/ci-before_install.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -set -e - -if [ "$TRAVIS_BUILD_ID" = "1" ] -then - export CCOMPILERC="clang-6.0" - export CCOMPILERCXX="clang++-6.0" - - 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" -fi diff --git a/apps/ci/ci-compile.sh b/apps/ci/ci-compile.sh index 78c6c2e5cd..2ac3b70d73 100755 --- a/apps/ci/ci-compile.sh +++ b/apps/ci/ci-compile.sh @@ -4,6 +4,7 @@ set -e echo "compile core" export CCACHE_CPP2=true +export CCACHE_MAXSIZE='500MB' ccache -s -timeout 2700 bash ./acore.sh "compiler" "all" +./acore.sh "compiler" "all" ccache -s diff --git a/apps/ci/ci-error-check.sh b/apps/ci/ci-error-check.sh index 945844a6a9..d446e904be 100755 --- a/apps/ci/ci-error-check.sh +++ b/apps/ci/ci-error-check.sh @@ -1,7 +1,6 @@ #!/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"; +DB_ERRORS_FILE="./env/dist/bin/DBErrors.log"; if [[ ! -f ${DB_ERRORS_FILE} ]]; then echo "File ${DB_ERRORS_FILE} not found!"; diff --git a/apps/ci/ci-import-db.sh b/apps/ci/ci-import-db.sh index 58747c877b..a7ee847d83 100755 --- a/apps/ci/ci-import-db.sh +++ b/apps/ci/ci-import-db.sh @@ -2,14 +2,13 @@ set -e -if [ "$TRAVIS_BUILD_ID" = "1" ] -then - echo "import DB" - bash ./acore.sh "db-assembler" "import-all" +sudo systemctl start mysql +./acore.sh "db-assembler" "import-all" - if [ -s modules/mod-premium/sql/example_item_9017.sql ] - then - # if the premium module is available insert the example item or else the worldserver dry run will fail - mysql -u root world_$DB_RND_NAME <modules/mod-premium/sql/example_item_9017.sql - fi +if [ -s modules/mod-premium/sql/example_item_9017.sql ] +then + echo "Import custom module item..." + # if the premium module is available insert the example item or else the worldserver dry run will fail + mysql -uroot -proot acore_world < modules/mod-premium/sql/example_item_9017.sql + echo "Done!" fi diff --git a/apps/ci/ci-install.sh b/apps/ci/ci-install.sh index 5f5c82a760..63fd73bfe8 100755 --- a/apps/ci/ci-install.sh +++ b/apps/ci/ci-install.sh @@ -2,37 +2,42 @@ set -e -echo "install OS deps (apt-get)" -bash ./acore.sh "install-deps" - -if [ "$TRAVIS_BUILD_ID" = "1" ] -then - echo "install clang-6.0" - sudo apt-get install clang-6.0 -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=$(expr $(grep -c ^processor /proc/cpuinfo) + 2) CWARNINGS=ON CDEBUG=OFF CTYPE=Release -CSCRIPTS=$1 +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 +DB_CHARACTERS_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';" +DB_AUTH_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';" +DB_WORLD_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';" CONFIG_SH + +time sudo apt-get update -y +# time sudo apt-get upgrade -y +time sudo apt-get install -y git lsb-release sudo ccache +time ./acore.sh install-deps + +case $COMPILER in + "clang6" ) + time sudo apt-get install -y clang-6.0 + echo "CCOMPILERC=\"clang-6.0\"" >> ./conf/config.sh + echo "CCOMPILERCXX=\"clang++-6.0\"" >> ./conf/config.sh + ;; + + "clang7" ) + time sudo apt-get install -y clang-7 + echo "CCOMPILERC=\"clang-7\"" >> ./conf/config.sh + echo "CCOMPILERCXX=\"clang++-7\"" >> ./conf/config.sh + ;; + + * ) + echo "Unknown compiler $COMPILER" + exit 1 + ;; +esac diff --git a/apps/ci/ci-worldserver-dry-run.sh b/apps/ci/ci-worldserver-dry-run.sh index 8c7a4929df..d58e20e24a 100755 --- a/apps/ci/ci-worldserver-dry-run.sh +++ b/apps/ci/ci-worldserver-dry-run.sh @@ -2,11 +2,10 @@ set -e -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 +echo "[worldserver]" >> ./env/dist/etc/worldserver.conf +echo "DataDir = \"../data/\"" >> ./env/dist/etc/worldserver.conf +echo "LoginDatabaseInfo = \"localhost;3306;root;root;acore_auth\"" >> ./env/dist/etc/worldserver.conf +echo "WorldDatabaseInfo = \"localhost;3306;root;root;acore_world\"" >> ./env/dist/etc/worldserver.conf +echo "CharacterDatabaseInfo = \"localhost;3306;root;root;acore_characters\"" >> ./env/dist/etc/worldserver.conf +git clone --depth=1 --branch=master --single-branch https://github.com/ac-data/ac-data.git ./env/dist/data +(cd ./env/dist/bin/ && timeout 5m ./worldserver --dry-run) diff --git a/apps/db_assembler/includes/functions.sh b/apps/db_assembler/includes/functions.sh index 82b22519ac..28c3313536 100644 --- a/apps/db_assembler/includes/functions.sh +++ b/apps/db_assembler/includes/functions.sh @@ -107,6 +107,7 @@ function dbasm_createDB() { else echo "Creating DB ${dbname} ..." dbasm_mysqlExec "$confs" "CREATE DATABASE \`${dbname}\`" "" + dbasm_mysqlExec "$confs" "CREATE USER IF NOT EXISTS '${CONF_USER}'@'${MYSQL_HOST}' IDENTIFIED BY '${CONF_PASS}';" dbasm_mysqlExec "$confs" "GRANT ALL PRIVILEGES ON \`${dbname}\`.* TO '${CONF_USER}'@'${MYSQL_HOST}' WITH GRANT OPTION;" fi } diff --git a/apps/installer/includes/os_configs/debian.sh b/apps/installer/includes/os_configs/debian.sh index 2aac09c6ed..03f2eb4d6e 100644 --- a/apps/installer/includes/os_configs/debian.sh +++ b/apps/installer/includes/os_configs/debian.sh @@ -1,4 +1,4 @@ - +sudo apt-get update sudo apt-get install -y git cmake make gcc g++ clang libmysqlclient-dev \ libssl1.0-dev libbz2-dev libreadline-dev libncurses-dev \ diff --git a/apps/installer/includes/os_configs/ubuntu.sh b/apps/installer/includes/os_configs/ubuntu.sh index b290b72f04..463a9eb5d6 100644 --- a/apps/installer/includes/os_configs/ubuntu.sh +++ b/apps/installer/includes/os_configs/ubuntu.sh @@ -1,9 +1,12 @@ UBUNTU_VERSION=$(lsb_release -sr); -if [[ $TRAVIS && $CONTINUOUS_INTEGRATION ]]; then +sudo apt-get update + +if [[ $CONTINUOUS_INTEGRATION ]]; then sudo apt-get -y install build-essential libtool make cmake cmake-data clang openssl libgoogle-perftools-dev \ - libssl-dev libmysqlclient-dev libmysql++-dev libreadline6-dev zlib1g-dev libbz2-dev libace-dev + libssl-dev libmysqlclient-dev libmysql++-dev libreadline6-dev zlib1g-dev libbz2-dev libace-dev mysql-client \ + libncurses5-dev else case $UBUNTU_VERSION in "14.04") |