mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-03-11 05:21:07 +00:00
scripts: travis: use stages, use yandex disk as temporary place for build artifacts
This commit is contained in:
parent
db30358d06
commit
880a9651d8
53
.travis.yml
53
.travis.yml
@ -23,6 +23,7 @@ addons:
|
|||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- SDL_VERSION=2.0.8
|
- SDL_VERSION=2.0.8
|
||||||
|
- DEPLOY_BRANCH=newengine
|
||||||
git:
|
git:
|
||||||
depth: 50
|
depth: 50
|
||||||
submodules: true
|
submodules: true
|
||||||
@ -35,18 +36,40 @@ matrix:
|
|||||||
- os: osx
|
- os: osx
|
||||||
- os: windows
|
- os: windows
|
||||||
env: PYTHONENCODING=UTF-8
|
env: PYTHONENCODING=UTF-8
|
||||||
before_script:
|
|
||||||
- sh scripts/travis_common_deps.sh
|
jobs:
|
||||||
- sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
|
allow_failures:
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export ANDROID_HOME=$PWD/android-sdk-linux; fi
|
- os: osx
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:$PWD/android-ndk; fi
|
- os: windows
|
||||||
script:
|
- os: linux
|
||||||
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh
|
include:
|
||||||
# - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sh scripts/build_android_engine.sh; fi
|
- stage: init
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sh scripts/build_mingw_engine.sh; fi
|
name: "Initialize webdav cache"
|
||||||
after_script:
|
os: linux
|
||||||
- cd ${TRAVIS_BUILD_DIR}
|
cache: false
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ccache --show-stats; fi
|
script:
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sh scripts/travis-deploy.sh newengine Xash3DFWGS-i386.AppImage xash3d-mingw.7z; fi
|
- scripts/yadisk_clear.sh
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sh scripts/travis-deploy.sh newengine xash3d-osx.tar.bz2; fi
|
- stage: build
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then sh scripts/travis-deploy.sh newengine xash3d-vc.7z; fi
|
name: "Build engine and upload to webdav cache"
|
||||||
|
before_script:
|
||||||
|
- sh scripts/travis_common_deps.sh
|
||||||
|
- sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export ANDROID_HOME=$PWD/android-sdk-linux; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:$PWD/android-ndk; fi
|
||||||
|
script:
|
||||||
|
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh
|
||||||
|
# - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sh scripts/build_android_engine.sh; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sh scripts/build_mingw_engine.sh; fi
|
||||||
|
after_script:
|
||||||
|
- cd ${TRAVIS_BUILD_DIR}
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ccache --show-stats; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sh scripts/yadisk_upload.sh Xash3DFWGS-i386.AppImage xash3d-mingw.7z; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sh scripts/yadisk_upload.sh xash3d-osx.tar.bz2; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then sh scripts/yadisk_upload.sh xash3d-vc.7z; fi
|
||||||
|
- stage: deploy
|
||||||
|
name: "Deploy to github"
|
||||||
|
os: linux
|
||||||
|
cache: false
|
||||||
|
script:
|
||||||
|
- sh scripts/travis-deploy.sh Xash3DFWGS-i386.AppImage xash3d-mingw.7z xash3d-osx.tar.bz2 xash3d-vc.7z
|
||||||
|
|
||||||
|
@ -10,63 +10,17 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
|||||||
die "Travis should not deploy from pull requests"
|
die "Travis should not deploy from pull requests"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
commit_files()
|
|
||||||
{
|
|
||||||
git add .
|
|
||||||
git commit -m "Latest travis deploy $TRAVIS_COMMIT"
|
|
||||||
}
|
|
||||||
|
|
||||||
force_push()
|
|
||||||
{
|
|
||||||
git push -q --force travis-deploy-public $SOURCE_NAME-$TRAVIS_BRANCH >/dev/null 2>/dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
append_readme()
|
append_readme()
|
||||||
{
|
{
|
||||||
for arg in $FILES; do
|
for arg in $FILES; do
|
||||||
echo \* [$arg]\(https://github.com/FWGS/xash3d-deploy/blob/$SOURCE_NAME-$TRAVIS_BRANCH/$arg\?raw\=true\) >> README.md
|
echo \* [$arg]\(https://github.com/FWGS/xash3d-deploy/blob/$DEPLOY_BRANCH-$TRAVIS_BRANCH/$arg\?raw\=true\) >> README.md
|
||||||
echo >> README.md
|
echo >> README.md
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
download_repo_and_copy_files()
|
|
||||||
{
|
|
||||||
git clone https://github.com/FWGS/xash3d-deploy -b $SOURCE_NAME-$TRAVIS_BRANCH --depth=1
|
|
||||||
cp -a $FILES xash3d-deploy/
|
|
||||||
cd xash3d-deploy
|
|
||||||
git remote add travis-deploy-public https://FWGS-deployer:${GH_TOKEN}@github.com/FWGS/xash3d-deploy.git
|
|
||||||
}
|
|
||||||
|
|
||||||
init_repo_and_copy_files()
|
|
||||||
{
|
|
||||||
mkdir xash3d-deploy
|
|
||||||
cp -a $FILES xash3d-deploy
|
|
||||||
cd xash3d-deploy
|
|
||||||
git init
|
|
||||||
git remote add travis-deploy-public https://FWGS-deployer:${GH_TOKEN}@github.com/FWGS/xash3d-deploy.git
|
|
||||||
git checkout -b $SOURCE_NAME-$TRAVIS_BRANCH
|
|
||||||
}
|
|
||||||
|
|
||||||
push_until_success()
|
|
||||||
{
|
|
||||||
git push travis-deploy-public $SOURCE_NAME-$TRAVIS_BRANCH
|
|
||||||
|
|
||||||
# probably will never occur, just in case
|
|
||||||
count=0
|
|
||||||
while [ $? -ne 0 ] && [ $count -lt 5 ]
|
|
||||||
do
|
|
||||||
((count++))
|
|
||||||
sleep 20s
|
|
||||||
git pull travis-deploy-public $SOURCE_NAME-$TRAVIS_BRANCH -X theirs || die "Can't pull from repository!"
|
|
||||||
append_readme # Re-add lost readme lost during merge
|
|
||||||
commit_files
|
|
||||||
git push travis-deploy-public $SOURCE_NAME-$TRAVIS_BRANCH
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
generate_readme()
|
generate_readme()
|
||||||
{
|
{
|
||||||
echo \# $TRAVIS_BRANCH branch autobuilds from $SOURCE_NAME >> README.md
|
echo \# $TRAVIS_BRANCH branch autobuilds from $DEPLOY_BRANCH >> README.md
|
||||||
echo >> README.md
|
echo >> README.md
|
||||||
echo Short changelog: >> README.md
|
echo Short changelog: >> README.md
|
||||||
echo \`\`\` >> README.md
|
echo \`\`\` >> README.md
|
||||||
@ -81,10 +35,7 @@ generate_readme()
|
|||||||
echo $TRAVIS_COMMIT > commit.txt
|
echo $TRAVIS_COMMIT > commit.txt
|
||||||
}
|
}
|
||||||
|
|
||||||
SOURCE_NAME=$1
|
PUSHED_COMMIT=$(curl --fail https://raw.githubusercontent.com/FWGS/xash3d-deploy/$DEPLOY_BRANCH-$TRAVIS_BRANCH/commit.txt)
|
||||||
shift
|
|
||||||
|
|
||||||
PUSHED_COMMIT=$(curl --fail https://raw.githubusercontent.com/FWGS/xash3d-deploy/$SOURCE_NAME-$TRAVIS_BRANCH/commit.txt)
|
|
||||||
echo "Pushed commit: $PUSHED_COMMIT"
|
echo "Pushed commit: $PUSHED_COMMIT"
|
||||||
if [ ! -z "$PUSHED_COMMIT" ]; then
|
if [ ! -z "$PUSHED_COMMIT" ]; then
|
||||||
REV_RANGE="HEAD...$PUSHED_COMMIT"
|
REV_RANGE="HEAD...$PUSHED_COMMIT"
|
||||||
@ -97,18 +48,16 @@ git config --global user.email FWGS-deployer@users.noreply.github.com
|
|||||||
|
|
||||||
FILES=$*
|
FILES=$*
|
||||||
|
|
||||||
if [ "$TRAVIS_COMMIT" != "$PUSHED_COMMIT" ]; then
|
# Create new repo with new files
|
||||||
# Create new repo with new files
|
mkdir xash3d-deploy
|
||||||
init_repo_and_copy_files
|
cd xash3d-deploy
|
||||||
generate_readme
|
git init
|
||||||
commit_files
|
git remote add travis-deploy-public https://FWGS-deployer:${GH_TOKEN}@github.com/FWGS/xash3d-deploy.git
|
||||||
force_push
|
git checkout -b $DEPLOY_BRANCH-$TRAVIS_BRANCH
|
||||||
else
|
sh yadisk_download.sh $DEPLOY_BRANCH $FILES
|
||||||
# download repo and commit new files
|
generate_readme
|
||||||
download_repo_and_copy_files
|
git add .
|
||||||
append_readme
|
git commit -m "Latest travis deploy $TRAVIS_COMMIT"
|
||||||
commit_files
|
git push -q --force travis-deploy-public $DEPLOY_BRANCH-$TRAVIS_BRANCH >/dev/null 2>/dev/null
|
||||||
push_until_success
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
5
scripts/yadisk_clear.sh
Normal file
5
scripts/yadisk_clear.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
FOLDER_NAME=$DEPLOY_BRANCH-$TRAVIS_BRANCH
|
||||||
|
WEBDAV_SRV=https://$YANDEX_DISK_USER:$YANDEX_DISK_TOKEN@webdav.yandex.ru
|
||||||
|
|
||||||
|
curl -X DELETE $WEBDAV_SRV/$FOLDER_NAME
|
||||||
|
curl -X MKCOL $WEBDAV_SRV/$FOLDER_NAME
|
6
scripts/yadisk_download.sh
Normal file
6
scripts/yadisk_download.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
FOLDER_NAME=$DEPLOY_BRANCH-$TRAVIS_BRANCH
|
||||||
|
WEBDAV_SRV=https://$YANDEX_DISK_USER:$YANDEX_DISK_TOKEN@webdav.yandex.ru
|
||||||
|
|
||||||
|
for file in $*; do
|
||||||
|
curl -L $WEBDAV_SRV/$FOLDER_NAME/$file -o $file
|
||||||
|
done
|
6
scripts/yadisk_upload.sh
Normal file
6
scripts/yadisk_upload.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
FOLDER_NAME=$DEPLOY_BRANCH-$TRAVIS_BRANCH
|
||||||
|
WEBDAV_SRV=https://$YANDEX_DISK_USER:$YANDEX_DISK_TOKEN@webdav.yandex.ru
|
||||||
|
|
||||||
|
for file in $*; do
|
||||||
|
curl -T $file $WEBDAV_SRV/$FOLDER_NAME
|
||||||
|
done
|
Loading…
x
Reference in New Issue
Block a user