Hudsonã§Androidãã
æé
- Androidå´
- ã³ãã³ãã©ã¤ã³ã§Androidããã¸ã§ã¯ãã®ä½æ
- antã³ãã³ãã§ããã¸ã§ã¯ãããã«ã
- gitã«commit & push
- hudsonå´
- hudsonã®ã¤ã³ã¹ãã¼ã«
- hudsonãèµ·å
- hudsonããã¸ã§ã¯ãã使
- jobã®è¿½å
- ã¿ã¼ã²ããããã¸ã§ã¯ã
- ãã¹ãããã¸ã§ã¯ã
- hudsonãããã«ã
- hudsonã§ãã¹ã
- AndroidTestå´
- ã³ãã³ãã©ã¤ã³ã§Androidã®ãã¹ãããã¸ã§ã¯ãã®ä½æ
- antã³ãã³ãã§ããã¸ã§ã¯ãããã«ã
- ã¨ãã¥ã¬ã¼ã¿ãèµ·åãã
- ã³ãã³ãã©ã¤ã³ã§ãã¹ãå®è¡
- gitã«commit & push
hudsonã®ã¤ã³ã¹ãã¼ã«
http://hudson-ci.org/
ããhudson.warããã¦ã³ãã¼ããã¦é©å½ãªã¨ããã«é
ç½®
Androidããã¸ã§ã¯ããã³ãã³ãã©ã¤ã³ãã使
hudsonä¸ã§Buildããã®ã«antã³ãã³ãã使ãã¾ãã
Eclipseã§ã¯ãªãã³ãã³ãã©ã¤ã³ããAndroidããã¸ã§ã¯ãã使ããã¨ãbuild.xmlã使ããã¾ã
ã³ãã³ã
android create project \ --target AndroidAPILv \ --name ããã¸ã§ã¯ãå \ --path ããã¸ã§ã¯ããã¹ \ --activity ã¢ã¯ãã£ããã£å \ --package ããã±ã¼ã¸
ä¾
android create project \ --target 4 \ --name HelloHudson \ --path /home/ore/develop/gengo/android/src/HelloHudson \ --activity HelloHudson \ --package com.example.hellohudson
Androidããã¸ã§ã¯ãããã«ã
ã³ãã³ãã©ã¤ã³ããããã¸ã§ã¯ãã使ããã¨ãbuild.xmlãããã©ã§ã§ãã¦ããã®ã§å®è¡ãã
å®è¡ã³ãã³ã
ant debug
gitã®è¨å®
- ãã¼ã«ã«gitãªãã¸ããªã®ä½æ
- ããã¸ã§ã¯ããã£ã¬ã¯ããªã§git init
$ git init
-
- .gitignoreã®ä½æ
-
- gitignoreãaddãã¦ã³ããã
$ git add .gitignore $ git commit -m"add gitignore"
-
- ããã¸ã§ã¯ããã³ããã
$ git add -A . $ git commit -m"firstcommit"
- ãªã¢ã¼ãbareãªãã¸ããªã®ä½æ
- é©å½ãªå ´æã«ãã¢ãªãã¸ããªç¨ãã£ã¬ã¯ããªã使
- ãã£ã¬ã¯ããªã«ç§»åã使ã³ãã³ããå®è¡
$ git --bare init --shared
- ãã¢ãªãã¸ããªã«push
- ããã¸ã§ã¯ããã£ã¬ã¯ããªã«æ»ã
- ãªã¢ã¼ããªãã¸ããªã®è¿½å
$ git remote add origin [path]
-
- ãªã¢ã¼ãã«push
$ push origin master
Hudsonã®è¨å®
- Hudsonãèµ·åãã
- èµ·åã³ãã³ã
java -jar hudson.war
-
- ãã©ã¦ã¶èµ·å
- URLï¼localhost:8080
- ãã©ã¦ã¶èµ·å
- pluginã®ã¤ã³ã¹ãã¼ã«
- ã¡ãã¥ã¼ãã"Hudsonã®ç®¡ç"ã鏿
-
- "ãã©ã°ã¤ã³ã®ç®¡ç"ã鏿
- å ¥ãããpluginã鏿ãã¦ãç»é¢ã®å£±çªä¸ã®"ã¤ã³ã¹ãã¼ã«"ãã¿ã³ã鏿ãã
-
- pluginãã¤ã³ã¹ãã¼ã«ããã
-
- å®äºãããHudsonãåèµ·åãã
- Pluginãã¤ã³ã¹ãã¼ã«ããã¦ãããã¨ã確èª
- æ°è¦ã¸ã§ãã®ä½æ
- ã¡ãã¥ã¼ãã"æ°è¦ã¸ã§ãã®ä½æ"ã鏿
- ã¸ã§ãå:HelloHudson
- ããªã¼ã¹ã¿ã¤ã«ã»ããã¸ã§ã¯ãã®ãã«ãã«ãã§ãã¯
- "ok"ãã¯ãªãã¯
- ã¡ãã¥ã¼ãã"æ°è¦ã¸ã§ãã®ä½æ"ã鏿
-
- ã¸ã§ãè¨å®ç»é¢
- ã½ã¼ã¹ã³ã¼ã管çã·ã¹ãã ï¼Git
- URL:è¨å®ãããªãã¸ããªã®ãã¹
- ãã«ãæé ï¼ã·ã§ã«ãå®è¡
- ã·ã§ã«ã¹ã¯ãªããï¼ant
- ã½ã¼ã¹ã³ã¼ã管çã·ã¹ãã ï¼Git
- ã¸ã§ãè¨å®ç»é¢
-
- ã¸ã§ãã使ããã¦ããã®ã確èª
Hudsonã§ãã«ããã
- "ãã«ãå®è¡"ã鏿
- ãã«ããå®è¡ããã
- ãã«ããæåãããã¨ã確èªãã
- å·¦ä¸ã®ãã«ãå±¥æ´ã«å®è¡çµæã表示ããã
- æå㯠é
- 失æã¯ 赤
- ä¸æã¯ ç°
- å·¦ä¸ã®ãã«ãå±¥æ´ã«å®è¡çµæã表示ããã
- ãã«ãçµæã確èª
- ãã«ãå±¥æ´ãã"#1"ã鏿
- ç»é¢ãå¤ãã£ããããµã¤ãã¡ãã¥ã¼ã®"ã³ã³ã½ã¼ã«åºå"ã鏿ãã
Androidã®Testããã¸ã§ã¯ã使
- ãã¹ãããã¸ã§ã¯ã使ã³ãã³ã
android create test-project \ -m [Testããããããã¸ã§ã¯ãã®ãã¹] \ -n [TestProject name] \ -p [TestProject Path]
- ä¾
android create test-project \ -m /home/ore/develop/gengo/android/src/HelloHudson \ -n HelloHudsonTest \ -p /home/ore/develop/gengo/android/src/HelloHudsonTestore
Eclipseã«ããã¸ã§ã¯ãã追å
HelloHudsonããã¸ã§ã¯ããEclipseã«è¿½å ãã
- Eclipseã®èµ·å
- Androidããã¸ã§ã¯ãã®æ°è¦ä½æã¦ã£ã¶ã¼ããéã
- "New Androi Project"ã¦ã£ã³ãã¦ã§"Create project from existing source"ã«ãã§ãã¯
- "Browse"ãã¿ã³ãã¯ãªãã¯ãã¦HelloHudsonããã¸ã§ã¯ãã®ãã£ã¬ã¯ããªã鏿
- å¿ é é ç®ãèªåçã«è¨å®ããã¦ããã®ã確èª
- "Finish"ãã¿ã³ãã¯ãªãã¯
HelloHudsonTestããã¸ã§ã¯ããEclipseã«è¿½å ãã
- ä¸ã®æé ã¾ã§å®è¡ãã
- Testããã¸ã§ã¯ãã«ã¿ã¼ã²ããããã¸ã§ã¯ãã追å ãã
- ããã¸ã§ã¯ãå³ã¯ãªãã¯
- Build Path â Configration Build Path
- Projectsã¿ãã鏿ãã¦"Add..."ãã¿ã³ãã¯ãªãã¯
- "HelloHudson"ã«ãã§ãã¯ãããã¦"OK"ãã¿ã³ãã¯ãªãã¯
- Projectsã¿ãã«HelloHudsonãã¤ããããã¦ããã®ã確èªã"OK"ãã¯ãªãã¯ãã¦è¨å®ç»é¢ãéãã
eclipseä¸ã§å®è¡ãã
ã¾ãã¯ã¿ã¼ã²ããããã¸ã§ã¯ããEclipseã§å®è¡ãã¾ã
å®è¡ããã¨ä¸è¨ã®ãããªã¡ãã»ã¼ã¸ã表示ããã
ã¿ã¼ã²ããAPIã®ã¨ãã¥ã¬ã¼ã¿ããªããã¨è¨ã£ã¦ã¾ãã
ããã¯"default.properties"ã«
target=Google Inc.:Google APIs:4
ãè¨è¿°ããã¦ããããã§ãã
ã§ãèªåã®ç°å¢ã¯1.6ã¯ãããã©GoogleAPIã§ã¯ãªãããã§ãã
ã³ãã³ãã©ã¤ã³ããããã¸ã§ã¯ãã使ããå ´åã¯ã¿ã¼ã²ãã4ãæå®ããã¨GoogleAPIã鏿ãããããã§ãã
解決ããã«ã¯AVD追å ãããtargetã夿´ãã¾ã
以ä¸ãè¨è¿°
target=4
åæ§ã«Testããã¸ã§ã¯ãã®"default.properties"ã夿´ãã¦ãã
å度Runãã¦æ®éã«å®è¡ã§ãããã¨ã確èªããã
Testããã¸ã§ã¯ããåãã
- ãã¹ãã±ã¼ã¹ã®ä½æ
ã¿ã¼ã²ããããã¸ã§ã¯ãã«é©å½ãªã¡ã½ããã追å
public void show(){ Log.v("HelloHudson", "HelloHudson!"); }
- Testããã¸ã§ã¯ãã«showãã¹ãã¡ã½ããã追å
public void testShow(){ getActivity().show(); }
ã³ãã³ãã©ã¤ã³ã§Testãå®è¡ãã
以ä¸ã®ã³ãã³ããå®è¡
$ adb shell am instrument -w com.example.hellohudson.tests/android.test.InstrumentationTestRunner
å®è¡çµæ
com.example.hellohudson.HelloHudsonTest:. Test results for InstrumentationTestRunner=. Time: 0.96 OK (1 test)
Hudsonã«ã¸ã§ãã追å
HelloHudsonã¨åãããã«ã¸ã§ãã追å ãã
夿´ç¹
- ãã«ãæé
- ã·ã§ã«ã®å®è¡
ant
adb shell am instrument -w com.example.hellohudson.tests/android.test.InstrumentationTestRunne
課é¡
ä»åã®ãã¹ãå®è¡ãæåããã®ã¯ã¨ãã¥ã¬ã¼ã¿ããã§ã«èµ·åãã¦ããããã§ãã
ã¨ãã¥ã¬ã¼ã¿ãèµ·åãã¦ããªãã¨å½ç¶ã¨ã©ã¼ã§ãã
æ¬æ¥ã®ã·ã§ã«å®è¡ã³ãã³ãã¯ä»¥ä¸ã®ããã«ãã¹ãã§ã
emulator -avd [ã¨ãã¥ã¬ã¼ã¿å] ant adb shell am instrument -w com.example.hellohudson.tests/android.test.InstrumentationTestRunne
ã§ãããã®å ´åãã¨ãã¥ã¬ã¼ã¿ãèµ·åãã¦ã次ã®ã³ãã³ããå®è¡ããã¾ããã
ã ããã¨ãã£ã¦ã
emulator -avd [ã¨ãã¥ã¬ã¼ã¿å] & ant adb shell am instrument -w com.example.hellohudson.tests/android.test.InstrumentationTestRunne
ããããããã¨ãã¥ã¬ã¼ã¿ã®èµ·åãå®äºããåã«ãã¹ããèµ°ãã¾ãã
ã©ãããã°ãããã ããï¼ï¼ï¼