Merge branch 'master' into cmake
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
## New of branch to use
|
||||
TRAVIS_MAC_BRANCH=travis_mac_osx
|
||||
|
||||
## Only cross-compile on Mac the master branch
|
||||
test "$TRAVIS_BRANCH" != "master" && exit 0
|
||||
|
||||
## Configure Git to use OAuth token
|
||||
git config credential.helper "store --file=.git/credentials"
|
||||
echo "https://${GH_TOKEN}:@github.com" > .git/credentials
|
||||
git config --global user.name $GH_USER
|
||||
git config --global user.email $GH_EMAIL
|
||||
git remote set-url origin "https://${GH_TOKEN}@github.com/WagicProject/wagic.git"
|
||||
|
||||
## Delete remote Travis-Mac branch (if any)
|
||||
echo git branches = `git branch -r`
|
||||
#export REMOTE=$(git branch -r | grep "origin/$TRAVIS_MAC_BRANCH")
|
||||
#if [ "$REMOTE" = "origin/$TRAVIS_MAC_BRANCH" ]; then
|
||||
# echo "Removing old $TRAVIS_MAC_BRANCH branch"
|
||||
# # Delete remote branch
|
||||
# git branch -r -D "origin/$TRAVIS_MAC_BRANCH"
|
||||
# Push (delete) remote branch on temote server (e.g. github)
|
||||
git push origin --delete "$TRAVIS_MAC_BRANCH"
|
||||
#else
|
||||
# echo "$REMOTE : No $TRAVIS_MAC_BRANCH to remove"
|
||||
#fi
|
||||
|
||||
## Create a new branch
|
||||
git checkout -q -b "$TRAVIS_MAC_BRANCH" "$TRAVIS_BRANCH"
|
||||
|
||||
## Write a new Travis-CI configuration file
|
||||
cp tools/macos.travis.yml .travis.yml
|
||||
git add .travis.yml
|
||||
git commit -m "Auto-Updated Travis-CI configuration for Mac"
|
||||
## Push new branch to remote server
|
||||
git push -q origin $TRAVIS_MAC_BRANCH:$TRAVIS_MAC_BRANCH 2> /dev/null > /dev/null
|
||||
@@ -1,30 +0,0 @@
|
||||
language: objective-c
|
||||
|
||||
before_install:
|
||||
- brew update
|
||||
- brew install qt5
|
||||
- sudo pip install pyjavaproperties
|
||||
- sudo pip install github3.py
|
||||
- brew install dpkg ldid
|
||||
#- curl -s -f -L https://raw.github.com/r-plus/dotfiles/master/install_theos.sh | bash
|
||||
- mkdir theos
|
||||
- cd theos
|
||||
- git clone --recursive https://github.com/theos/theos.git
|
||||
- export THEOS="$TRAVIS_BUILD_DIR/theos"
|
||||
- cd ..
|
||||
- pwd
|
||||
- ls
|
||||
env:
|
||||
global:
|
||||
secure: "EBzr1+qjQsOhn0s+tcFmXR1jP9B0xiOSXuXbRXWZ1OEHNvp8+A5/pS84LYVFlaZqmxr5dApxvPtwhgLIUbQ3EPXm8LpC3KgSD4dS+9/QMbxhe5TK4oczgFRGcDTMJQZsCzhOh7hp3tbcbJg5Gp+VT7aFjFQSHDGwhzSJXsXwh/8="
|
||||
|
||||
script:
|
||||
- /usr/local/opt/qt5/bin/qmake projects/mtg/wagic-qt.pro CONFIG+=graphics
|
||||
- make -j 4 dmg
|
||||
- cd projects/mtg/iOS
|
||||
- make -j 4 package
|
||||
- cd ../../..
|
||||
|
||||
after_success:
|
||||
- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l wagic.dmg -r Wagic-macosx.dmg -b $TRAVIS_BRANCH
|
||||
- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/iOS/net.wagic_0.19.2-1_iphoneos-arm.deb -r Wagic-iOS.deb -b $TRAVIS_BRANCH
|
||||
@@ -25,12 +25,14 @@ if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
fi
|
||||
|
||||
# we create resource package
|
||||
cd projects/mtg/bin/Res
|
||||
python createResourceZip.py
|
||||
# if we let the zip here, Wagic will use it in the testsuite
|
||||
# and we'll get 51 failed test cases
|
||||
mv core_*.zip ../../../../core.zip
|
||||
cd ../../../..
|
||||
if [ "$BUILD_RES" = "YES" ] || [ "$BUILD_PSP" = "YES" ]; then
|
||||
cd projects/mtg/bin/Res
|
||||
python createResourceZip.py
|
||||
# if we let the zip here, Wagic will use it in the testsuite
|
||||
# and we'll get 51 failed test cases
|
||||
mv core_*.zip ../../../../core.zip
|
||||
cd ../../../..
|
||||
fi
|
||||
|
||||
# we're building a PSP binary here
|
||||
if [ "$BUILD_TYPE" = "PSP" ]; then
|
||||
@@ -54,30 +56,21 @@ if [ "$BUILD_TYPE" = "PSP" ]; then
|
||||
fi
|
||||
|
||||
# we're building an Android binary here
|
||||
if [ "$BUILD_TYPE" = "ANDROID" ]; then
|
||||
jdk_switcher use oraclejdk8
|
||||
mkdir build_android
|
||||
cd build_android
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=../CMakeModules/android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=android-10 ..
|
||||
make -j4
|
||||
cd ..
|
||||
if [ "$BUILD_ANDROID" = "YES" ]; then
|
||||
android-ndk-r22/ndk-build -C projects/mtg/Android -j4
|
||||
$ANDROID list targets
|
||||
$ANDROID update project -t 1 -p projects/mtg/Android
|
||||
ant debug -f projects/mtg/Android/build.xml
|
||||
fi
|
||||
|
||||
# we're building an Emscripten HTML here
|
||||
if [ "$BUILD_TYPE" = "Emscripten" ]; then
|
||||
mkdir build_emscripten
|
||||
cd build_emscripten
|
||||
emcmake cmake -DCMAKE_BUILD_TYPE=Debug ..
|
||||
emmake make
|
||||
cd ..
|
||||
fi
|
||||
|
||||
# we're building a Qt version with GUI here
|
||||
if [ "$BUILD_TYPE" = "Qt" ]; then
|
||||
mkdir build_qt_widget
|
||||
cd build_qt_widget
|
||||
cmake -Dbackend_qt_widget=ON -Dbackend_qt_console=OFF ..
|
||||
make -j4 wagic
|
||||
# we're building a linux Qt version with GUI here
|
||||
if [ "$BUILD_Qt" = "YES" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
mkdir qt-gui-build
|
||||
cd qt-gui-build
|
||||
$QMAKE ../projects/mtg/wagic-qt.pro CONFIG+=release CONFIG+=graphics
|
||||
make -j 4
|
||||
chmod -R 775 wagic
|
||||
zip linuxqtrelease.zip ./wagic
|
||||
cd ..
|
||||
|
||||
# let's try an Intel linux binary in debug text-mode-only
|
||||
@@ -92,19 +85,10 @@ if [ "$BUILD_TYPE" = "Qt" ]; then
|
||||
./../../build_qt_console/bin/wagic
|
||||
cd ../..
|
||||
fi
|
||||
|
||||
# we're building a SDL version
|
||||
if [ "$BUILD_TYPE" = "SDL" ]; then
|
||||
mkdir build_SDL
|
||||
cd build_SDL
|
||||
cmake -Dbackend_sdl=ON ..
|
||||
make -j4 wagic
|
||||
cd ..
|
||||
fi
|
||||
|
||||
# Let's launch de iOS cross-compilation
|
||||
if [ "$BUILD_TYPE" = "iOS" ]; then
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=CMakeModules/ios-theos.toolchain.cmake -DTHEOS_PATH=theos .
|
||||
cp projects/mtg/iOS/control .
|
||||
make -j4 -f makefile.ios package
|
||||
# we're building a mac Qt version with GUI here
|
||||
if [ "$BUILD_Qt" = "YES" ] && [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
mkdir qt-gui-build
|
||||
cd qt-gui-build
|
||||
$QMAKE ../projects/mtg/wagic-qt.pro CONFIG+=release CONFIG+=graphics
|
||||
make -j 4 dmg
|
||||
fi
|
||||
|
||||
@@ -1,44 +1,7 @@
|
||||
import sys
|
||||
import os
|
||||
import zipfile
|
||||
from pyjavaproperties import Properties
|
||||
from optparse import OptionParser
|
||||
from github3 import login
|
||||
|
||||
def checkRelease(repository, remote, branch):
|
||||
release = None
|
||||
for r in repository.iter_releases():
|
||||
if r.name == ('latest-' + branch) :
|
||||
release = r
|
||||
for a in r.assets :
|
||||
if a.name == remote :
|
||||
# need to delete the old release
|
||||
print '!deleting old release! -> ' + r.name
|
||||
r.delete()
|
||||
# need also to delete the tag (reference)
|
||||
ref = repository.ref('tags/latest-' + branch)
|
||||
ref.delete()
|
||||
release = None
|
||||
|
||||
if release is None:
|
||||
# now, we recreate a new one
|
||||
release = repository.create_release('latest-' + branch, branch, 'latest-' + branch,
|
||||
'Latest successful builds of the ' + branch + ' branch automatically uploaded by Travis or AppVeyor CI.',
|
||||
False,
|
||||
True)
|
||||
|
||||
return release
|
||||
|
||||
|
||||
def suffixFilename(filename, build):
|
||||
p = Properties();
|
||||
p.load(open('projects/mtg/build.number.properties'));
|
||||
minor = p['build.minor'];
|
||||
major = p['build.major'];
|
||||
point = p['build.point'];
|
||||
name, extension = os.path.splitext(filename)
|
||||
filename = name + '-' + major + minor + point + '-' + build + extension
|
||||
return filename
|
||||
from uritemplate import URITemplate
|
||||
import requests
|
||||
import time
|
||||
|
||||
def main():
|
||||
parser = OptionParser()
|
||||
@@ -50,27 +13,42 @@ def main():
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if (options.token and options.sha and options.local and options.remote and (options.branch == 'master' or options.branch == 'travis_mac_osx' or options.branch == 'cmake' )):
|
||||
gh = login(token = options.token)
|
||||
elif (options.branch != 'master' and options.branch != 'travis_mac_osx'):
|
||||
print '!branch is not master or travis_mac_osx! -> ' + options.branch
|
||||
print '-will not upload-'
|
||||
return
|
||||
if (options.token and options.local and options.remote):
|
||||
repo = 'WagicProject/wagic'
|
||||
access_token = options.token
|
||||
|
||||
r = requests.get('https://api.github.com/repos/{0}/releases/32638811'.format(repo))
|
||||
|
||||
upload_url = r.json()["upload_url"]
|
||||
assets_url = r.json()["assets_url"]
|
||||
|
||||
r = requests.get(assets_url)
|
||||
assets_num = len(r.json())
|
||||
asset_name = options.remote
|
||||
asset_id = 0
|
||||
for asset in r.json():
|
||||
if asset_name == asset["name"]:
|
||||
asset_id = asset["id"]
|
||||
|
||||
headers = {
|
||||
'Content-Type': 'application/gzip','Authorization': 'Token {0}'.format(access_token)
|
||||
}
|
||||
|
||||
asset_url = 'https://api.github.com/repos/{0}/releases/assets'.format(repo) + '/' + str(asset_id)
|
||||
r = requests.delete(asset_url, headers = headers, verify=False)
|
||||
|
||||
time.sleep(10)
|
||||
|
||||
t = URITemplate(upload_url)
|
||||
asset_url = t.expand(name = options.remote)
|
||||
r = requests.post(asset_url, headers = headers, data = open(options.local, 'rb').read(),verify=False)
|
||||
s = 'File ' + options.local + ' has been uploaded as ' + options.remote + '.'
|
||||
print s
|
||||
else:
|
||||
parser.print_help()
|
||||
return
|
||||
|
||||
repository = gh.repository('WagicProject', 'wagic')
|
||||
if(options.branch == 'master' or options.branch == 'travis_mac_osx'):
|
||||
r = checkRelease(repository, options.remote, 'master')
|
||||
else:
|
||||
r = checkRelease(repository, options.remote, 'cmake')
|
||||
|
||||
filename = options.remote
|
||||
with open(options.local, 'rb') as fd:
|
||||
asset = r.upload_asset('application/zip', filename , fd)
|
||||
s = 'File ' + options.local + ' has been uploaded as ' + asset.name + '.'
|
||||
print s
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user