Skip to content

Commit

Permalink
rewrote github pages deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
koffie committed Sep 6, 2017
1 parent 53ad108 commit c26d81d
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 20 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Os/editor stuff
*.swp

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -90,4 +93,3 @@ ENV/

/.travis_ci_gh_pages_deploy_key
/.travis_ci_gh_pages_deploy_key.pub
/gh-pages
61 changes: 50 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,62 @@
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
language: python

env:
global:
- DEPLOY_DOC_TO_DIRECTORY=/
- DEPLOY_DOC_FROM_DIRECTORY=docs/build/html
- SAGE_SERVER=http://mirrors.xmission.com/sage/

matrix:
include:
- env: CACHE_NAME=7.6 DEPLOY_DOC_FROM_BRANCH=master DEPLOY_DOC_TO_DIRECTORY=/ SAGE_SERVER=http://mirrors.xmission.com/sage/ SAGE_IMAGE=linux/64bit/sage-7.6-Ubuntu_12.04-x86_64.tar.bz2
- env: CACHE_NAME=7.5.1 SAGE_SERVER=http://mirrors.xmission.com/sage/ SAGE_IMAGE=linux/64bit/sage-7.5.1-Ubuntu_12.04-x86_64.tar.bz2
install:
- ./.travis-install.sh
script:
- ./.travis-test.sh
- env: CACHE_NAME=8.0 SAGE_IMAGE=linux/64bit/sage-8.0-Ubuntu_14.04-x86_64.tar.bz2 DEPLOY_DOC=true
dist: trusty
- env: CACHE_NAME=7.6 SAGE_IMAGE=linux/64bit/sage-7.6-Ubuntu_12.04-x86_64.tar.bz2
dist: precise
- env: CACHE_NAME=7.5.1 SAGE_IMAGE=linux/64bit/sage-7.5.1-Ubuntu_12.04-x86_64.tar.bz2
dist: precise
# the following environment is usefull if you just want to test travis
# without needing to wait very long for sage to install
# it causes the travis_scripts install.sh and test.sh to not execute.
- env: CACHE_NAME=NO_SAGE TEST_TRAVIS=true

cache:
directories:
- $HOME/SageMath
- $HOME/.cache/matplotlib
timeout: 1000

before_cache:
- rm -Rf $HOME/SageMath/logs $HOME/SageMath/.BUILDSTART
after_success:
- ./.travis-deploy-doc.sh
before_script:
- openssl aes-256-cbc -K $encrypted_f96cc3b3888c_key -iv $encrypted_f96cc3b3888c_iv
-in .travis_ci_gh_pages_deploy_key.enc -out .travis_ci_gh_pages_deploy_key -d || true

install:
- travis_scripts/install-sage.sh

addons:
apt:
packages:
# On 8.0 with trusty, Fortran compiler is needed.
# Otherwise, numpy cannot be imported.
# Also, optional package installs in .travis-install.sh will trigger build of sage gcc.
- gfortran

script:
- travis_scripts/test.sh
#add lines of the following type if you want to run aditional tests
#- some_command some_arguments


before_deploy:
- travis_scripts/get-key.sh
- openssl aes-256-cbc -K $encrypted_0fe3b59c4233_key -iv $encrypted_0fe3b59c4233_iv -in .travis_ci_gh_pages_deploy_key.enc -out .travis_ci_gh_pages_deploy_key -d

deploy:
provider: script
skip_cleanup: true
on:
branch: travis_check
condition: $DEPLOY_DOC = true
script: travis_scripts/deploy-doc.sh


Binary file removed .travis_ci_gh_pages_deploy_key.enc
Binary file not shown.
22 changes: 15 additions & 7 deletions .travis-deploy-doc.sh → travis_scripts/deploy-doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,32 @@
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
set -e
if [[ "${TRAVIS_PULL_REQUEST}" == "false" && "${TRAVIS_BRANCH}" == "${DEPLOY_DOC_FROM_BRANCH}" && -r .travis_ci_gh_pages_deploy_key ]]; then
if [[ -r .travis_ci_gh_pages_deploy_key ]]; then
if [[ -z "${DEPLOY_DOC_TO_REPOSITORY}" ]]; then
DEPLOY_DOC_TO_REPOSITORY="${TRAVIS_REPO_SLUG}"
fi
chmod 600 .travis_ci_gh_pages_deploy_key
eval `ssh-agent -s`
ssh-add .travis_ci_gh_pages_deploy_key < /dev/null
rm -Rf gh-pages
git clone --depth 1 git@github.com:${DEPLOY_DOC_TO_REPOSITORY}.git --depth 1 --branch=gh-pages gh-pages
BUILT_DOCS_DIR=`cd docs/build/html && pwd`
cd gh-pages
rm -f .travis_ci_gh_pages_deploy_key
rm -Rf $HOME/gh-pages
git clone --depth 1 git@github.com:${DEPLOY_DOC_TO_REPOSITORY}.git --branch=gh-pages $HOME/gh-pages
BUILT_DOCS_DIR=$TRAVIS_BUILD_DIR/$DEPLOY_DOC_FROM_DIRECTORY
echo "DEPLOY_DOC_FROM_DIRECTORY"
echo $DEPLOY_DOC_FROM_DIRECTORY
cd $HOME/gh-pages
touch .nojekyll
rm -Rf ./${DEPLOY_DOC_TO_DIRECTORY}/*
mkdir -p ./${DEPLOY_DOC_TO_DIRECTORY}
cp -R $BUILT_DOCS_DIR/* ./${DEPLOY_DOC_TO_DIRECTORY}/
git add --all .
git config user.name "Travis CI"
git config user.email "nobody@example.org"
git config user.name "Travis Deployment Script"
git config user.email "deploy@travis-ci.org"
if git commit -m "Automatic upload of documentation built from ${TRAVIS_COMMIT}"; then
git push origin gh-pages
fi
rm -Rf $HOME/gh-pages
exit
fi
echo "Error in docmumentation deployment: .travis_ci_gh_pages_deploy_key not found"
exit 1
6 changes: 6 additions & 0 deletions travis_scripts/get-key.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e
rm -rf $HOME/deploy_key
git clone --depth 1 https://github.com/${TRAVIS_REPO_SLUG}.git --branch=deploy_key $HOME/deploy_key
cp $HOME/deploy_key/.travis_ci_gh_pages_deploy_key.enc .
rm -rf $HOME/deploy_key
5 changes: 4 additions & 1 deletion .travis-install.sh → travis_scripts/install-sage.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#! /bin/sh
#!/bin/bash
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
if $TEST_TRAVIS ; then
exit;
fi
set -e
cd $HOME
if [ ! -x SageMath/sage ] ; then
Expand Down
3 changes: 3 additions & 0 deletions .travis-test.sh → travis_scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
if $TEST_TRAVIS ; then
exit;
fi
set -e
$HOME/SageMath/sage -pip install --upgrade --no-index -v .
$HOME/SageMath/sage setup.py test
Expand Down

0 comments on commit c26d81d

Please sign in to comment.