Skip to content

Commit

Permalink
doc: improve HACKING.md (canonical#484)
Browse files Browse the repository at this point in the history
# Description

Add some missing dependencies for running unit test and static checks
locally.

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] CleanCode (Code refactor, test updates, does not introduce
functional changes)
- [x] Documentation update (Doc only change)

## How Has This Been Tested?

Created a LXD VM and install the following dependencies, and make sure
`make check-unit` and `make check-static` can run without issues.
```bash
sudo apt update
sudo apt install gcc make shellcheck 
sudo add-apt-repository ppa:dqlite/dev 
sudo apt install libdqlite-dev
sudo snap install go --classic
export PATH=$PATH:$HOME/go/bin

git clone https://github.com/canonical/microceph.git
cd microceph/microceph
make
```

## Contributor's Checklist

Please check that you have:

- [x] self-reviewed the code in this PR.
- [ ] added code comments, particularly in hard-to-understand areas.
- [ ] updated the user documentation with corresponding changes.
- [ ] added tests to verify effectiveness of this change.

Signed-off-by: Chi Wai Chan <[email protected]>
  • Loading branch information
chanchiwai-ray authored Jan 16, 2025
1 parent 579136d commit 2e22e93
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ Building MicroCeph is as easy as a snap!
# v for verbose output of the build process.
snapcraft -v
...
Creating snap package
...
Creating snap package
...
Created snap package microceph_0+git.ac1da26_amd64.snap
```
```

The newly created .snap artifact can then be installed as
```bash
# Dangerous flag for locally built snap
sudo snap install --dangerous microceph_*.snap
sudo snap install --dangerous microceph_*.snap
```

```bash
Expand All @@ -85,12 +85,29 @@ sudo snap restart microceph.daemon
```

## 👍 Unit-Testing
The MicroCeph [makefile](/microceph/Makefile) has targets for running unit tests and lint checks. They can be run as follows.
The MicroCeph [Makefile](/microceph/Makefile) has targets for running unit tests and lint checks. However, you will need the following packages or tool to run them locally.

```bash
# Note: commands executed from microceph subdir which contains the Makefile.
# Add general requirements
sudo apt install gcc make shellcheck

# Add libdqlite-dev, required for building microceph
sudo add-apt-repository ppa:dqlite/dev -y
sudo apt install -y libdqlite-dev

# Install go and export the binary to PATH
sudo snap install go --classic
export PATH=$PATH:$HOME/go/bin
```

Once you install the prerequisite, you can run unit tests and lint checks as follows:

```bash
cd microceph

# Run unit tests
make check-unit

# Run static checks
make check-static
```
```

0 comments on commit 2e22e93

Please sign in to comment.