美文网首页
Developer Flow

Developer Flow

作者: 御浅永夜 | 来源:发表于2017-11-24 22:57 被阅读0次

如果您尚未设置开发者环境,请在继续本节之前完成。

Workflow

以下是Mattermost开发人员在mattermost-servermattermost-webapp存储库中的一般工作流程:

  1. 看看存仓库结构,找到你可以搞清自己在哪里工作的地方。
  2. 在你fork的仓库,如果是Jira ticket,创建一个分支PLT-####,####是ticket的号码;或者GH-####如果是没有Jira票的GitHub Issue。
  3. 进行所需的代码更改以完成您的ticket,确保在适当的地方编写或修改单元测试。
  4. 要测试您的更改,请从服务器存储库的根目录运行make run。 这将启动服务器和一个观察者进程,这将在客户端创建时对客户端进行任何更改。 要更改服务器,必须使用make restart-server重新启动服务器。 您的服务器将运行在http:// localhost:8065
  5. 一旦一切正常工作,满足ticket要求,在server repository上运行make stop停止mattermost,然后运行make check-style检查您的语法,并做make test测试所有repositories,server和webapp。
  6. 提交您的更改,推送您的分支并创建pull request
  7. 回应对您的pull request的反馈,并根据需要进行更改,方法是向您的分支提交并推送。 如果另一个拉取请求产生冲突,则可能需要重新进行更改
  8. 就是这样! 感谢您帮助Mattermost做得更好。

有用的Makefile命令

除了上面提到的命令之外,还有一些其他的make命令可能有用:

  • make run-server将只运行服务器而不是客户端
  • make clean-docker停止并删除您的Docker镜像,是擦除数据库的好方法
  • make run-fullmap将运行服务器,并使用完整的源映射构建客户端,以便于调试
  • make clean清理你的临时文件的本地环境
  • make nuke把你当地的环境抹回到一个全新的开始

只运行特定的服务器单元测试

由于运行每个单元测试需要花费很多时间进行更改,因此可以使用以下命令运行服务器单元测试的子集:

go test -v -run='<test name or regex>' ./<package containing test>

例如,如果您想在api/post_test.go中运行TestPostUpdate,您将运行以下命令:

go test -v -run='TestPostUpdate' ./api

仓库结构

对于server,您将在server repository中工作。

  • ./api/ holds all API and application related code
  • ./model/ holds all data model definitions and the Go driver保存所有数据模型定义和Go驱动程序
  • ./store/ holds all database querying code
  • ./utils/ holds all utilities, such as the mail utility拥有所有实用程序,如邮件实用程序
  • ./i18n/ holds all localization files for the server

对于client,你将在webapp repository中工作。

  • ./components/ holds all the React UI components and views拥有所有的React UI组件和视图
  • ./actions/ holds all Flux actions where the majority of the logic of the webapp takes place保存了大部分webapp逻辑发生的所有Flux动作
  • ./stores/ holds the stores responsible for storing and providing the views with data拥有负责存储和提供数据视图的商店
  • ./routes/ holds the definitions for all the React-Router routes保存所有React-Router路由的定义
  • ./i18n/ holds the localization files for the client
  • ./utils/ holds all widely-used utilities
  • ./tests/ holds all the client unit tests

使用GitLab Omnibus进行测试

要使用GitLab Omnibus测试本地编译的Mattermost版本,请替换以下GitLab文件:

  • /opt/gitlab/embedded/bin/plattermost中编译的二进制文件platform
  • /opt/gitlab/embedded/service/mattermost中的资产(templates, i18n, fonts, webapp)

相关文章

网友评论

      本文标题:Developer Flow

      本文链接:https://www.haomeiwen.com/subject/htfqbxtx.html