贡献指南¶
Thank you for your interest in contributing to Nexus! This guide covers the contribution workflow and guidelines.
Development Environment¶
Prerequisites¶
Windows:
winget install Kitware.CMake
winget install Git.Git
# Install Visual Studio 2019+ or Build Tools
Linux (Ubuntu/Debian):
sudo apt-get install cmake gcc g++ git
macOS:
brew install cmake git
Clone and Build¶
git clone https://github.com/nexus-platform/nexus.git
cd nexus
# Native build (for testing)
cmake -B build -DCMAKE_BUILD_TYPE=Debug -DNEXUS_PLATFORM=native -DNEXUS_BUILD_TESTS=ON
cmake --build build --config Debug
# Run tests
ctest --test-dir build -C Debug --output-on-failure
Contribution Workflow¶
Reporting Bugs¶
Check existing issues to avoid duplicates
Use the bug report template
Include:
Platform and version (Windows/Linux/macOS, compiler version)
Steps to reproduce
Expected vs actual behavior
Relevant logs or screenshots
Suggesting Features¶
Check existing feature requests
Use the feature request template
Describe the use case and benefits
Pull Request Process¶
Fork the repository
Create a feature branch:
git checkout -b feature/my-featureMake your changes following 编码规范
Ensure tests pass:
ctest --test-dir build -C DebugCommit with conventional commits format
Push and create a Pull Request
代码风格¶
See 编码规范 for detailed code style requirements.
Key points:
Follow
.clang-formatconfigurationUse Doxygen backslash style comments (
\brief,\param)80 character line limit
4 space indentation (no tabs)
Pointer alignment: left (
int* ptr)
提交信息¶
Use Conventional Commits format:
<type>(<scope>): <subject>
[optional body]
[optional footer]
Types¶
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, no logic change)refactor: Code refactoringperf: Performance improvementstest: Adding or updating testsbuild: Build system changesci: CI configuration changeschore: Other changes
Examples¶
feat(hal): add PWM support for STM32F4
fix(osal): fix mutex deadlock in FreeRTOS adapter
docs(api): update GPIO documentation
test(log): add unit tests for log filtering
Pre-Submit Checklist¶
Before submitting a PR, verify locally:
# 1. Build passes
cmake -B build -DNEXUS_PLATFORM=native -DNEXUS_BUILD_TESTS=ON
cmake --build build --config Release
# 2. Tests pass
ctest --test-dir build -C Release --output-on-failure
# 3. Code format check
clang-format --dry-run --Werror hal/**/*.c hal/**/*.h
# 4. Documentation builds without warnings
doxygen Doxyfile
Review Process¶
Automated CI checks must pass
At least one maintainer approval required
Address all review comments
Squash commits if requested
CI/CD¶
All PRs trigger GitHub Actions workflows:
build.yml: Multi-platform build (Windows, Linux, macOS) + ARM cross-compilationtest.yml: Unit tests, coverage, sanitizers, MISRA checks
Questions?¶
Open a discussion or reach out to maintainers.