From ae97abbf96c11daad3c7cb29387162c1f48ea5c3 Mon Sep 17 00:00:00 2001 From: xawotihs Date: Thu, 5 Dec 2013 21:21:08 +0100 Subject: [PATCH 1/7] Activates an automatic pre-release and binary upload from Travis. --- .travis.yml | 33 +++++++++++++++++++-------------- projects/mtg/build.xml | 8 +++++--- travis-script.sh | 5 +++++ upload-binaries.sh | 28 ++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 17 deletions(-) create mode 100644 upload-binaries.sh diff --git a/.travis.yml b/.travis.yml index 9430365de..937e6ba52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,22 @@ language: cpp before_install: - - export PSPDEV="$TRAVIS_BUILD_DIR/opt/pspsdk" - - export PSPSDK="$PSPDEV/psp/sdk" - - export PATH="$PATH:$PSPDEV/bin:$PSPSDK/bin" - - export ANDROID="android-sdk-linux/tools/android" +- export PSPDEV="$TRAVIS_BUILD_DIR/opt/pspsdk" +- export PSPSDK="$PSPDEV/psp/sdk" +- export PATH="$PATH:$PSPDEV/bin:$PSPSDK/bin" +- export ANDROID="android-sdk-linux/tools/android" install: - - sudo apt-get update -qq - - if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch; fi - - wget -O sdk.lzma http://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.11.2/minpspw_0.11.2-amd64.tar.lzma/download - - tar -x --xz -f sdk.lzma - - wget http://dl.google.com/android/ndk/android-ndk-r9-linux-x86_64.tar.bz2 -nv - - wget http://dl.google.com/android/android-sdk_r22-linux.tgz -nv - - tar --absolute-names -jxf android-ndk-r9-linux-x86_64.tar.bz2 - - tar -zxf android-sdk_r22-linux.tgz - - echo yes | $ANDROID update sdk --filter 1,2,3,8 --no-ui --force > log.txt -script: "./travis-script.sh" +- sudo apt-get update -qq +- if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm + ia32-libs ia32-libs-multiarch; fi +- wget -O sdk.lzma http://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.11.2/minpspw_0.11.2-amd64.tar.lzma/download +- tar -x --xz -f sdk.lzma +- wget http://dl.google.com/android/ndk/android-ndk-r9-linux-x86_64.tar.bz2 -nv +- wget http://dl.google.com/android/android-sdk_r22-linux.tgz -nv +- tar --absolute-names -jxf android-ndk-r9-linux-x86_64.tar.bz2 +- tar -zxf android-sdk_r22-linux.tgz +- echo yes | $ANDROID update sdk --filter 1,2,3,8 --no-ui --force > log.txt +script: ./travis-script.sh +env: + global: + secure: YocijVYZa1oDPviFubPIpmBmXyw0gQ7D0YA6tC01wExXvY+8tGUh1HQ5uXn8LotRZ+Ob5HLHDaCzkKWF8+57ILSMeHrnf6tcRyyeO7wjNY9P7WvSZyCjvqnWzsUN9tiMmsEzhTz2MaUgsY6ocB/4nbWZwfQvL7z+s7z41R4J1I4= +after_success: ./upload-binaries.sh \ No newline at end of file diff --git a/projects/mtg/build.xml b/projects/mtg/build.xml index ca8ae4e6a..b568ca50a 100644 --- a/projects/mtg/build.xml +++ b/projects/mtg/build.xml @@ -2,6 +2,7 @@ + @@ -76,15 +77,16 @@ Author: Michael Nguyen #define WAGIC_VERSION_MAJOR ${build.major} #define WAGIC_VERSION_MEDIUM ${build.minor} #define WAGIC_VERSION_MINOR ${build.point} +#define WAGIC_VERSION_REVISION ${env.TRAVIS_BUILD_NUMBER} -#define VERSION_DOT(a, b, c) a ##.## b ##.## c +#define VERSION_DOT(a, b, c, d) a ##.## b ##.## c ##.## d #define VERSION_WITHOUT_DOT(a, b, c) a ## b ## c -#define VERSION_GAME(a, b, c) VERSION_DOT(a, b, c) +#define VERSION_GAME(a, b, c, d) VERSION_DOT(a, b, c, d) #define VERSION_FILE(a, b, c) VERSION_WITHOUT_DOT(a, b, c) #define VERSION_TOSTRING(a) #a #define VERSION_STRINGIFY(a) VERSION_TOSTRING(a) -#define WAGIC_VERSION VERSION_GAME(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR) +#define WAGIC_VERSION VERSION_GAME(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR, WAGIC_VERSION_REVISION) #define WAGIC_RESOURCE_VERSION VERSION_FILE(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR) #define WAGIC_VERSION_STRING VERSION_STRINGIFY(WAGIC_VERSION) #define WAGIC_CORE_VERSION_STRING "core_" VERSION_STRINGIFY(WAGIC_RESOURCE_VERSION) diff --git a/travis-script.sh b/travis-script.sh index 17f0fbdec..d58b3e812 100755 --- a/travis-script.sh +++ b/travis-script.sh @@ -1,5 +1,10 @@ #!/bin/sh -ex +# updating versions with the TRAVIS build numbers +cd projects/mtg/ +ant update +cd ../.. + # we're building a PSP binary here cd JGE make -j 8 diff --git a/upload-binaries.sh b/upload-binaries.sh new file mode 100644 index 000000000..fb2373170 --- /dev/null +++ b/upload-binaries.sh @@ -0,0 +1,28 @@ +#!/bin/sh -ex + +if [ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "ci_upload_binaries"]; then + echo -e "Creating a release\n" + curl -X POST -H "Authorization: token ${GH_TOKEN}" -d '{"tag_name": "pre-release-${TRAVIS_BUILD_NUMBER}", "target_commitish": "master", "name": "pre-release-${TRAVIS_BUILD_NUMBER}", "body": "Automatic pre-release ${TRAVIS_BUILD_NUMBER}", "draft": true, "prerelease": true}' "https://api.github.com/repos/WagicProject/wagic/releases" + + #copy data we're interested in to other place + cp -R coverage $HOME/coverage + + #go to home and setup git + cd $HOME + git config --global user.email "travis@travis-ci.org" + git config --global user.name "Travis" + + #using token clone gh-pages branch + git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/Uko/Rubidium-WHOIS.git gh-pages > /dev/null + + #go into diractory and copy data we're interested in to that directory + cd gh-pages + cp -Rf $HOME/coverage/* . + + #add, commit and push files + git add -f . + git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed to gh-pages" + git push -fq origin gh-pages > /dev/null + + echo -e "Done magic with coverage\n" +fi From e9eb86488e0ccb3e1c007b24d5b38ebd69dcdd62 Mon Sep 17 00:00:00 2001 From: xawotihs Date: Thu, 5 Dec 2013 21:43:29 +0100 Subject: [PATCH 2/7] Redirect ant update errors to a file and push correct upload-binaries.sh --- travis-script.sh | 2 +- upload-binaries.sh | 31 +++++++++++-------------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/travis-script.sh b/travis-script.sh index d58b3e812..35f722ff2 100755 --- a/travis-script.sh +++ b/travis-script.sh @@ -2,7 +2,7 @@ # updating versions with the TRAVIS build numbers cd projects/mtg/ -ant update +ant update > error.txt cd ../.. # we're building a PSP binary here diff --git a/upload-binaries.sh b/upload-binaries.sh index fb2373170..f6bbaacc0 100644 --- a/upload-binaries.sh +++ b/upload-binaries.sh @@ -2,27 +2,18 @@ if [ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "ci_upload_binaries"]; then echo -e "Creating a release\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" -d '{"tag_name": "pre-release-${TRAVIS_BUILD_NUMBER}", "target_commitish": "master", "name": "pre-release-${TRAVIS_BUILD_NUMBER}", "body": "Automatic pre-release ${TRAVIS_BUILD_NUMBER}", "draft": true, "prerelease": true}' "https://api.github.com/repos/WagicProject/wagic/releases" + curl -X POST -H "Authorization: token ${GH_TOKEN}" \ + -d '{"tag_name": "pre-release-${TRAVIS_BUILD_NUMBER}", "target_commitish": "master", "name": "pre-release-${TRAVIS_BUILD_NUMBER}", "body": "Automatic pre-release ${TRAVIS_BUILD_NUMBER}", "draft": true, "prerelease": true}' "https://api.github.com/repos/WagicProject/wagic/releases" - #copy data we're interested in to other place - cp -R coverage $HOME/coverage + # Rename android release before upload + cp projects/mtg/Android/bin/Wagic-debug.apk release/Wagic-android-${TRAVIS_BUILD_NUMBER}.apk - #go to home and setup git - cd $HOME - git config --global user.email "travis@travis-ci.org" - git config --global user.name "Travis" + # Now we upload + curl -X POST -H "Authorization: token ${GH_TOKEN}" \ + -H "Accept: application/vnd.github.manifold-preview" \ + -H "Content-Type: application/zip" \ + --data-binary @release/Wagic-${TRAVIS_BUILD_NUMBER}.apk \ + "https://uploads.github.com/repos/WagicProject/wagic/releases/pre-release-${TRAVIS_BUILD_NUMBER}/assets?name=Wagic-android-${TRAVIS_BUILD_NUMBER}.apk" - #using token clone gh-pages branch - git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/Uko/Rubidium-WHOIS.git gh-pages > /dev/null - - #go into diractory and copy data we're interested in to that directory - cd gh-pages - cp -Rf $HOME/coverage/* . - - #add, commit and push files - git add -f . - git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed to gh-pages" - git push -fq origin gh-pages > /dev/null - - echo -e "Done magic with coverage\n" + echo -e "Done uploading\n" fi From 35fec3d9a0f9c741b3baf9b5e9a73874ef481649 Mon Sep 17 00:00:00 2001 From: xawotihs Date: Thu, 5 Dec 2013 22:05:31 +0100 Subject: [PATCH 3/7] Made upload-binaries executable --- upload-binaries.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 upload-binaries.sh diff --git a/upload-binaries.sh b/upload-binaries.sh old mode 100644 new mode 100755 From 826403a5122904435eaf202ddb7a20b98835cfc6 Mon Sep 17 00:00:00 2001 From: xawotihs Date: Thu, 5 Dec 2013 22:44:02 +0100 Subject: [PATCH 4/7] Fixed upload shell script --- upload-binaries.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/upload-binaries.sh b/upload-binaries.sh index f6bbaacc0..540817461 100755 --- a/upload-binaries.sh +++ b/upload-binaries.sh @@ -1,6 +1,5 @@ -#!/bin/sh -ex - -if [ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "ci_upload_binaries"]; then +if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then +if [ "$TRAVIS_BRANCH" == "ci_upload_binaries" ]; then echo -e "Creating a release\n" curl -X POST -H "Authorization: token ${GH_TOKEN}" \ -d '{"tag_name": "pre-release-${TRAVIS_BUILD_NUMBER}", "target_commitish": "master", "name": "pre-release-${TRAVIS_BUILD_NUMBER}", "body": "Automatic pre-release ${TRAVIS_BUILD_NUMBER}", "draft": true, "prerelease": true}' "https://api.github.com/repos/WagicProject/wagic/releases" @@ -17,3 +16,4 @@ if [ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "ci_upload_binarie echo -e "Done uploading\n" fi +fi From 30e86ffcd87e7a9e091a26e881a2e42849dbb0e6 Mon Sep 17 00:00:00 2001 From: xawotihs Date: Thu, 5 Dec 2013 23:09:06 +0100 Subject: [PATCH 5/7] Update script to handle better variables. --- upload-binaries.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upload-binaries.sh b/upload-binaries.sh index 540817461..52ac0768a 100755 --- a/upload-binaries.sh +++ b/upload-binaries.sh @@ -2,7 +2,7 @@ if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then if [ "$TRAVIS_BRANCH" == "ci_upload_binaries" ]; then echo -e "Creating a release\n" curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -d '{"tag_name": "pre-release-${TRAVIS_BUILD_NUMBER}", "target_commitish": "master", "name": "pre-release-${TRAVIS_BUILD_NUMBER}", "body": "Automatic pre-release ${TRAVIS_BUILD_NUMBER}", "draft": true, "prerelease": true}' "https://api.github.com/repos/WagicProject/wagic/releases" + -d '{"tag_name": "pre-release-'${TRAVIS_BUILD_NUMBER}'", "target_commitish": "master", "name": "pre-release-'${TRAVIS_BUILD_NUMBER}'", "body": "Automatic pre-release '${TRAVIS_BUILD_NUMBER}'", "draft": true, "prerelease": true}' "https://api.github.com/repos/WagicProject/wagic/releases" # Rename android release before upload cp projects/mtg/Android/bin/Wagic-debug.apk release/Wagic-android-${TRAVIS_BUILD_NUMBER}.apk From 74faa35b912c8c6d637fa3738cccb92615a6116b Mon Sep 17 00:00:00 2001 From: xawotihs Date: Thu, 5 Dec 2013 23:27:40 +0100 Subject: [PATCH 6/7] Removed useless local file copy before upload. --- upload-binaries.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/upload-binaries.sh b/upload-binaries.sh index 52ac0768a..c175deb13 100755 --- a/upload-binaries.sh +++ b/upload-binaries.sh @@ -4,14 +4,11 @@ if [ "$TRAVIS_BRANCH" == "ci_upload_binaries" ]; then curl -X POST -H "Authorization: token ${GH_TOKEN}" \ -d '{"tag_name": "pre-release-'${TRAVIS_BUILD_NUMBER}'", "target_commitish": "master", "name": "pre-release-'${TRAVIS_BUILD_NUMBER}'", "body": "Automatic pre-release '${TRAVIS_BUILD_NUMBER}'", "draft": true, "prerelease": true}' "https://api.github.com/repos/WagicProject/wagic/releases" - # Rename android release before upload - cp projects/mtg/Android/bin/Wagic-debug.apk release/Wagic-android-${TRAVIS_BUILD_NUMBER}.apk - # Now we upload curl -X POST -H "Authorization: token ${GH_TOKEN}" \ -H "Accept: application/vnd.github.manifold-preview" \ -H "Content-Type: application/zip" \ - --data-binary @release/Wagic-${TRAVIS_BUILD_NUMBER}.apk \ + --data-binary @projects/mtg/Android/bin/Wagic-debug.apk \ "https://uploads.github.com/repos/WagicProject/wagic/releases/pre-release-${TRAVIS_BUILD_NUMBER}/assets?name=Wagic-android-${TRAVIS_BUILD_NUMBER}.apk" echo -e "Done uploading\n" From 8100e390b1de0e8fffa0b17ef0e86118a7c497fc Mon Sep 17 00:00:00 2001 From: xawotihs Date: Fri, 6 Dec 2013 00:10:36 +0100 Subject: [PATCH 7/7] I'm starting to understand the stuff, the upload only works with a releaseId... --- upload-binaries.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upload-binaries.sh b/upload-binaries.sh index c175deb13..d6502e2ba 100755 --- a/upload-binaries.sh +++ b/upload-binaries.sh @@ -4,7 +4,7 @@ if [ "$TRAVIS_BRANCH" == "ci_upload_binaries" ]; then curl -X POST -H "Authorization: token ${GH_TOKEN}" \ -d '{"tag_name": "pre-release-'${TRAVIS_BUILD_NUMBER}'", "target_commitish": "master", "name": "pre-release-'${TRAVIS_BUILD_NUMBER}'", "body": "Automatic pre-release '${TRAVIS_BUILD_NUMBER}'", "draft": true, "prerelease": true}' "https://api.github.com/repos/WagicProject/wagic/releases" - # Now we upload + 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" \