Skip to content

Commit 9194b2c

Browse files
authored
Merge pull request #159 from kutaslab/0.4.6rc0
release 0.4.6
2 parents 3963d11 + 1e29a94 commit 9194b2c

File tree

5 files changed

+93
-37
lines changed

5 files changed

+93
-37
lines changed

.travis.yml

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,42 +24,35 @@ script:
2424
- pytest --cov=fitgrid
2525
after_success:
2626
- pip install codecov && codecov
27-
before_deploy:
28-
- pip install sphinx sphinx_rtd_theme jupyter nbsphinx nbconvert!=5.4
29-
- conda install -c conda-forge pandoc
30-
- pip install -e . # install fitgrid locally so it can be imported in the notebook
31-
- conda list
32-
- make -C docs html
33-
- touch docs/build/html/.nojekyll
27+
# before_deploy:
3428
deploy:
3529
- provider: script
3630
skip_cleanup: true
3731
script: bash ./ci/conda_upload.sh
3832
on:
39-
# all_branches: true # for testing
40-
tags: true # restrict to vN.N.N tags
41-
condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$
33+
# all branches ok for testing, conda uploads can be deleted and
34+
# filenames reused. branches other than vN.N.N are --label pre_release
35+
# all_branches: true
36+
tags: true
37+
condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ # match vN.N.N
4238

43-
- provider: pages
44-
verbose: true
39+
# homegrown replacement for TravisCI gh_pages provider
40+
- provider: script
4541
skip_cleanup: true
46-
github_token: $GITHUB_TOKEN
47-
keep-history: true
42+
script: bash ./ci/ghpages_upload.sh
4843
on:
49-
# all_branches: true # for testing
44+
# all_branches: true # testing only
5045
tags: true
5146
condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$
52-
target_branch: gh-pages # that's the default anyway, just to be explicit
53-
local_dir: docs/build/html
5447

5548
- provider: pypi
5649
skip_cleanup: true
5750
user: "__token__"
5851
password: $PYPI_TOKEN
5952
on:
60-
# do NOT test PyPI on all_branches. file names work like
61-
# UUIDs on PyPI, can be deleted but not freed. Use unique
62-
# N.N.N.devN, aN, bN, rcN versions if you must test deploy
63-
# to PyPI
53+
# do NOT test PyPI on all_branches. file names are UUIDs
54+
# in PyPI repo database, can be deleted but not freed. Use
55+
# unique (disposable?) N.N.N.devN, aN, bN, rcN versions if
56+
# you must test deploy to PyPI
6457
tags: true
6558
condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$

ci/conda_upload.sh

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,20 @@ if [[ -z ${CONDA_DEFAULT_ENV} ]]; then
1414
fi
1515

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

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

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

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

6461
# thus far ...
6562
echo "conda meta.yaml version: $version"
6663
echo "package name: $PACKAGE_NAME"
6764
echo "conda-bld: ${bld_prefix}/conda-bld/linux-64"
6865
echo "tarball: $tarball"
66+
echo "travis tag: $TRAVIS_TAG"
6967
echo "travis branch: $TRAVIS_BRANCH"
7068
echo "is_release: $is_release"
69+
echo "conda_label: ${label_param}"
7170
echo "conda upload command: ${conda_cmd}"
7271

73-
# if the token is in the ENV and this is a vN.N.N tagged commit
72+
# if the token is in the ENV
7473
# attempt the upload
7574
# else
7675
# skip the upload and exit happy
7776
#
7877
# conda upload knows the destination from the token
79-
if [[ $ANACONDA_TOKEN != "[not_set]" && $is_release = "true" ]]; then
8078

81-
echo "uploading to Anconda Cloud: $PACKAGE_NAME$ $version ..."
79+
if [[ $ANACONDA_TOKEN != "[not_set]" ]]; then
80+
81+
echo "uploading to Anconda Cloud: $PACKAGE_NAME$ $version $TRAVIS_BRANCH $label_param ..."
82+
conda install anaconda-client
8283
if ${conda_cmd}; then
8384
echo "OK"
8485
else

ci/ghpages_upload.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# ------------------------------------------------------------
2+
# approach based on TravisCI gh_pages provider
3+
# ------------------------------------------------------------
4+
5+
# ------------------------------------------------------------
6+
# rebuild sphinx docs ... moved here from before_deploy:
7+
# ------------------------------------------------------------
8+
pip install sphinx sphinx_rtd_theme jupyter nbsphinx nbconvert!=5.4
9+
conda install -c conda-forge pandoc
10+
conda list
11+
make -C docs html
12+
touch docs/build/html/.nojekyll
13+
14+
# init with defaults in case ...
15+
GITHUB_TOKEN=${GITHUB_TOKEN:-not_set}
16+
TRAVIS_BRANCH=${TRAVIS_BRANCH:-null_branch}
17+
18+
# docs destination
19+
git_repo=github.com/${TRAVIS_REPO_SLUG}
20+
doc_branch="gh-pages"
21+
22+
user=${PACKAGE_NAME}_ghpages_bot
23+
user_email="${user}@the.cloud.org"
24+
25+
# copy fresh docs to working dir
26+
tmp_docs=/tmp/work/${TRAVIS_BRANCH}-$(date +%F-%N)
27+
mkdir -p ${tmp_docs}
28+
cp -rT docs/build/html $tmp_docs # T option else dotfiles .nojeckyll left behind
29+
# ls -lR $tmp_docs
30+
31+
# bop over to the working dir to make a bare repo and orphan branch
32+
cd ${tmp_docs}
33+
echo "working in $(pwd)"
34+
35+
git init
36+
git config --local user.name $user
37+
git config --local user.email $user_email
38+
git config --local -l
39+
40+
echo "checking out orphan branch ${doc_branch} ..."
41+
if git checkout --orphan ${doc_branch}; then
42+
echo "OK"
43+
else
44+
echo "failed"
45+
fi
46+
47+
# commit and push the new docs
48+
git add -A
49+
git commit -a -m 'TravisCI rebuilt docs for gh-pages'
50+
51+
# --------------------------------------------------------------
52+
# push the docs to github ... intercept github replies which may
53+
# expose the token in the URL to the travis log
54+
# --------------------------------------------------------------
55+
reply=`git remote add origin https://${user}:${GITHUB_TOKEN}@${git_repo} 2>&1`
56+
echo ${reply//${GITHUB_TOKEN}/} # strip github token(s) from fails
57+
58+
reply=`git push -u origin ${doc_branch} --force 2>&1`
59+
echo ${reply//${GITHUB_TOKEN}/}
60+
61+
echo "Done"
62+
exit 0

conda/meta.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% set version = "0.4.5" %}
1+
{% set version = "0.4.6" %}
22
{% set np_pin = "1.16.4" %}
33
{% set py_pin = "3.6" %}
44

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

1919
requirements:
2020
# build:

fitgrid/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
from .models import run_model, lm, lmer
99
from . import utils, defaults
1010

11-
__version__ = "0.4.5"
11+
__version__ = "0.4.6"

0 commit comments

Comments
 (0)