From 2e22e93de18f1c309ad6ab5bd6664ad4d50815c8 Mon Sep 17 00:00:00 2001 From: Ray Chan Date: Fri, 17 Jan 2025 00:23:07 +0800 Subject: [PATCH] doc: improve HACKING.md (#484) # 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 --- HACKING.md | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/HACKING.md b/HACKING.md index 423ac62b..3cea54a2 100644 --- a/HACKING.md +++ b/HACKING.md @@ -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 @@ -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 -``` \ No newline at end of file +```