Contributing
Thank you for your interest in contributing to NVTOP! We welcome contributions from the community to help improve the project.
License
NVTOP is licensed under the GNU General Public License v3.0 or later. By contributing, you agree that your work will be licensed under the same terms. A copy of the license can be found in the COPYING file in the repository root.
Getting Started
To contribute code, you'll need to set up a local development environment.
1. Fork and Clone the Repository
Start by forking the official repository on GitHub and then cloning your fork to your local machine:
git clone https://github.com/YOUR_USERNAME/nvtop.git
cd nvtop
2. Development Environment Setup
The build process is managed by CMake. Follow the "Building from Source" instructions in the Installation Guide, but use the Debug build type to get debugging symbols and enable warnings.
mkdir build
cd build
# Configure a debug build
cmake .. -DCMAKE_BUILD_TYPE=Debug
# Compile the code
make
3. Code Style
This project uses clang-format to maintain a consistent code style. The formatting rules are defined in the .clang-format file at the root of the repository.
Before submitting your changes, please format your code:
# Format a specific file
clang-format -i path/to/your/file.c
# Or, to format all source files:
find ../src -iname '*.c' -o -iname '*.h' | xargs clang-format -i
Running Tests
The project includes a test suite managed by CTest and GTest. To run the tests, you must enable them during the CMake configuration step.
-
Enable Testing: When configuring your build, add the
-DBUILD_TESTING=ONflag. It's recommended to do this with aDebugbuild.cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -
Run Tests: After building, you can run the tests from your build directory:
make test # Or directly with ctest # ctest
Submitting Changes
-
Create a new branch for your feature or bugfix:
git checkout -b my-awesome-feature -
Make your changes, format your code, and commit them with a descriptive message.
-
Push your branch to your fork on GitHub:
git push origin my-awesome-feature -
Open a Pull Request from your fork to the
Syllo/nvtopmain branch.
Your pull request will automatically be tested by our Continuous Integration (CI) pipeline, which is defined in .github/workflows/compile.yml. Please ensure all checks pass.