Add charmcraft.yaml for publishing to Charmhub

See https://juju.is/docs/sdk/charmcraft-config

Change-Id: Icce0e6325e61089f2b8c3bca74f442a460282379
This commit is contained in:
Aurelien Lourot 2021-12-16 15:07:06 +01:00
parent 4f49eab3fd
commit b4dcc38eda
5 changed files with 39 additions and 5 deletions

View File

@ -1,5 +1,7 @@
# NOTE(lourot): versions newer than 1.0.0 fail as described in
# https://github.com/canonical/charmcraft/pull/487#issuecomment-894529408
git+https://github.com/canonical/charmcraft.git@1.0.0#egg=charmcraft
# NOTES(lourot):
# * We don't install charmcraft via pip anymore because it anyway spins up a
# container and scp the system's charmcraft snap inside it. So the charmcraft
# snap is necessary on the system anyway.
# * `tox -e build` successfully validated with charmcraft 1.2.1
cffi==1.14.6; python_version < '3.6' # cffi 1.15.0 drops support for py35.

12
charmcraft.yaml Normal file
View File

@ -0,0 +1,12 @@
type: charm
parts:
charm:
build-packages:
- git
bases:
- name: ubuntu
channel: "20.04"
architectures:
- amd64

View File

@ -1,5 +1,8 @@
ops
git+https://opendev.org/openstack/charm-ops-openstack#egg=ops_openstack
# NOTE(lourot): spurious TLS verification issues from opendev.org, switching to
# github.com for now:
git+https://github.com/openstack/charm-ops-openstack#egg=ops_openstack
ruamel.yaml
pylspci

View File

@ -5,6 +5,15 @@ deployment functionality from the perspective of this charm, its requirements
and its features, as exercised in a subset of the full OpenStack deployment
test bundle topology.
Run the smoke tests with:
```bash
cd ../
tox -e build
cd tests/
tox -e func-smoke
```
For full details on functional testing of OpenStack charms please refer to
the [functional testing](https://docs.openstack.org/charm-guide/latest/reference/testing.html#functional-testing)
section of the OpenStack Charm Guide.

10
tox.ini
View File

@ -27,10 +27,11 @@ setenv = VIRTUAL_ENV={envdir}
install_command =
pip install {opts} {packages}
commands = stestr run --slowest {posargs}
whitelist_externals =
allowlist_externals =
git
add-to-archive.py
bash
charmcraft
passenv = HOME TERM CS_* OS_* TEST_*
deps = -r{toxinidir}/test-requirements.txt
@ -105,8 +106,15 @@ commands = {posargs}
[testenv:build]
basepython = python3
deps = -r{toxinidir}/build-requirements.txt
# NOTE(lourot): charmcraft 1.0.0 used to generate
# nova-compute-nvidia-vgpu.charm, which is the behaviour expected by OSCI.
# However charmcraft 1.2.1 now generates
# nova-compute-nvidia-vgpu_ubuntu-20.04-amd64.charm instead. In order to keep
# the old behaviour we rename the file at the end.
commands =
charmcraft clean
charmcraft build
bash -c "mv nova-compute-nvidia-vgpu_*.charm nova-compute-nvidia-vgpu.charm"
[testenv:func-noop]
basepython = python3