Skip documentation update if CI build is invoked not on master branch.
Also: - Setup doxygen configuration on the fly to use minimal theme and to produce SVG instead of PNG. - Change how the GH_TOKEN is supplied as the GIT version in Travis VM (Ubuntu) does not seem to read the credentials from file store correctly. - Only generate site documentation after the CI build test has passed. - Add Ubuntu PPA to install a more recent version of Doxygen.
This commit is contained in:
parent
0b60fc327e
commit
4031b4b2e4
@ -1,7 +1,10 @@
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
before_install: sudo apt-get install -qq libx11-dev libxrandr-dev libasound2-dev libgl1-mesa-dev doxygen graphviz rsync
|
||||
script: ./cmake_gcc.sh -DENABLE_64BIT=1 -DENABLE_LUAJIT=1 -DENABLE_LUAJIT_AMALG=1 -DENABLE_SAMPLES=1 -DENABLE_TOOLS=1 -DENABLE_EXTRAS=1 -DENABLE_DOCS_QUIET=1 && cd Build && make
|
||||
before_install:
|
||||
- sudo add-apt-repository ppa:george-edison55/precise-backports -y
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq libx11-dev libxrandr-dev libasound2-dev libgl1-mesa-dev doxygen graphviz rsync
|
||||
script: ./cmake_gcc.sh -DENABLE_64BIT=1 -DENABLE_LUAJIT=1 -DENABLE_LUAJIT_AMALG=1 -DENABLE_SAMPLES=1 -DENABLE_TOOLS=1 -DENABLE_EXTRAS=1 && cd Build && make
|
||||
after_success: rake travis
|
||||
env:
|
||||
global:
|
||||
|
1061
Docs/minimal-doxygen.css
Normal file
1061
Docs/minimal-doxygen.css
Normal file
File diff suppressed because it is too large
Load Diff
0
Docs/minimal-footer.html
Normal file
0
Docs/minimal-footer.html
Normal file
5
Docs/minimal-header.html
Normal file
5
Docs/minimal-header.html
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
layout: page
|
||||
title: Documentation
|
||||
---
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
22
Rakefile
22
Rakefile
@ -1,32 +1,30 @@
|
||||
require "rubygems"
|
||||
|
||||
# Usage: NOT intended to be used manually (if you insist then try: GIT_NAME=... GIT_EMAIL=... GH_TOKEN=... rake travis)
|
||||
# Usage: NOT intended to be used manually (if you insist then try: GIT_NAME=... GIT_EMAIL=... GH_TOKEN=... TRAVIS_BRANCH=master rake travis)
|
||||
desc 'Update site documentation to GitHub Pages'
|
||||
task :travis do
|
||||
# Skip documentation update if it is a pull request
|
||||
if ENV['TRAVIS_PULL_REQUEST'].to_i > 0
|
||||
# Skip documentation update if it is a pull request or if it is a commit in topic branch
|
||||
if ENV['TRAVIS_PULL_REQUEST'].to_i > 0 or ENV['TRAVIS_BRANCH'] != 'master'
|
||||
next
|
||||
end
|
||||
# Pull or clone
|
||||
system 'cd doc-Build 2>/dev/null && git pull -q -r || git clone -q https://github.com/urho3d/urho3d.github.io.git doc-Build'
|
||||
# Update credits from Readme.txt to about.md
|
||||
system "ruby -lne 'BEGIN { credits = false }; puts $_ if credits; credits = true if /bugfixes by:/; credits = false if /^$/' Readme.txt |ruby -i -le 'BEGIN { credits = STDIN.read }; puts ARGF.read.gsub(/(?<=bugfixes by\n).*?(?=##)/m, credits)' doc-Build/about.md"
|
||||
# Setup doxygen to use minimal theme
|
||||
system "ruby -i -pe 'BEGIN { a = {%q{HTML_HEADER} => %q{minimal-header.html}, %q{HTML_FOOTER} => %q{minimal-footer.html}, %q{HTML_STYLESHEET} => %q{minimal-doxygen.css}, %q{HTML_COLORSTYLE_HUE} => 200, %q{HTML_COLORSTYLE_SAT} => 0, %q{HTML_COLORSTYLE_GAMMA} => 20, %q{DOT_IMAGE_FORMAT} => %q{svg}, %q{INTERACTIVE_SVG} => %q{YES}} }; a.each {|k, v| gsub(/\#{k}\s*?=.*?\n/, %Q{\#{k} = \#{v}\n}) }' Docs/Doxyfile"
|
||||
# Generate doxygen pages
|
||||
system 'cd Build && make doc &>/dev/null'
|
||||
# Sync generated doxygen pages (the trailing '/' is significant)
|
||||
# \todo Do this without leaving file changes history in GIT
|
||||
system 'rsync -a --delete Docs/html/ doc-Build/documentation'
|
||||
# Supply GIT credentials for pushing to GitHub
|
||||
system "cd doc-Build && git config user.name '#{ENV['GIT_NAME']}'"
|
||||
system "cd doc-Build && git config user.email '#{ENV['GIT_EMAIL']}'"
|
||||
system 'cd doc-Build && git config credential.helper "store --file=.git/credentials"'
|
||||
File.open('doc-Build/.git/credentials', 'w') do |f|
|
||||
f.write("https://#{ENV['GH_TOKEN']}:@github.com")
|
||||
end
|
||||
system "cd doc-Build && git add -A && git commit -q -a -m 'Travis CI automated site documentation update at #{Time.now.utc}.' && git push -q"
|
||||
system "cd doc-Build && git remote set-url --push origin https://#{ENV['GH_TOKEN']}@github.com/urho3d/urho3d.github.io.git"
|
||||
system "cd doc-Build && git add -A && git commit -q -a -m 'Travis CI: site documentation update at #{Time.now.utc}.' && git push -q"
|
||||
# Debug start
|
||||
system "echo GIT_NAME='#{ENV['GIT_NAME']}'"
|
||||
system "echo GIT_EMAIL='#{ENV['GIT_EMAIL']}'"
|
||||
system "GH_TOKEN='#{ENV['GH_TOKEN']}' echo GH_TOKEN=${GH_TOKEN:0:5}"
|
||||
system 'cd doc-Build && git config --list'
|
||||
system "echo GH_TOKEN=`echo '#{ENV['GH_TOKEN']}' |cut -c1-5`"
|
||||
# Debug end
|
||||
File.delete 'doc-Build/.git/credentials'
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user