main 受保护(PR + CI gate 且 enforce_admins),release-tag.sh 原先 直接提交并推送版本变更会被 GH006 拒绝。改为:版本 bump 随 dev -> main 发布 PR 合入,脚本只校验版本/changelog 后创建并推送 tag。 - release-tag.sh: 去掉直推分支与自动 bump,新增 main 分支与版本一致性校验 - 删除 bump-version.sh(会基于未推送的提交直接打 tag,与保护规则冲突) - RELEASE.md / CONTRIBUTING.md / CLAUDE.md 同步为 PR + tag 流程
3.8 KiB
Contributing Guide
Please ensure that you are using clean code, following the coding style and code organization in existing code, and make sure all the tests pass.
Please submit one PR that does one thing, this is important, and helps us to review your code more easily and push to merge fast.
AI Assistance
🤖 When you submit PR, please point out which parts are generated by AI, if any.
All code generated by AI must be reviewed and tested by humans, and should follow the same coding style and code organization as existing code.
The AI generated code without refactoring will be rejected.
Code Style
Before you start to write code, please read the existing code to follow the same coding style and code organization.
- Inspired by existing code or refer to macOS/Windows controls API design to name your functions, properties, structs etc.
Development and Testing
System dependencies
The script folder contains some useful scripts to help you set up the development environment.
To install the system dependencies, run the following script:
./script/bootstrap
For Windows, you can run the following command in PowerShell:
.\script\install-window.ps1
Run story
There are a lot of UI test cases in the crates/story folder, if you change the existing features you can run the tests to make sure they are working.
Use cargo run to run the complete story examples to display them all in a gallery of GPUI components.
cargo run
Run single example
There is also available some split examples, run cargo run --example to see the available examples.
cargo run --example table
UI Guides
GPUI Component is inspired by macOS and Windows controls, combined with shadcn/ui design for a modern experience.
So please refer to the following UI guides when you design or change the UI components:
Rules
- Use
defaultmouse cursor notpointerfor buttons, unless it's a link button, we are building desktop apps, not web apps. - Use
mdsize for most cases and as the default.
Profile the performance
When you change the rendering code, please profile the performance to make sure the FPS is still good.
You can use MTL_HUD_ENABLED=1 environment variable to enable the Metal HUD to see the FPS and other performance metrics.
MTL_HUD_ENABLED=1 cargo run
NOTE: Only available on macOS with Metal backend, and the FPS is up limited your monitor refresh rate, usually 60 or 120.
Use Samply to profile the the performance
You can use Samply to profile the performance of the application to get more detailed information.
samply record cargo run
Use samply record command to start rust development, and do some operations in the app that you want to profile, then stop the terminal with ctrl-c, then samply will open the browser to show the profile results.
Release crates version
When we are ready to release a new version, follow .github/RELEASE.md. In short:
-
Bump the application version (
main/Cargo.tomlandCargo.lock) tox.y.zand add the bilingualCHANGELOG.mdentry. -
Land both in
mainthrough adev→mainpull request.mainis protected, so the version change cannot be pushed directly. -
After the pull request is merged and CI is green, tag the release from
main:script/release-tag.sh vx.y.zThe script refuses to run unless
main/Cargo.tomlalready equals the tag and the changelog entry is valid, then creates and pushes the tag. -
GitHub Actions builds and publishes the release from the pushed tag.