Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Contributing documentation #22

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 37 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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
```
Loading