Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: repair Travis builds #208

Merged
merged 5 commits into from May 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -31,7 +31,7 @@ docs/apidoc_output/
pip-log.txt

# Unit test / coverage reports
.coverage*
.coverage
.tox
nosetests.xml

Expand Down
49 changes: 20 additions & 29 deletions .travis.yml
Expand Up @@ -2,15 +2,17 @@ language: python
sudo: required
dist: trusty

env:
global:
- GITHUB_REPO=biosustain/cameo

matrix:
fast_finish: true
include:
- python: '3.4'
- python: '3.5'
env: TOXENV=flake8
- python: '2.7'
env: TOXENV=py27
- python: '3.4'
env: TOXENV=py34
- python: '3.5'
env: TOXENV=py35
- python: '3.6'
Expand All @@ -21,7 +23,6 @@ branches:
- master
- devel
- devel-nonfree
- devel06
- /^[0-9]+\.[0-9]+\.[0-9]+[.0-9ab]*$/

cache:
Expand All @@ -33,39 +34,23 @@ services:
addons:
apt:
packages:
- swig
- libzmq3-dev
- libgmp-dev
- libglpk-dev
- glpk-utils
- pandoc
- openbabel

before_install:
- travis_retry pip install --upgrade pip setuptools wheel tox
- 'echo "this is a build for: $TRAVIS_BRANCH"'
- 'if [[ "$TRAVIS_BRANCH" != "devel" && ($TRAVIS_PYTHON_VERSION == "3.4" || $TRAVIS_PYTHON_VERSION == "2.7") ]]; then bash ./.travis/install_cplex.sh; fi'
- pip install --upgrade pip setuptools wheel tox
- bash ./.travis/install_cplex.sh

script:
- tox
- travis_wait tox

notifications:
slack:
rooms:
- biosustain:UGm09rOjMCgXko3rS3wUivoX
on_success: change
on_failure: change
before_deploy:
- pip install twine
- python setup.py sdist bdist_wheel
- if [[ $TRAVIS_PYTHON_VERSION == "3.6" ]]; then
pip install .[docs,jupyter];
cd docs && make apidoc && make html && touch _build/html/.nojekyll;
fi
- cd $TRAVIS_BUILD_DIR
env:
global:
secure: QgrOXEgpcH6xgToVfWIX6j6CPvycKMPtNnoYAxPrZjkMzd2aCHHeokv0FZkCn3uePO0I8W8TkKBxilGZbWYoseDq+Snds18sBTG9u2NHvYHnDQb4Oki7+NoxhlnGIOj/8ADONOpc0n7PyFDPK8zmKVZvv9p78OHZO5CmV/ktOeg=
- cd "${TRAVIS_BUILD_DIR}"

deploy:
- provider: pypi
user: Nikolaus.Sonnenschein
Expand All @@ -76,7 +61,7 @@ deploy:
on:
branch: master
tags: true
repo: biosustain/cameo
repo: $GITHUB_REPO
docs_dir: docs/_build/html
- provider: pages
fqdn: cameo.bio
Expand All @@ -89,14 +74,20 @@ deploy:
- master
- devel
condition: $TRAVIS_PYTHON_VERSION == "3.6"
repo: biosustain/cameo
repo: $GITHUB_REPO
# - provider: releases
# api_key:
# secure: VsKdkwYvp7lf65S/pzLWbrk8PaRAzBVClB57s4jYepx+BbJdPJi5Zwz4zmu0Ifa1K7K2Jh0rITV9GZAyC+0Eq2ffXtZsBOsC5+2yKaWV5WiU7kNdUVhD9EFkUaNknT8+B2/sjPsl+GP8DTzCqstgdGo5EAAnvpV53qIAwwF9n0U=
# file_glob: true
# file: dist/cameo*.whl
# skip_cleanup: true
# on:
# all_branches: true
# tags: true
# repo: biosustain/cameo
# repo: $GITHUB_REPO

notifications:
slack:
rooms:
- biosustain:UGm09rOjMCgXko3rS3wUivoX
on_success: change
on_failure: change
22 changes: 13 additions & 9 deletions .travis/install_cplex.sh
@@ -1,10 +1,14 @@
curl -L $SECRET_CPLEX_LINK -o cplex.tar.gz
tar xvf cplex.tar.gz
if [[ $TRAVIS_PYTHON_VERSION == "3.4" ]]; then
cd "cplex/python/3.4/x86-64_linux/";
#!/usr/bin/env bash

set -exu

# Build on master and tags.
# $CPLEX_URL is defined in the Travis repository settings.
if [[ ("${TRAVIS_BRANCH}" == "master" || -n "${TRAVIS_TAG}") \
&& ("${TRAVIS_PYTHON_VERSION}" == "2.7" || "${TRAVIS_PYTHON_VERSION}" == "3.5") ]];then
curl -L "${CPLEX_URL}" -o cplex.tar.gz
tar xzf cplex.tar.gz
cd "cplex/python/${TRAVIS_PYTHON_VERSION}/x86-64_linux"
python setup.py install
cd "${TRAVIS_BUILD_DIR}"
fi
if [[ $TRAVIS_PYTHON_VERSION == "2.7" ]]; then
cd "cplex/python/2.6/x86-64_linux/";
fi
pip install .
cd $TRAVIS_BUILD_DIR
5 changes: 2 additions & 3 deletions cameo/util.py
Expand Up @@ -30,7 +30,7 @@

import numpy
import pandas
import pip
import pkg_resources
import six
from cobra.util.context import HistoryManager
from numpy.random import RandomState
Expand Down Expand Up @@ -523,9 +523,8 @@ def wrapper(*args):


def get_system_info():
# pip freeze (adapted from http://stackoverflow.com/a/24322465/280182)
package_info = list()
for dist in pip.get_installed_distributions():
for dist in pkg_resources.working_set:
req = str(dist.as_requirement())
package_info.append(req)
return dict(package_info=package_info,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_flux_analysis.py
Expand Up @@ -422,7 +422,7 @@ def test_remove_cycles(self, core_model):
fix_objective_as_constraint(core_model)
original_objective = copy.copy(core_model.objective)
core_model.objective = core_model.solver.interface.Objective(
Add(*core_model.solver.variables.values()), name='Max all fluxes')
Add(*core_model.solver.variables.values()), name='Max_all_fluxes')
solution = core_model.optimize()
assert abs(solution.to_frame().fluxes.abs().sum() - 2508.293334) < 1e-6
fluxes = solution.fluxes
Expand Down