feat(CI): improve Travis build time (#1573)

* feat(CI): improve Travis build time
This commit is contained in:
Stoabrogga
2019-03-16 15:25:51 +01:00
committed by Viste(Кирилл)
parent cbc0c93d06
commit e2f196580e
5 changed files with 70 additions and 33 deletions

View File

@@ -16,26 +16,57 @@ services:
git:
depth: 1
env:
- TRAVIS_BUILD_ID="1"
- TRAVIS_BUILD_ID="2"
stages:
- prepare_cache
- run
before_install:
- git config user.email "azerothcorebot@gmail.com" && git config user.name "AzerothCoreBot"
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cd bin/; fi
# import pending sql
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then source acore-db-pendings; fi
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cd ..; fi
# push changes to git if any
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then git fetch --unshallow; fi
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then git checkout $TRAVIS_BRANCH; fi
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$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_BUILD_ID" = "1" ] && [ "$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
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
script:
- source ./apps/ci/ci-compile.sh
install:
- source ./apps/ci/ci-install.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-import-db.sh
script:
- source ./apps/ci/ci-compile.sh
- source ./apps/ci/ci-worldserver-dry-run.sh
script:
- source ./apps/ci/ci-script.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
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
script:
- source ./apps/ci/ci-compile.sh

9
apps/ci/ci-compile.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
set -e
echo "compile core"
export CCACHE_CPP2=true
ccache -s
timeout 2700 bash ./acore.sh "compiler" "all"
ccache -s

9
apps/ci/ci-import-db.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
set -e
if [ "$TRAVIS_BUILD_ID" = "1" ]
then
echo "import DB"
bash ./acore.sh "db-assembler" "import-all"
fi

View File

@@ -23,7 +23,7 @@ MTHREADS=$(expr $(grep -c ^processor /proc/cpuinfo) + 2)
CWARNINGS=ON
CDEBUG=OFF
CTYPE=Release
CSCRIPTS=ON
CSCRIPTS=$1
CSERVERS=ON
CTOOLS=ON
CSCRIPTPCH=OFF
@@ -36,9 +36,3 @@ 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

View File

@@ -2,12 +2,6 @@
set -e
echo "compile core"
export CCACHE_CPP2=true
ccache -s
timeout 2700 bash ./acore.sh "compiler" "all"
ccache -s
if [ "$TRAVIS_BUILD_ID" = "1" ]
then
echo "start worldserver dry-run"