feat(CI): migrate from Travis to GitHub Actions (#2887)

Co-authored-by: Yehonal <yehonal.azeroth@gmail.com>
This commit is contained in:
Rochet2
2020-04-19 18:33:13 +03:00
committed by GitHub
parent 2514f8fc9a
commit 1397971943
13 changed files with 145 additions and 152 deletions

59
.github/workflows/core_build.yml vendored Normal file
View File

@@ -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

View File

@@ -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 }}

View File

@@ -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

View File

@@ -1,7 +1,7 @@
# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/e61f4ea81de14b289fbf83d2b0da0c35)](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)
[![Master Build Status](https://travis-ci.org/azerothcore/azerothcore-wotlk.svg)](https://travis-ci.org/azerothcore/azerothcore-wotlk)
[![core-build](https://github.com/azerothcore/azerothcore-wotlk/workflows/core-build/badge.svg?branch=master&event=push)](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>

View File

@@ -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

View File

@@ -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

View File

@@ -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!";

View File

@@ -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
echo "Import custom module item..."
# 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
mysql -uroot -proot acore_world < modules/mod-premium/sql/example_item_9017.sql
echo "Done!"
fi

View File

@@ -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

View File

@@ -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)

View File

@@ -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
}

View File

@@ -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 \

View File

@@ -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")