Skip to content

Commit 379b0f0

Browse files
committed
Merge pull request #173 from ropensci/carson-travis-hook
Carson travis hook
2 parents 4a3e8eb + 40e126e commit 379b0f0

File tree

3 files changed

+63
-3
lines changed

3 files changed

+63
-3
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ Rapp.history
55
.Rhistory
66
.RData
77
Makefile
8+
.Rproj.user
9+
*.Rproj

.push_test_table.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
3+
# -----------------------------------------------------------------------
4+
# When pushing to a pull request on GitHub, Travis does two builds:
5+
# (1) One for the pull request itself. In this case, $TRAVIS_PULL_REQUEST
6+
# is 'false' and $TRAVIS_BRANCH contains the branch name
7+
# (2) One to *simulate* a merge with master. In this case, $TRAVIS_PULL_REQUEST
8+
# is the pull ID number and $TRAVIS_BRANCH = 'master'
9+
#
10+
# Read more about Travis environment variables --
11+
# http://docs.travis-ci.com/user/ci-environment/
12+
# -----------------------------------------------------------------------
13+
14+
# Only build test table if $TRAVIS_PULL_REQUEST is false
15+
[ "${TRAVIS_PULL_REQUEST}" != "false" ] && exit 0
16+
17+
git config --global user.name "cpsievert"
18+
git config --global user.email "[email protected]"
19+
20+
# Since Travis does `git clone --branch=$TRAVIS_BRANCH --depth=50`,
21+
# we can't simply `git checkout master`. As far as I can tell, we are
22+
# forced to re-clone -- https://gist.github.com/cpsievert/698c7f1404f972782e71
23+
24+
cd ..
25+
rm -rf plotly/
26+
git clone https://github.com/ropensci/plotly.git
27+
cd plotly
28+
echo "user,SHA1,label" >> ../code_commits.csv
29+
echo "ropensci,`git rev-parse HEAD`,master" >> ../code_commits.csv
30+
git checkout $TRAVIS_BRANCH
31+
echo "ropensci,`git rev-parse HEAD`,${TRAVIS_BRANCH}" >> ../code_commits.csv
32+
Rscript -e "devtools::install()"
33+
34+
cd ..
35+
git clone https://github.com/ropensci/plotly-test-table.git
36+
cd plotly-test-table
37+
git checkout gh-pages
38+
39+
mv ../code_commits.csv .
40+
cat code_commits.csv
41+
make
42+
43+
# add, commit, push to gh-pages branch of plotly-test-table
44+
git add tables/*/*.html data/*/*.png
45+
git commit -a -m "Travis build number ${TRAVIS_BUILD_NUMBER} of ${TRAVIS_REPO_SLUG}"
46+
# This post explains how this works -- http://rmflight.github.io/posts/2014/11/travis_ci_gh_pages.html
47+
GH_REPO="@github.com/ropensci/plotly-test-table.git"
48+
FULL_REPO="https://${GH_TOKEN}${GH_REPO}"
49+
git pull $FULL_REPO gh-pages
50+
git push $FULL_REPO gh-pages

.travis.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
language: c
2-
script: "./travis-tool.sh run_tests"
2+
env:
3+
global:
4+
- secure: "cJ1bDRrAdIRjG+JnsQI9CdA4wQJhJJ2DdCNQ3frl8dotk69z61EiGCFW1Ir1cAY5V/NbHvFHp91HDiSo28ggwqRkEPBOGE44ico5gtVaELu3M/EnkWc2ZwQoN1273Vfdm26QYidqrvWrpLZ0XkFl7Q8xgvBswx30MF7y61+0Hv4="
35
before_script:
46
- curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh
57
- chmod 755 ./travis-tool.sh
6-
- "./travis-tool.sh bootstrap"
7-
- "./travis-tool.sh install_deps - ./travis-tool.sh install_r RCurl RJSONIO lattice"
8+
- chmod 755 ./.push_test_table.sh
9+
- ./travis-tool.sh bootstrap
10+
- ./travis-tool.sh install_deps
11+
- ./travis-tool.sh install_r RCurl RJSONIO lattice xtable
12+
script:
13+
- ./travis-tool.sh run_tests
14+
after_success:
15+
- ./.push_test_table.sh
816
notifications:
917
slack:
1018
secure: YvyGtGRFC4HJGD4d2Vx6fHU93EliJCHbcf/k9/Rbpl3wtYFZfWKbKL1FHvPw/g3auVebonz8hScnYzR0uYnR3dHSlmj3QrJ3NOePv5QAZRHy7aY/XKRr5JR1Ji/vX1yfbrJDmiYuGMxJVE8l/kbu0TxwDdLletY5nJpwlkHfaW8=

0 commit comments

Comments
 (0)