-
Notifications
You must be signed in to change notification settings - Fork 47
134 lines (130 loc) · 4.11 KB
/
tox.yaml
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Python package
on:
- push
- pull_request
jobs:
build_old_versions:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['3.6']
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install codecov tox tox-gh-actions
- name: Lint with tox
run: tox -e pep8
- name: Test with tox
run: tox -e py
- name: Codecov
run: |
set -euxo pipefail
codecov --verbose --gcov-glob unit_tests/*
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.10', '3.11']
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install codecov tox tox-gh-actions
- name: Lint with tox
run: tox -e pep8
- name: Test with tox
run: tox -e py3
- name: Codecov
run: |
set -euxo pipefail
codecov --verbose --gcov-glob unit_tests/*
func:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
juju_channel:
- 2.9/stable
- 3.1/stable
- 3.2/stable
- 3.3/stable
bundle:
- first
- second
- third
include:
- juju_channel: 2.9/stable
snap_install_flags: "--classic"
pip_constraints: constraints-juju29.txt
- juju_channel: 3.1/stable
snap_install_flags: ""
pip_constraints: constraints-juju31.txt
- juju_channel: 3.2/stable
snap_install_flags: ""
pip_constraints: constraints-juju32.txt
- juju_channel: 3.3/stable
snap_install_flags: ""
pip_constraints: constraints-juju33.txt
env:
TEST_ZAZA_BUG_LP1987332: "on" # http://pad.lv/1987332
needs: build
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -yq snapd
sudo systemctl enable snapd
sudo systemctl restart snapd
python -m pip install --upgrade pip
pip install tox tox-gh-actions
sudo snap install ${{ matrix.snap_install_flags }} --channel ${{ matrix.juju_channel }} juju
sudo snap install --classic juju-crashdump
sudo lxd init --auto
# This is a throw-away CI environment, do not do this at home
sudo chmod 666 /var/snap/lxd/common/lxd/unix.socket
# until Juju provides stable IPv6-support we unfortunately need this
lxc network set lxdbr0 ipv6.address none
sudo iptables -F FORWARD
sudo iptables -P FORWARD ACCEPT
# pull images
lxc image copy --alias juju/bionic/amd64 --copy-aliases ubuntu-daily:bionic local:
lxc image copy --alias juju/focal/amd64 --copy-aliases ubuntu-daily:focal local:
lxc image copy --alias juju/jammy/amd64 --copy-aliases ubuntu-daily:jammy local:
lxc image list
juju bootstrap localhost
- name: Functional test
run: |
set -euxo pipefail
mkdir logs
export PIP_CONSTRAINTS=$(pwd)/${{ matrix.pip_constraints }}
tox -e func-target -- ${{ matrix.bundle }} | tee logs/tox-output.txt
- name: crashdump on failure
if: failure()
run: |
set -eux
juju models
model=$(juju models --format yaml|grep "^- name:.*zaza"|cut -f2 -d/)
juju status -m $model | tee logs/juju-status.txt
juju crashdump -m $model -o logs/
- name: upload logs on failure
if: failure()
uses: actions/upload-artifact@v2
with:
name: test-run-logs-and-crashdump
path: logs/
- name: consider debugging
uses: lhotari/action-upterm@v1
if: failure()