Building your Charms with Github Actions

We do hope to introduce our own official Github Actions in the near future to simplify the user experience! In the meantime, there are a couple of options to build your charms with Github Actions (or similar CI systems):

(1) Use Charmcraft’s --destructive-mode on an OS that matches a build-on base configuration in your project’s charmcraft.yaml (for more information, check out Juju | Charmcraft Configuration). Today, this would mean configuring either ubuntu-18.04 or ubuntu-20.04 as the operating system, with a corresponding bases config.

(2) Use Charmcraft’s default, with LXD used to build Charms for all applicable bases. On Github Actions, this means setting up LXD for use by Charmcraft and running charmcraft with the correct permissions. For example:

      - name: Configure LXD
        run: |
          sudo groupadd --force --system lxd
          sudo usermod --append --groups lxd $USER
          sudo snap start lxd
          sudo lxd waitready --timeout=30
          sudo lxd init --auto

      - name: Build my Charm
        run: |
          sg lxd -c "charmcraft -v pack"
1 Like

That’s great! Thanks for sharing!

Could we go one step further and also publish to latest/edge with a CI?