From 16dcf3cc5ecdc2500d86f060492a34603abd3a08 Mon Sep 17 00:00:00 2001 From: xawotihs Date: Sun, 7 Dec 2014 16:02:56 +0100 Subject: [PATCH] - Moved scripts in tools directory - Added a Mac cross-compiling script --- .travis.yml | 8 +- appveyor.yml | 2 +- tools/build-macos-script.sh | 47 +++++++++ travis-script.sh => tools/travis-script.sh | 25 +---- .../upload-binaries.py | 0 upload-binaries.sh | 99 ------------------- 6 files changed, 55 insertions(+), 126 deletions(-) create mode 100644 tools/build-macos-script.sh rename travis-script.sh => tools/travis-script.sh (74%) rename upload-binaries.py => tools/upload-binaries.py (100%) delete mode 100755 upload-binaries.sh diff --git a/.travis.yml b/.travis.yml index ece4fd393..73f3ec230 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,9 +30,9 @@ env: global: secure: "fJgWlCFbde96OSQNGKUmowGX+ERPeqP+n1EOMf1+FJzOU4DdkTLRAlV5+5qnEX9jB/3mWN6iPpmG1qEz/SdDG3KHxJYs4ZU/Lu485O24zZ/+GdYBNsrvhPD9ckPGEMLDa1foEVTDnW0Dlkz3BCFcszjhtXGUJv7v6Pj6LRk1Mg8=" -script: "./travis-script.sh" +script: "tools/travis-script.sh" after_success: -- python upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l core.zip -r Wagic-core.zip -b $TRAVIS_BRANCH -- python upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/Android/bin/Wagic-debug.apk -r Wagic-android.apk -b $TRAVIS_BRANCH -- python upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/psprelease.zip -r Wagic-psp.zip -b $TRAVIS_BRANCH +- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l core.zip -r Wagic-core.zip -b $TRAVIS_BRANCH +- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/Android/bin/Wagic-debug.apk -r Wagic-android.apk -b $TRAVIS_BRANCH +- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/psprelease.zip -r Wagic-psp.zip -b $TRAVIS_BRANCH diff --git a/appveyor.yml b/appveyor.yml index a0802bbc0..41490b4c9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -61,7 +61,7 @@ after_deploy: # to run your custom scripts instead of provider deployments deploy_script: - - "C:/Python27/python.exe upload-binaries.py -t %GH_TOKEN% -s %APPVEYOR_REPO_COMMIT% -l projects/mtg/bin/Wagic-windows.zip -r Wagic-windows.zip -b %APPVEYOR_REPO_BRANCH%" + - "C:/Python27/python.exe tools/upload-binaries.py -t %GH_TOKEN% -s %APPVEYOR_REPO_COMMIT% -l projects/mtg/bin/Wagic-windows.zip -r Wagic-windows.zip -b %APPVEYOR_REPO_BRANCH%" # to disable deployment #deploy: off diff --git a/tools/build-macos-script.sh b/tools/build-macos-script.sh new file mode 100644 index 000000000..c7cc35fee --- /dev/null +++ b/tools/build-macos-script.sh @@ -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 diff --git a/travis-script.sh b/tools/travis-script.sh similarity index 74% rename from travis-script.sh rename to tools/travis-script.sh index 3cd466e71..73b03e457 100755 --- a/travis-script.sh +++ b/tools/travis-script.sh @@ -72,29 +72,10 @@ cd .. $QMAKE projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug DEFINES+=CAPTURE_STDERR make -j 8 -# we're cross-compiling a Qt Windows version here, -# PATH is only set here to prevent colision - -# export PATH="$PATH:/opt/mingw32/bin" -# mkdir build -# cd build -# mkdir win-cross -# cd win-cross -# /opt/mingw32/bin/qmake ../../projects/mtg/wagic-qt.pro CONFIG+=release CONFIG+=graphics -# make -j 8 -# cd release -# cp ../../../projects/mtg/bin/fmod.dll . -# cp /opt/mingw32/bin/QtCore4.dll . -# cp /opt/mingw32/bin/QtGui4.dll . -# cp /opt/mingw32/bin/QtNetwork4.dll . -# cp /opt/mingw32/bin/QtOpenGL4.dll . -# cp ../../../projects/mtg/bin/zlib1.dll . -# cp /opt/mingw32/bin/libpng15-15.dll . -# cd .. -# zip win-cross.zip -r release/ -# cd ../.. - # 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 diff --git a/upload-binaries.py b/tools/upload-binaries.py similarity index 100% rename from upload-binaries.py rename to tools/upload-binaries.py diff --git a/upload-binaries.sh b/upload-binaries.sh deleted file mode 100755 index 272b4771d..000000000 --- a/upload-binaries.sh +++ /dev/null @@ -1,99 +0,0 @@ -if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then -if [ "$TRAVIS_BRANCH" == "alphas" ]; then - echo -e "Creating a release\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -d '{"tag_name": "alpha-'${TRAVIS_BUILD_NUMBER}'", "target_commitish": "master", "name": "Alpha release number '${TRAVIS_BUILD_NUMBER}'", "body": "Automatic alpha release generated by Travis CI", "draft": false, "prerelease": true}' "https://api.github.com/repos/WagicProject/wagic/releases" > json.txt - IDDI=`cat json.txt | jq '.id'` - - echo -e "Uploading Core resources\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -H "Accept: application/vnd.github.manifold-preview" \ - -H "Content-Type: application/zip" \ - --data-binary @core.zip \ - "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-core.zip" - - echo -e "Uploading android package\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -H "Accept: application/vnd.github.manifold-preview" \ - -H "Content-Type: application/zip" \ - --data-binary @projects/mtg/Android/bin/Wagic-debug.apk \ - "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-android.apk" - - echo -e "Uploading PSP package\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -H "Accept: application/vnd.github.manifold-preview" \ - -H "Content-Type: application/zip" \ - --data-binary @projects/mtg/psprelease.zip \ - "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-psp.zip" - -# echo -e "Uploading Windows package\n" -# curl -X POST -H "Authorization: token ${GH_TOKEN}" \ -# -H "Accept: application/vnd.github.manifold-preview" \ -# -H "Content-Type: application/zip" \ -# --data-binary @build/win-cross/win-cross.zip \ -# "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-windows.zip" - - echo -e "Done uploading\n" -fi -fi - -if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then -if [ "$TRAVIS_BRANCH" == "master" ]; then - - # get info about all releases - echo -e "Getting info about previous releases" - curl -X GET -H "Authorization: token ${GH_TOKEN}" \ - "https://api.github.com/repos/WagicProject/wagic/releases" > json.txt - - # extract info only about only "latest-release" tag - cat json.txt |jq 'map(select (.tag_name == "latest-master"))' > latest.txt - - # get id of release - ID_TO_DELETE=`cat latest.txt |jq '.[0].id'` - - # delete previous release - echo -e "Deleting release number ${ID_TO_DELETE}" - curl -X DELETE -H "Authorization: token ${GH_TOKEN}" \ - "https://api.github.com/repos/WagicProject/wagic/releases/${ID_TO_DELETE}" - - # delete previous tag - curl -X DELETE -H "Authorization: token ${GH_TOKEN}" \ - "https://api.github.com/repos/WagicProject/wagic/git/refs/tags/latest-master" - - - echo -e "Creating a release\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -d '{"tag_name": "latest-master", "target_commitish": "master", "name": "master-'${TRAVIS_BUILD_NUMBER}'", "body": "Automatic release based on latest commit to master branch generated by Travis CI", "draft": false, "prerelease": true}' "https://api.github.com/repos/WagicProject/wagic/releases" > json.txt - IDDI=`cat json.txt | jq '.id'` - - echo -e "Uploading Core resources\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -H "Accept: application/vnd.github.manifold-preview" \ - -H "Content-Type: application/zip" \ - --data-binary @core.zip \ - "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-core.zip" - - echo -e "Uploading android package\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -H "Accept: application/vnd.github.manifold-preview" \ - -H "Content-Type: application/zip" \ - --data-binary @projects/mtg/Android/bin/Wagic-debug.apk \ - "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-android.apk" - - echo -e "Uploading PSP package\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -H "Accept: application/vnd.github.manifold-preview" \ - -H "Content-Type: application/zip" \ - --data-binary @projects/mtg/psprelease.zip \ - "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-psp.zip" - -# echo -e "Uploading Windows package\n" -# curl -X POST -H "Authorization: token ${GH_TOKEN}" \ -# -H "Accept: application/vnd.github.manifold-preview" \ -# -H "Content-Type: application/zip" \ -# --data-binary @build/win-cross/win-cross.zip \ -# "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-windows.zip" - - echo -e "Done uploading\n" -fi -fi