Native charm support
[osm/N2VC.git] / modules / libjuju / .travis.yml
index 0e907f0..5edfef5 100644 (file)
@@ -1,30 +1,48 @@
-dist: trusty
+dist: xenial
 sudo: required
 language: python
-python:
-  - "3.6"
-before_script:
-  - sudo addgroup lxd || true
-  - sudo usermod -a -G lxd $USER || true
-  - sudo ln -s /snap/bin/juju /usr/bin/juju
-  - sudo ln -s /snap/bin/lxc /usr/bin/lxc
+cache: pip
 before_install:
-  - sudo add-apt-repository -y ppa:jonathonf/python-3.6
-  - sudo add-apt-repository ppa:chris-lea/libsodium -y
+  - if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then sudo add-apt-repository -y ppa:jonathonf/python-3.6; fi
+  - if [[ $TRAVIS_PYTHON_VERSION == '3.7-dev' ]]; then sudo add-apt-repository -y ppa:deadsnakes/ppa; fi
   - sudo apt-get update -q
   - sudo apt-get remove -qy lxd lxd-client
   - sudo apt-get install snapd libsodium-dev -y
-  - sudo snap install lxd || true
+install:
+  - sudo snap install lxd || true  # ignore failures so that unit tests will still run, at least
+  - sudo sh -c 'echo PATH=/snap/bin:$PATH >> /etc/environment';
+  - sudo snap install jq || true
+  - sudo snap install juju --classic --$JUJU_CHANNEL || true
   - sudo snap install juju-wait --classic || true
-install: pip install tox-travis
+  - pip install tox-travis
 env:
   global: >
     TEST_AGENTS='{"agents":[{"url":"https://api.staging.jujucharms.com/identity","username":"libjuju-ci@yellow"}],"key":{"private":"88OOCxIHQNguRG7zFg2y2Hx5Ob0SeVKKBRnjyehverc=","public":"fDn20+5FGyN2hYO7z0rFUyoHGUnfrleslUNtoYsjNSs="}}'
-  matrix:
-    - JUJU_CHANNEL=stable
-    - JUJU_CHANNEL=edge
+    PATH="/snap/bin:$PATH"
+
+matrix:
+  include:
+  - python: 3.6
+    env: JUJU_CHANNEL=edge
+  - python: 3.6
+    env: JUJU_CHANNEL=stable
+  - python: 3.7-dev
+    env: JUJU_CHANNEL=stable
+  - python: 3.7-dev
+    env: JUJU_CHANNEL=edge
+before_script:
+  # Run lint before performing more expensive operations (fail fast/early)
+  - tox -e lint
+
+  # init lxd for tests
+  - sudo lxd waitready --timeout 30
+  - sudo chmod 666 /var/snap/lxd/common/lxd/unix.socket
+  - lxd init --auto --network-address='[::]' --network-port=8443 --storage-backend=dir
+
+  # Horrible workaround to LP Bug #1738614
+  - sudo mkdir /var/snap/lxd/common/lxd/storage-pools/juju-zfs
+  - lxc storage create juju-zfs dir source=/var/snap/lxd/common/lxd/storage-pools/juju-zfs
+
 script:
-  - sudo snap install juju --classic --$JUJU_CHANNEL
-  - sudo ln -s /snap/bin/juju /usr/bin/juju || true
-  - sudo -E sudo -u $USER -E /snap/bin/juju bootstrap localhost test --config 'identity-url=https://api.staging.jujucharms.com/identity' --config 'allow-model-access=true'
-  - tox -e py35,integration
+  - juju bootstrap localhost test --config 'identity-url=https://api.staging.jujucharms.com/identity' --config 'allow-model-access=true'
+  - tox -e py3,integration,serial