如何加入開源社區?

我們從三個方面介紹Open Source:

  • Why Open Source?

  • Developing Open Source is Not Trivial

  • Workflow with Github

1. Why Open Source?

  • Involved with tending technologies

  • Learning good programming practices

  • Meeting friends

  • Github is a new CV

2. Developing Open Source is Not Trivial

Open Source本身有一個門檻。一個項目就涉及到對很多工具的掌握。比如Alluxio這個項目需要用到git,github, Maven, JIRA, Markdown等等。

Advertisements

以Alluxio為例,Alluxio的開發資源:

(1) Developer Mailing List:

When you have question

https://groups.google.com/forum/#!forum/alluxio-users

(2) Issue tracking system:

Where you report bugs, grab tasks

https://alluxio.atlassian.net/projects/ALLUXIO/issues/

有的社區使用github自帶的issues,它的功能相對簡單。

(3) Source repository:

Advertisements

Where you download/upload/review code

GitHub - Alluxio/alluxio: Memory-Speed Virtual DistributedStorage System

Alluxio JIRA:

JIRA是一個communicationportal,可以讓不同的task放在同一個地方去搜索,瀏覽,task之間的關聯。它的基本單位是ticket,每個ticket描述一個task。比如彙報一個bug,添加一個新的屬性等。Ticket可以描述high-level的性能,可以分成很多個sub-tasks。同樣會放入很多設計文檔。

下圖是Alluxio的一幅圖:

左側一列,每列是一個ticket。右邊是具體某個ticket的信息。

用JIRA可以:

(1) 創建一個新的ticket:report a bug, describe a feature and etc.

(2) assign一個ticket給自己

(3) reassign一個ticket給其他人

(4) 關閉一個完成的ticket

Developer Mailing List用來發布針對project的問題和想法,比如對於user,many projectsare moving off Java 6, should Alluxio? It seems likeConcurrencyTest is failing often, is it flakey?對於maintainers可以放announcement,比如Alluxio 1.0.0 Released!

Alluxio Github是一個針對Alluxioproject的repository。porject不斷發展,開發者經常pullrequest去commit新的代碼。對於project管理者,要shepherd和merge開發者的pullrequest。

下圖是代碼頁面:

上圖可以看出,github上面目錄很多,下圖是對常見的組織結構的一些解釋:

3. Workflow with Github

Step 0: Fork project on Github (only once)

註冊完github后找到感興趣的project,點擊fork得到副本。

Step 1: Clone project locally

Clone將project下載到本地:

Step 2: Develop in your local repository

Step 3: Address comments

Step 4: Update pull-requests

Building/Testing Alluxio:

(1) Build project

$ mvn clean install

mvn代表maven,clean代表從頭做起,install代表編譯完成後放在本地cache起來

(2) Build project by skipping tests

$ mvn clean install -DskipTests

這個命令可以略過Unit Test

(3) Run unit test

$ mvn clean test

這個命令只跑test

Tips of Committing Code:

(1) Make sure to address the comments left in your PullRequest

(2) Address comments and ask reviewers to review again PTAL(Please Take another look)

(3) Ask reviewers to leave a LGTM (Look Good to Me)

(4) Be sure to verify your changes pass the unit tests

(5) Make sure your branch does not have any conflicts with themaster branch

下面是具體的操作:

上圖是Alluxio的頁面,以1768 task為例,點擊右側Assign tome。登陸自己的Github,找到Alluxio項目,點擊Fork,顯示如下圖:

在本地電腦上clone項目:

在Alluxio的目錄下可以build project:

下面對code進行修改,以使用Intellij為例:

選擇Alluxio所在目錄,這個項目用maven管理,所以這裡選擇maven格式:

設置中選擇developer:

文件導入后,進行對應task的修改,再傳到github上去。一般先新建一個以task號命名的branch:

Fork會在自己github上創建project的副本,所以用下面的command提交code:

在自己的github上對應的branch點擊compare & pull request

此外,還可以在github上對做出的改動留言或者參與討論。

更多精彩內容,歡迎訪問官網 BitTiger.io 或關注 「論碼農的自我修養」微信公眾號:bit_tiger

Advertisements

你可能會喜歡