How to setup a github action to deploy, relate?

I’m trying to setup a simple github CI tests for Nextcloud that:

juju deploy nextcloud
juju deploy postgresql
juju relate nextcloud:database postgresql

Waits for some time, and gets “OK” if the status is all “active” within 5 minutes.

Here is my not-yet-functional attempt at this. https://github.com/erik78se/nextcloud-ci/blob/4440db0ecfb2753cd5ad1d21866625912cb0f7dd/.github/workflows/blank.yml

My issue is that the boostrapped container seems to still have ipv6 so package updates etc. fails.

Anyone that has experience in doing deployment tests with github that can assist here?

@carlcsaposs @taurus ?

Hi Erik,

I would suggest instead using the canonical/setup-lxd GitHub Action to set up LXD on the runner. Admittedly I’m biased here, since I created and maintain the action, but I created it for exactly this purpose - so you don’t have to spend hours screwing around trying to get LXD to work.

Why do you need to disable IPv6? It shouldn’t be necessary IMO. Looking at the test run, it just looks like the container couldn’t access the network. It failed on the IPv4 address too, so I don’t think it has anything to do with IPv4/v6. (Maybe you didn’t set up your iptables rules so that LXD can work alongside Docker - canonical/setup-lxd does this all for you).

Re: your general inquiry, you can look at the Juju repo for some (usually successful) examples of GitHub Actions which can bootstrap Juju and deploy stuff. Most decent charms will also have such an action in their CI.

You might also be interested in charmed-kubernetes/actions-operator which installs and bootstraps Juju for you - I think this is used by many charms in their CI. Also, check out

for some useful tools that charm authors can use in CI.

2 Likes

@tmihoc: do we have any documentation on setting up GitHub CI for your charm? If not, I think it would be nice to add - it’s an important topic for authors of serious charms. Probably better to source this from the charming community, as I (on the Juju side) have no idea what patterns charm authors tend to use for CI.

1 Like

I think what you’re trying to run is an integration test (at least we call it that). The CI should set up the infrastructure, but what we usually do is delegate the test running to a specialized framework (usually the stack is tox+pytest+python-libjuju).

There are some pointers about integration testing and how to link them with CI here

1 Like

I wrote up some here: Getting started with charm testing - doc - Charmhub