- Moved scripts in tools directory
- Added a Mac cross-compiling script
This commit is contained in:
47
tools/build-macos-script.sh
Normal file
47
tools/build-macos-script.sh
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
## New of branch to use
|
||||
TRAVIS_MAC_BRANCH=travis_mac_osx
|
||||
|
||||
## New Travis-CI configuration, adapted for Mac-OS
|
||||
NEW_TRAVIS_YML=\
|
||||
"language: objective-c
|
||||
before_install:
|
||||
- brew update
|
||||
- brew install qt5
|
||||
env:
|
||||
global:
|
||||
secure: "fJgWlCFbde96OSQNGKUmowGX+ERPeqP+n1EOMf1+FJzOU4DdkTLRAlV5+5qnEX9jB/3mWN6iPpmG1qEz/SdDG3KHxJYs4ZU/Lu485O24zZ/+GdYBNsrvhPD9ckPGEMLDa1foEVTDnW0Dlkz3BCFcszjhtXGUJv7v6Pj6LRk1Mg8="
|
||||
script:
|
||||
- /usr/local/opt/qt5/bin/qmake projects/mtg/wagic-qt.pro CONFIG+=graphics
|
||||
- make -j 4 dmg
|
||||
after_success:
|
||||
- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l wagic.dmg -r Wagic-macosx.dmg -b $TRAVIS_BRANCH"
|
||||
|
||||
## 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
|
||||
|
||||
## Delete remote Travis-Mac branch (if any)
|
||||
REMOTE=$(git branch -r | grep "origin/$TRAVIS_MAC_BRANCH\$")
|
||||
if test -n "$REMOTE" ; then
|
||||
# Delete remote branch
|
||||
git branch -r -D "origin/$TRAVIS_MAC_BRANCH"
|
||||
# Push (delete) remote branch on temote server (e.g. github)
|
||||
git push origin ":$TRAVIS_MAC_BRANCH"
|
||||
fi
|
||||
|
||||
## Create a new branch
|
||||
git checkout -q -b "$TRAVIS_MAC_BRANCH" "$TRAVIS_BRANCH"
|
||||
|
||||
## Write a new Travis-CI configuration file
|
||||
echo "$NEW_TRAVIS_YML" > .travis.yml
|
||||
git add .travis.yml
|
||||
git rm appveyor.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
|
||||
81
tools/travis-script.sh
Executable file
81
tools/travis-script.sh
Executable file
@@ -0,0 +1,81 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
# let's dump some info to debug a bit
|
||||
echo PSPDEV = $PSPDEV
|
||||
echo psp-config = `psp-config --psp-prefix`
|
||||
echo ls = `ls`
|
||||
echo pwd = `pwd`
|
||||
# computing potential release name
|
||||
echo TRAVIS_PULL_REQUEST = $TRAVIS_PULL_REQUEST
|
||||
echo TRAVIS_BRANCH = $TRAVIS_BRANCH
|
||||
|
||||
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
|
||||
if [ "$TRAVIS_BRANCH" = "alphas" ]; then
|
||||
export RELEASE_NAME="alpha-${TRAVIS_BUILD_NUMBER}"
|
||||
else if [ "$TRAVIS_BRANCH" = "master" ]; then
|
||||
export RELEASE_NAME="latest-master"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo RELEASE_NAME = $RELEASE_NAME
|
||||
|
||||
|
||||
# updating versions with the TRAVIS build numbers
|
||||
cd projects/mtg/
|
||||
ant update > error.txt
|
||||
cd ../..
|
||||
|
||||
# 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 ../../../..
|
||||
|
||||
# we're building a PSP binary here
|
||||
cd JGE
|
||||
make -j 8
|
||||
cd ..
|
||||
cd projects/mtg
|
||||
mkdir objs
|
||||
make -j 8
|
||||
mkdir WTH
|
||||
mkdir WTH/Res
|
||||
mv EBOOT.PBP WTH/
|
||||
mv ../../JGE/exceptionHandler/prx/exception.prx WTH/
|
||||
cp ../../core.zip WTH/Res
|
||||
cd WTH/Res
|
||||
unzip core.zip
|
||||
rm core.zip
|
||||
cd ..
|
||||
chmod -R 775 Res
|
||||
cd ..
|
||||
zip psprelease.zip -r WTH/
|
||||
cd ../..
|
||||
|
||||
# we're building an Android binary here
|
||||
android-ndk-r9/ndk-build -C projects/mtg/Android -j8
|
||||
$ANDROID list targets
|
||||
$ANDROID update project -t 1 -p projects/mtg/Android
|
||||
ant debug -f projects/mtg/Android/build.xml
|
||||
|
||||
# we're building a Qt version with GUI here
|
||||
mkdir qt-gui-build
|
||||
cd qt-gui-build
|
||||
$QMAKE ../projects/mtg/wagic-qt.pro CONFIG+=release CONFIG+=graphics
|
||||
make -j 8
|
||||
cd ..
|
||||
|
||||
# let's try an Intel linux binary in debug text-mode-only
|
||||
$QMAKE projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug DEFINES+=CAPTURE_STDERR
|
||||
make -j 8
|
||||
|
||||
# Now we run the testsuite (Res needs to be in the working directory)
|
||||
cd projects/mtg
|
||||
../../wagic
|
||||
cd ../..
|
||||
|
||||
# Let's launch de Mac cross-compilation
|
||||
./build-macos-script.sh
|
||||
67
tools/upload-binaries.py
Normal file
67
tools/upload-binaries.py
Normal file
@@ -0,0 +1,67 @@
|
||||
import sys
|
||||
import os
|
||||
import zipfile
|
||||
from pyjavaproperties import Properties
|
||||
from optparse import OptionParser
|
||||
from github3 import login
|
||||
|
||||
def checkRelease(repository, remote):
|
||||
release = None
|
||||
for r in repository.iter_releases():
|
||||
if r.name == 'latest-master' :
|
||||
release = r
|
||||
for a in r.assets :
|
||||
if a.name == remote :
|
||||
# need to delete the old release
|
||||
r.delete()
|
||||
# need also to delete the tag (reference)
|
||||
ref = repository.ref('tags/latest-master')
|
||||
ref.delete()
|
||||
release = None
|
||||
|
||||
if release is None:
|
||||
# now, we recreate a new one
|
||||
release = repository.create_release('latest-master', 'master', 'latest-master',
|
||||
'Latest successful builds of the master 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
|
||||
|
||||
def main():
|
||||
parser = OptionParser()
|
||||
parser.add_option("-t", "--token", help="TOKEN: specify authentication token to use", metavar="TOKEN", dest="token")
|
||||
parser.add_option("-s", "--sha", help="SHA: specify commit SHA", metavar="SHA", dest="sha")
|
||||
parser.add_option("-l", "--local", help="FILE: specify local file path to upload", metavar="LOCAL", dest="local")
|
||||
parser.add_option("-r", "--remote", help="NAME: specify remote asset name in the release.", metavar="REMOTE", dest="remote")
|
||||
parser.add_option("-b", "--branch", help="BRANCH: specify branch of the commit", metavar="BRANCH", dest="branch")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if (options.token and options.sha and options.local and options.remote and options.branch == 'master'):
|
||||
gh = login(token = options.token)
|
||||
else:
|
||||
parser.print_help()
|
||||
return
|
||||
|
||||
repository = gh.repository('WagicProject', 'wagic')
|
||||
r = checkRelease(repository, options.remote)
|
||||
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