Skip to content

Commit

Permalink
Merge pull request #159 from kutaslab/0.4.6rc0
Browse files Browse the repository at this point in the history
release 0.4.6
  • Loading branch information
turbach authored Nov 7, 2019
2 parents 3963d11 + 1e29a94 commit 9194b2c
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 37 deletions.
35 changes: 14 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,42 +24,35 @@ script:
- pytest --cov=fitgrid
after_success:
- pip install codecov && codecov
before_deploy:
- pip install sphinx sphinx_rtd_theme jupyter nbsphinx nbconvert!=5.4
- conda install -c conda-forge pandoc
- pip install -e . # install fitgrid locally so it can be imported in the notebook
- conda list
- make -C docs html
- touch docs/build/html/.nojekyll
# before_deploy:
deploy:
- provider: script
skip_cleanup: true
script: bash ./ci/conda_upload.sh
on:
# all_branches: true # for testing
tags: true # restrict to vN.N.N tags
condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$
# all branches ok for testing, conda uploads can be deleted and
# filenames reused. branches other than vN.N.N are --label pre_release
# all_branches: true
tags: true
condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ # match vN.N.N

- provider: pages
verbose: true
# homegrown replacement for TravisCI gh_pages provider
- provider: script
skip_cleanup: true
github_token: $GITHUB_TOKEN
keep-history: true
script: bash ./ci/ghpages_upload.sh
on:
# all_branches: true # for testing
# all_branches: true # testing only
tags: true
condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$
target_branch: gh-pages # that's the default anyway, just to be explicit
local_dir: docs/build/html

- provider: pypi
skip_cleanup: true
user: "__token__"
password: $PYPI_TOKEN
on:
# do NOT test PyPI on all_branches. file names work like
# UUIDs on PyPI, can be deleted but not freed. Use unique
# N.N.N.devN, aN, bN, rcN versions if you must test deploy
# to PyPI
# do NOT test PyPI on all_branches. file names are UUIDs
# in PyPI repo database, can be deleted but not freed. Use
# unique (disposable?) N.N.N.devN, aN, bN, rcN versions if
# you must test deploy to PyPI
tags: true
condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$
27 changes: 14 additions & 13 deletions ci/conda_upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,20 @@ if [[ -z ${CONDA_DEFAULT_ENV} ]]; then
fi

# meant for a TravisCI deploy environment but easily tricked into running locally
# by setting these
if [[ "$TRAVIS" != "true" || -z "$TRAVIS_BRANCH" || -z "${PACKAGE_NAME}" ]]; then
echo "conda_upload.sh is meant to run on TravisCI"
exit -2
fi

# set the parent of conda-bld, the else isn't needed for TravisCI but
# simplifies local testing
if [ $USER = "travis" ]; then
bld_prefix="/home/travis/miniconda" # from the .travis.yml
else
bld_prefix=${CONDA_PREFIX}
fi
# as in .travis.yml or use bld_prefix=${CONDA_PREFIX} for local testing
bld_prefix="/home/travis/miniconda"

# on TravisCI there should be a single linux-64 package tarball. insist
tarball=`/bin/ls -1 ${bld_prefix}/conda-bld/linux-64/${PACKAGE_NAME}-*-*.tar.bz2`
n_tarballs=`echo "${tarball}" | wc -w`
if (( $n_tarballs != 1 )); then
echo "found $n_tarballs package tarballs there must be exactly 1"
echo "found $n_tarballs $PACKAGE_NAME tarballs there must be exactly 1"
echo "$tarball"
exit -3
fi
Expand All @@ -52,33 +48,38 @@ mmp=`echo $version | sed -n "s/\(\([0-9]\+\.\)\{1,2\}[0-9]\+\).*/\1/p"`
# * is the tag vMajor.Minor.Patch (TravisCI treats tagged commits as a branch)?
if [[ "${version}" = "$mmp" && $TRAVIS_BRANCH = v$mmp ]]; then
is_release="true"
conda install anaconda-client
label_param="--label main"
else
is_release="false"
label_param="--label pre_release"
fi

# POSIX trick sets $ANACONDA_TOKEN if unset or empty string
ANACONDA_TOKEN=${ANACONDA_TOKEN:-[not_set]}
conda_cmd="anaconda --token $ANACONDA_TOKEN upload ${tarball}"
conda_cmd="anaconda --token $ANACONDA_TOKEN upload ${tarball} ${label_param}"

# thus far ...
echo "conda meta.yaml version: $version"
echo "package name: $PACKAGE_NAME"
echo "conda-bld: ${bld_prefix}/conda-bld/linux-64"
echo "tarball: $tarball"
echo "travis tag: $TRAVIS_TAG"
echo "travis branch: $TRAVIS_BRANCH"
echo "is_release: $is_release"
echo "conda_label: ${label_param}"
echo "conda upload command: ${conda_cmd}"

# if the token is in the ENV and this is a vN.N.N tagged commit
# if the token is in the ENV
# attempt the upload
# else
# skip the upload and exit happy
#
# conda upload knows the destination from the token
if [[ $ANACONDA_TOKEN != "[not_set]" && $is_release = "true" ]]; then

echo "uploading to Anconda Cloud: $PACKAGE_NAME$ $version ..."
if [[ $ANACONDA_TOKEN != "[not_set]" ]]; then

echo "uploading to Anconda Cloud: $PACKAGE_NAME$ $version $TRAVIS_BRANCH $label_param ..."
conda install anaconda-client
if ${conda_cmd}; then
echo "OK"
else
Expand Down
62 changes: 62 additions & 0 deletions ci/ghpages_upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# ------------------------------------------------------------
# approach based on TravisCI gh_pages provider
# ------------------------------------------------------------

# ------------------------------------------------------------
# rebuild sphinx docs ... moved here from before_deploy:
# ------------------------------------------------------------
pip install sphinx sphinx_rtd_theme jupyter nbsphinx nbconvert!=5.4
conda install -c conda-forge pandoc
conda list
make -C docs html
touch docs/build/html/.nojekyll

# init with defaults in case ...
GITHUB_TOKEN=${GITHUB_TOKEN:-not_set}
TRAVIS_BRANCH=${TRAVIS_BRANCH:-null_branch}

# docs destination
git_repo=github.com/${TRAVIS_REPO_SLUG}
doc_branch="gh-pages"

user=${PACKAGE_NAME}_ghpages_bot
user_email="${user}@the.cloud.org"

# copy fresh docs to working dir
tmp_docs=/tmp/work/${TRAVIS_BRANCH}-$(date +%F-%N)
mkdir -p ${tmp_docs}
cp -rT docs/build/html $tmp_docs # T option else dotfiles .nojeckyll left behind
# ls -lR $tmp_docs

# bop over to the working dir to make a bare repo and orphan branch
cd ${tmp_docs}
echo "working in $(pwd)"

git init
git config --local user.name $user
git config --local user.email $user_email
git config --local -l

echo "checking out orphan branch ${doc_branch} ..."
if git checkout --orphan ${doc_branch}; then
echo "OK"
else
echo "failed"
fi

# commit and push the new docs
git add -A
git commit -a -m 'TravisCI rebuilt docs for gh-pages'

# --------------------------------------------------------------
# push the docs to github ... intercept github replies which may
# expose the token in the URL to the travis log
# --------------------------------------------------------------
reply=`git remote add origin https://${user}:${GITHUB_TOKEN}@${git_repo} 2>&1`
echo ${reply//${GITHUB_TOKEN}/} # strip github token(s) from fails

reply=`git push -u origin ${doc_branch} --force 2>&1`
echo ${reply//${GITHUB_TOKEN}/}

echo "Done"
exit 0
4 changes: 2 additions & 2 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set version = "0.4.5" %}
{% set version = "0.4.6" %}
{% set np_pin = "1.16.4" %}
{% set py_pin = "3.6" %}

Expand All @@ -14,7 +14,7 @@ build:
# setting string embeds git short SHA in conda tarball name
script: python setup.py install --single-version-externally-managed --record=record.txt
# github vN.N.N release builds are tagged with git short hash and conda build number, Travis deploys should be 0
string: {{ environ.get('GIT_BUILD_STR', "no_tags_on_travis_br") }}_{{ environ.get("PKG_BUILDNUM", "no_pkg_buildnum") }}
string: {{ environ.get('GIT_BUILD_STR', "no_GIT_BUILD_STR") }}_{{ environ.get("PKG_BUILDNUM", "no_PKG_BUILDNUM") }}

requirements:
# build:
Expand Down
2 changes: 1 addition & 1 deletion fitgrid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
from .models import run_model, lm, lmer
from . import utils, defaults

__version__ = "0.4.5"
__version__ = "0.4.6"

0 comments on commit 9194b2c

Please sign in to comment.