Skip to content

feat: charmcraft actions #8

feat: charmcraft actions

feat: charmcraft actions #8

Workflow file for this run

name: Test Charmcraft
on:
pull_request:
paths:
- ".github/workflows/*charmcraft*"
- "charmcraft**"
push:
branches:
- main
jobs:
test-install-success:
strategy:
matrix:
channel: [latest/stable, latest/edge, 2.x/stable]
include:
- revision: 5303
- lxd-channel: latest/stable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./charmcraft/setup
id: setup
with:
channel: ${{ matrix.channel }}
revision: ${{ matrix.revision }}
lxd-channel: ${{ matrix.lxd-channel }}
- name: Check revision number if set with a revision
if: matrix.revision != ''
run: |
[[ ${{ matrix.revision }} == ${{ steps.setup.outputs.charmcraft-revision }} ]]
- name: Check that revisions are set
run: |
test ${{ steps.setup.outputs.charmcraft-revision }} -ge 0
test ${{ steps.setup.outputs.lxd-revision }} -ge 0
test-pack:
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-24.04]
channel: [latest/stable, latest/edge, 2.x/stable]
include:
- os: ubuntu-24.04
channel: ''
revision: 5303
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: juju/juju
path: juju
- name: Pack charm
id: charmcraft
uses: ./charmcraft/pack
with:
path: juju/testcharms/charms/lxd-profile/
channel: ${{ matrix.channel }}
revision: ${{ matrix.revision }}
- name: Assert revision number
if: matrix.revision != ''
run: |
set -ex
installed_rev="$(snap info charmcraft | tail -1 | awk '{print $(NF-2)}')"
[ "$installed_rev" == "(${{ matrix.revision }})" ]
- name: Upload charm
uses: actions/upload-artifact@v4
with:
name: test-charm_${{ matrix.os }}
path: ${{ steps.charmcraft.outputs.charms }}