Add OSX to Travis matrix
authorgfyoung <redacted>
Thu, 29 Jun 2017 03:51:37 +0000 (20:51 -0700)
committergfyoung <redacted>
Thu, 29 Jun 2017 04:18:50 +0000 (21:18 -0700)
.travis.yml
ci/install_conda.sh [new file with mode: 0755]
ci/install_conda_env.sh [new file with mode: 0755]
ci/lint_repo.sh [new file with mode: 0755]
ci/test_repo.sh [new file with mode: 0755]

index 3793569291ead1148645ddd1619ccf47f36be67c..bd96fc668ee235389624ffd3a9914ff3cc58f0f2 100644 (file)
@@ -1,21 +1,33 @@
 notifications:
   email: false
 
-language: python
+language: generic
 
 sudo: false
 
 cache:
   directories:
-    - $HOME/.cache/pip
+    - $HOME/miniconda3
 
-python:
-  - "2.7"
-  - "3.6"
+before_cache:
+  - rm -rf $HOME/miniconda3/pkgs/cache
+  - rm -rf $HOME/miniconda3/envs/hosts
+
+os:
+  - linux
+  - osx
+
+env:
+  - PYTHON_VERSION="2.7"
+  - PYTHON_VERSION="3.6"
+
+before_install:
+  - export PATH="$HOME/miniconda3/bin:$PATH"
 
 install:
-  pip install flake8 mock nose
+  - ci/install_conda.sh
+  - ci/install_conda_env.sh
 
 script:
-  - nosetests
-  - flake8
+  - ci/test_repo.sh
+  - ci/lint_repo.sh
diff --git a/ci/install_conda.sh b/ci/install_conda.sh
new file mode 100755 (executable)
index 0000000..1236487
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+if [ -d "$HOME/miniconda3" ] && [ -e "$HOME/miniconda3/bin/conda" ]; then
+    echo "Miniconda install already present from cache: $HOME/miniconda3"
+    rm -rf $HOME/miniconda3/envs/hosts  # Just in case...
+else
+    echo "Installing Miniconda..."
+    rm -rf $HOME/miniconda3  # Just in case...
+
+    if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
+        wget http://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh || exit 1
+    else
+        wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh || exit 1
+    fi
+
+    bash miniconda.sh -b -p "$HOME/miniconda3" || exit 1
+fi
+
+echo "Configuring Miniconda..."
+conda config --set ssl_verify false || exit 1
+conda config --set always_yes true --set changeps1 false || exit 1
+
+echo "Updating Miniconda"
+conda update --all
+conda info -a || exit 1
diff --git a/ci/install_conda_env.sh b/ci/install_conda_env.sh
new file mode 100755 (executable)
index 0000000..36c3968
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+echo "Creating a Python $PYTHON_VERSION environment"
+conda create -n hosts python=$PYTHON_VERSION || exit 1
+source activate hosts
+
+echo "Installing packages..."
+conda install mock nose flake8
diff --git a/ci/lint_repo.sh b/ci/lint_repo.sh
new file mode 100755 (executable)
index 0000000..caecbe1
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+echo "Linting repository..."
+source activate hosts
+
+flake8
diff --git a/ci/test_repo.sh b/ci/test_repo.sh
new file mode 100755 (executable)
index 0000000..f918d9b
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+echo "Running unittests..."
+source activate hosts
+
+nosetests
git clone https://git.99rst.org/PROJECT