|
| 1 | +name: Integration test |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + integration: |
| 7 | + name: Integration |
| 8 | + runs-on: ubuntu-latest |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + python: |
| 12 | + - "3.8" |
| 13 | + - "3.9" |
| 14 | + - "3.10" |
| 15 | + steps: |
| 16 | + - name: Check out code |
| 17 | + uses: actions/checkout@v3 |
| 18 | + - name: Prepare environment |
| 19 | + with: |
| 20 | + juju-channel: "3.0/stable" |
| 21 | + run: | |
| 22 | + sudo mkdir -p ~/.config |
| 23 | + sudo chown -R $USER:$USER ~/.config |
| 24 | + sudo chmod -R 755 ~/.config |
| 25 | + sudo ls -l -R ~/.config |
| 26 | + attempts=0 |
| 27 | + while [ $attempts -lt 3 ]; do |
| 28 | + sudo snap install lxd && break || true |
| 29 | + attempts=$((attempts + 1)) |
| 30 | + done |
| 31 | + |
| 32 | + lxd waitready --timeout 120 |
| 33 | + sudo chmod 666 /var/snap/lxd/common/lxd/unix.socket |
| 34 | + lxd init --auto --network-address='[::]' --network-port=8443 |
| 35 | + lxc network set lxdbr0 ipv6.address none |
| 36 | +
|
| 37 | + lxc storage create juju-zfs dir source=/var/snap/lxd/common/lxd/storage-pools/juju-zfs |
| 38 | + lxc storage create juju-btrfs dir source=/var/snap/lxd/common/lxd/storage-pools/juju-btrfs |
| 39 | +
|
| 40 | + # TODO (stickupkid): we should be able to use security.priviledged="true", |
| 41 | + # but for some reason that doesn't work in 2 nested deep containers. So |
| 42 | + # instead we turn apparmor off, we should investigate why this doesn't work correctly. |
| 43 | + # lxc profile set default raw.lxc lxc.apparmor.profile=unconfined |
| 44 | +
|
| 45 | + attempts=0 |
| 46 | + while [ $attempts -lt 3 ]; do |
| 47 | + sudo snap install juju --channel "${JUJU_CHANNEL}" && break || true |
| 48 | + attempts=$((attempts + 1)) |
| 49 | + done |
| 50 | +
|
| 51 | + juju bootstrap localhost test \ |
| 52 | + --config 'identity-url=https://api.staging.jujucharms.com/identity' \ |
| 53 | + --config 'allow-model-access=true' \ |
| 54 | + --config 'test-mode=true' |
| 55 | + - name: Setup Python |
| 56 | + uses: actions/setup-python@v2 |
| 57 | + with: |
| 58 | + python-version: ${{ matrix.python }} |
| 59 | + - name: Install dependencies |
| 60 | + run: pip install tox |
| 61 | + - name: Run unit tests |
| 62 | + run: tox -e py3 |
| 63 | + - name: Run integration |
| 64 | + run: tox -e py3 -e integration,serial |
0 commit comments