diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6bfcb54..6adc8d4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,43 +1,58 @@ # Contributing +To make contributions to this charm, you'll need a working Juju development setup. -To make contributions to this charm, you'll need a working [Juju development setup](https://juju.is/docs/sdk/dev-setup). +## Prerequisites +Install Charmcraft and LXD: +```shell +sudo snap install --classic charmcraft +sudo snap install lxd +sudo adduser $USER lxd +newgrp lxd +lxd init --auto +``` + +Install MicroK8s: +```shell +sudo snap install microk8s --channel=1.27-strict/stable +sudo usermod -a -G snap_microk8s $USER +newgrp snap_microk8s +sudo microk8s enable hostpath-storage +``` -You can use the environments created by `tox` for development: +Install Juju and bootstrap a controller on the MicroK8S instance: +```shell +sudo snap install juju --channel=3.1/stable +juju bootstrap microk8s +``` + +Install `pip` and `tox`: +```shell +sudo apt install python3-pip +python3 -m pip install "tox>=4.0.0" +``` +## Development +Activate the virtual environment created by `tox` for development: ```shell tox --notest -e unit source .tox/unit/bin/activate ``` ## Testing +This project uses `tox` for managing test environments. -This project uses `tox` for managing test environments. There are some pre-configured environments +There are some pre-configured environments that can be used for linting and formatting code when you're preparing contributions to the charm: ```shell -tox -e fmt # Format code -tox -e lint # Code style -tox -e static # Static analysis -tox -e unit # Unit tests -tox -e integration # Integration tests +tox -e lint # code style +tox -e static # static analysis +tox -e unit # unit tests +tox -e integration # integration tests ``` ## Build - -Building charms is done using charmcraft (official documentation [here](https://juju.is/docs/sdk/publishing)). You can install charmcraft using `snap`: - -```bash -sudo snap install charmcraft --channel=classic -``` - -Initialize LXD: - -```bash -lxd init --auto -``` - Go to the charm directory and run: - ```bash charmcraft pack ```