如何贡献代码和文档

    签署贡献者许可协议(CLA)

    什么是?

    签署协议链接:vesoft inc. Contributor License Agreement

    单击按钮Sign in with GitHub to agree签署协议。

    如果有任何问题,请发送邮件至。

    Step 1:通过GitHub fork仓库

    Nebula Graph项目有很多仓库,以为例:

    1. 访问https://github.com/vesoft-inc/nebula-graph

    Step 2:将分支克隆到本地

    1. 定义本地工作目录。

      1. user={GitHub用户名}
    2. 克隆代码。

      1. mkdir -p $working_dir
      2. cd $working_dir
      3. git clone https://github.com/$user/nebula-graph.git
      4. # 或:git clone git@github.com:$user/nebula-graph.git
      5. cd $working_dir/nebula
      6. git remote add upstream https://github.com/vesoft-inc/nebula-graph.git
      7. # 或:git remote add upstream git@github.com:vesoft-inc/nebula-graph.git
      8. # 由于没有写访问权限,请勿推送至上游主分支。
      9. # 确认远程分支有效。
      10. # 正确的格式为:
      11. # origin git@github.com:$(user)/nebula-graph.git (push)
      12. # upstream https://github.com/vesoft-inc/nebula-graph (fetch)
      13. # upstream no_push (push)
      14. git remote -v

    请将Nebula Graph的pre-commit hook连接到.git目录。

    hook将检查commit,包括格式、构建、文档生成等。

    pre-commit hook有时候可能无法正常执行,用户必须手动执行。

    1. cd $working_dir/nebula-graph/.git/hooks
    2. chmod +x pre-commit
    1. 更新本地主分支。

      1. cd $working_dir/nebula
      2. git fetch upstream
      3. git rebase upstream/master
    2. 从主分支创建并切换分支:

    Step 4:开发

    代码风格

    Nebula Graph采用cpplint来确保代码符合Google的代码风格指南。检查器将在提交代码之前执行。

    请为新功能或Bug修复添加单元测试。

    构建代码时开启单元测试

    nebula根目录执行如下命令:

    1. cd nebula/build
    2. ctest -j$(nproc)

    Step 5:保持分支同步

    1. # 当处于myfeature分支时。
    2. git fetch upstream
    3. git rebase upstream/master

    在其他贡献者将PR合并到基础分支之后,用户需要更新head分支。

    提交代码更改:

    用户可以使用命令--amend重新编辑之前的代码。

    Step 7:Push

    需要审核或离线备份代码时,可以将本地仓库创建的分支push到GitHub的远程仓库。

    1. git push origin myfeature

    Step 8:创建pull request

    1. 单击myfeature分支旁的按钮。

    pull request创建后,至少需要两人审查。审查人员将进行彻底的代码审查,以确保变更满足存储库的贡献准则和其他质量标准。