2
0
Эх сурвалжийг харах

build: start travis configuration

David Bernard 9 жил өмнө
parent
commit
eb0486ce1d
3 өөрчлөгдсөн 55 нэмэгдсэн , 0 устгасан
  1. 17 0
      .travis.yml
  2. 2 0
      README.adoc
  3. 36 0
      deploy_ghpages.sh

+ 17 - 0
.travis.yml

@@ -0,0 +1,17 @@
+language: java
+jdk:
+  - oraclejdk8
+#  blacklist
+branches:
+  except:
+    - gh-pages
+before_cache:
+  - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
+cache:
+  directories:
+    - $HOME/.gradle/caches/
+    - $HOME/.gradle/wrapper/
+script:
+   - ./gradlew clean asciidoc
+after_success:
+  - '[ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ] && ./deploy_ghpages.sh'

+ 2 - 0
README.adoc

@@ -1,3 +1,5 @@
+image:https://travis-ci.org/davidB/sandbox_wiki_jme.svg?branch=master["Build Status", link="https://travis-ci.org/davidB/sandbox_wiki_jme"]
+
 = jMonkeyEngine Documentation
 
 WARNING: The project is an experimental WIP for the documentation of jME3

+ 36 - 0
deploy_ghpages.sh

@@ -0,0 +1,36 @@
+#!/bin/bash
+#
+# Script for travis-ci to sync apidoc dir from master branch to gh-pages branch
+# based on :
+# * https://github.com/steveklabnik/automatically_update_github_pages_with_travis_example
+# * https://github.com/gemini-testing/gemini/pull/352/files
+
+set -o errexit -o nounset
+
+if [ "$TRAVIS_BRANCH" != "master" ] ; then
+  echo "This commit was made against the $TRAVIS_BRANCH and not the master! No deploy!"
+  exit 0
+fi
+
+
+rev=$(git rev-parse --short HEAD)
+repo=$(git config --local --get-all remote.origin.url | awk -F'[:/]' 'NF && NF-1 {print ($(NF-1)"/"$NF)}')
+
+echo -e "Starting to update gh-pages of ${repo} at ${rev}\n"
+
+# on Travis, can't optimize by cloning itself and define remote as upstream
+# travis> "attempt to fetch/clone from a shallow repository"
+# So need to do a full clone
+rm -Rf gh-pages
+git clone -b gh-pages --single-branch https://${GH_TOKEN}@github.com/${repo} gh-pages
+cd gh-pages
+
+rsync -avz --stats ../asciidoc/html5 .
+
+git config --local user.email "[email protected]"
+git config --local user.name "Travis"
+git add -A .
+git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed to gh-pages at ${rev}"
+git push origin gh-pages
+cd ..
+rm -Rf gh-pages