Skip to content

Commit 7cb1b66

Browse files
authored
Merge pull request #135 from fnordahl/enable-py37
Enable deployment on Python 3.7 systems
2 parents 9a80d09 + 3129f24 commit 7cb1b66

13 files changed

+118
-6
lines changed

.travis.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
sudo: required
3+
dist: xenial
4+
language: python
5+
install: pip install tox-travis
6+
matrix:
7+
include:
8+
- name: "Python 3.4"
9+
python: 3.4
10+
env: ENV=flake8,py3
11+
- name: "Python 3.5"
12+
python: 3.5
13+
env: ENV=flake8,py3
14+
- name: "Python 3.6"
15+
python: 3.6
16+
env: ENV=flake8,py3
17+
- name: "Python 3.7"
18+
python: 3.7
19+
env: ENV=flake8,py3
20+
- name: "Functional test"
21+
env: ENV=func
22+
comment: |
23+
install dependencies in script phase saving time on simpler test environments
24+
sudo back to ourself to activate lxd group membership executable search path
25+
script:
26+
- if [ $ENV = 'func' ]; then
27+
sudo apt update;
28+
sudo apt install -y distro-info;
29+
sudo apt remove -y --purge lxd lxd-client;
30+
sudo snap install lxd;
31+
sudo snap install juju --classic;
32+
sudo snap install charm --classic;
33+
sudo sh -c 'echo PATH=/snap/bin:$PATH >> /etc/environment';
34+
sudo lxd waitready;
35+
sudo lxd init --auto;
36+
sudo usermod -a -G lxd travis;
37+
sudo su - travis -c 'juju bootstrap --no-gui localhost';
38+
fi
39+
- echo "export PATH=$PATH;cd $(pwd)" > $HOME/saved_path
40+
- sudo su - travis -c "source $HOME/saved_path; tox -c tox.ini -e $ENV";
41+
- if [ $ENV = 'func' ]; then
42+
sudo su travis -c 'juju status -m $(juju models --format yaml|grep "^- name:.*zaza"|cut -f2 -d/)';
43+
fi
44+
after_failure:
45+
- if [ $ENV = 'func' ]; then
46+
sudo su travis -c 'for application in trusty xenial bionic cosmic disco; do juju ssh -m $(juju models --format yaml|grep "^- name:.*zaza"|cut -f2 -d/) minimal-${application}/0 "sudo cat /var/log/juju/unit*.log";done';
47+
fi

layer.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
includes: ['layer:options']
2+
exclude: ['.travis.yml', 'tests', 'tox.ini', 'test-requirements.txt']
23
defines:
34
packages:
45
type: array
@@ -21,7 +22,7 @@ defines:
2122
to help avoid conflicts with other charms or libraries on the machine.
2223
include_system_packages:
2324
type: boolean
24-
default: true
25+
default: false
2526
description: >
2627
If using a virtual environment, allow the venv to see Python packages
2728
installed at the system level. This reduces isolation, but is necessary

test-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
charm-tools
2+
git+https://github.com/openstack-charmers/zaza.git#egg=zaza

tests/bundles/minimal.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
applications:
2+
minimal-trusty:
3+
series: trusty
4+
charm: /tmp/charm-builds/minimal
5+
num_units: 1
6+
minimal-xenial:
7+
series: xenial
8+
charm: /tmp/charm-builds/minimal
9+
num_units: 1
10+
minimal-bionic:
11+
series: bionic
12+
charm: /tmp/charm-builds/minimal
13+
num_units: 1
14+
minimal-disco:
15+
series: disco
16+
charm: /tmp/charm-builds/minimal
17+
num_units: 1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
comment: this bundle overlay intentionally left blank

tests/charm-minimal/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
options: {}

tests/charm-minimal/layer.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
includes: ['layer:basic']
2+
options:
3+
basic:
4+
packages: ['libffi-dev', 'libssl-dev']
5+
repo: https://github.com/juju-solutions/layer-basic.git

tests/charm-minimal/metadata.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: minimal
2+
summary: minimal charm used to functionally test layer-basic
3+
description: reactive charm with some tricky deps to test venv bootstrapping
4+
maintainer: Juju Developers <[email protected]>
5+
tags:
6+
- CI
7+
series:
8+
- trusty
9+
- xenial
10+
- bionic
11+
- disco
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import charmhelpers
2+
import charms.reactive as reactive
3+
4+
5+
@reactive.when_not('non-existent-flag')
6+
def status_set():
7+
charmhelpers.core.hookenv.status_set('active', 'Unit is ready')

tests/charm-minimal/wheelhouse.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cryptography

tests/tests.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
charm_name: minimal
2+
gate_bundles:
3+
- minimal
4+
tests:
5+
- zaza.charm_tests.noop.tests.NoopTest

tox.ini

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
skipsdist=True
3-
envlist = py34, py35
3+
envlist = flake8, py35, py36, py37
44
skip_missing_interpreters = True
55

66
[testenv]
@@ -11,5 +11,18 @@ commands = /bin/bash -c 'py.test -v || if [[ $? == 5 ]]; then true; else false;
1111
deps =
1212
-r{toxinidir}/requirements.txt
1313

14-
[flake8]
15-
exclude=docs
14+
[testenv:flake8]
15+
commands = flake8
16+
17+
[testenv:func]
18+
basepython = python3
19+
deps = -r{toxinidir}/test-requirements.txt
20+
whitelist_externals = ln mkdir readlink rm juju
21+
setenv = CHARM_LAYERS_DIR=/tmp/charm-builds/_tmp/layers
22+
passenv = HOME
23+
commands =
24+
/bin/rm -rf /tmp/charm-builds/_tmp /tmp/charm-builds/minimal
25+
/bin/mkdir -p /tmp/charm-builds/_tmp/layers
26+
/bin/bash -c '/bin/ln -sf $(readlink --canonicalize {toxinidir}) /tmp/charm-builds/_tmp/layers/layer-basic'
27+
charm-build tests/charm-minimal
28+
functest-run-suite --log DEBUG --keep-model

wheelhouse.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
pip>=7.0.0,<8.2.0
2-
setuptools>24.3,<=39.0.1
1+
pip>=18.1,<19.2
2+
setuptools<42
33
setuptools-scm<=1.17.0
44
charmhelpers>=0.4.0,<1.0.0
55
charms.reactive>=0.1.0,<2.0.0
6+
wheel<0.34

0 commit comments

Comments
 (0)