如何加入開源社群?
我們從三個方面介紹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等等。
以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/p
rojects/ALLUXIO/issues/
有的社群使用github自帶的issues,它的功能相對簡單。
(3) Source repository:
Where you download/upload/review code
GitHub - Alluxio/alluxio: Memory-Speed Virtual Distributed Storage System
Alluxio JIRA:
JIRA是一個communication portal,可以讓不同的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 projects are moving off Java 6, should Alluxio? It seems like ConcurrencyTest is failing often, is it flakey? 對於maintainers可以放announcement,比如Alluxio 1。0。0 Released!
Alluxio Github是一個針對Alluxio project的repository。porject不斷髮展,開發者經常pull request去commit新的程式碼。對於project管理者,要shepherd和merge開發者的pull request。
下圖是程式碼頁面:
上圖可以看出,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 Pull Request
(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 the master branch
下面是具體的操作:
上圖是Alluxio的頁面,以1768 task為例,點選右側Assign to me。登陸自己的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上對做出的改動留言或者參與討論。
更多精彩內容, 請掃描下面二維碼,關注微信公眾賬號“論碼農的自我修養”