forked from canonical/layer-basic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
60 lines (60 loc) · 2 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
sudo: required
dist: xenial
language: python
install: pip install tox-travis
matrix:
include:
- name: "Python 3.4"
python: 3.4
env: ENV=flake8,py3
- name: "Python 3.5"
python: 3.5
env: ENV=flake8,py3
- name: "Python 3.6"
python: 3.6
env: ENV=flake8,py3
- name: "Python 3.7"
python: 3.7
env: ENV=flake8,py3
- name: "Python 3.8"
python: 3.8
env: ENV=flake8,py3
- name: "Functional test"
env: ENV=func
comment: |
install dependencies in script phase saving time on simpler test environments
change permissions on lxd socket to allow travis user access
(^^ this is a throw-away CI environment, do not do this at home)
script:
- if [ $ENV = 'func' ]; then
sudo apt update;
sudo apt install -y distro-info;
sudo apt remove -y --purge lxd lxd-client;
sudo snap install core;
sudo snap install lxd;
sudo snap install juju --classic;
sudo snap install charm --classic;
sudo sh -c 'echo PATH=/snap/bin:$PATH >> /etc/environment';
sudo lxd waitready;
sudo lxd init --auto;
cat .travis/profile-update.yaml | sudo lxc profile edit default;
sudo chmod 666 /var/snap/lxd/common/lxd/unix.socket;
juju bootstrap --no-gui localhost;
fi
- travis_wait 50 tox -c tox.ini -e $ENV
- if [ $ENV = 'func' ]; then
juju status -m $(juju models --format yaml|grep "^- name:.*zaza"|cut -f2 -d/);
fi
after_failure:
- if [ $ENV = 'func' ]; then
model=$(juju models --format yaml|grep "^- name:.*zaza"|cut -f2 -d/);
for application in trusty xenial bionic eoan focal; do
if juju status -m $model minimal-${application} | grep -q error; then
juju ssh -m $model minimal-${application}/0 "sudo cat /var/log/juju/unit*.log";
fi;
if juju status -m $model minimal-no-venv-${application} | grep -q error; then
juju ssh -m $model minimal-no-venv-${application}/0 "sudo cat /var/log/juju/unit*.log";
fi;
done;
fi