Ubuntu12.04 VPSサーバ構築手順:CI環境構築 Playframework1.2アプリケーション構築
以下のエントリシリーズのうちの1つ:CI対象となるプロジェクトの作成について。まずはPlayframework1.2ベースのアプリから。
Play1.2実行環境構築
$ pwd /Application $ wget http://download.playframework.org/releases/play-1.2.5.zip $ unzip play-1.2.5.zip $ sudo vi /Users/XXX/.bash_profile ----------------------------- ########################## # add Playframework env. ########################## PLAY_HOME=/Applications/play-1.2.5 #PLAY_HOME=/Applications/play-2.0.4 export PLAY_HOME export PATH=$PATH:$PLAY_HOME ----------------------------- $ source /Users/XXX/.bash_profile
- 導入確認(play -v)。
$ play -v ~ _ _ ~ _ __ | | __ _ _ _| | ~ | '_ \| |/ _' | || |_| ~ | __/|_|\____|\__ (_) ~ |_| |__/ ~ ~ play! 1.2.5, http://www.playframework.org ~ ~ Usage: play cmd [app_path] [--options] ~ ~ with, new Create a new application ~ run Run the application in the current shell ~ help Show play help ~ ~ Invalid command: -v ~ $
- アプリケーション新規作成(play new アプリケーション名)
$ play new playfw12app ~ _ _ ~ _ __ | | __ _ _ _| | ~ | '_ \| |/ _' | || |_| ~ | __/|_|\____|\__ (_) ~ |_| |__/ ~ ~ play! 1.2.5, http://www.playframework.org ~ ~ The new application will be created in /Applications/eclipse4.2/workspace/playfw12app ~ What is the application name? [playfw12app] ~ ~ OK, the application is created. ~ Start it with : play run playfw12app ~ Have fun! ~ $
- アプリケーション起動(play run アプリケーション名)
$ play run playfw12app/ ~ _ _ ~ _ __ | | __ _ _ _| | ~ | '_ \| |/ _' | || |_| ~ | __/|_|\____|\__ (_) ~ |_| |__/ ~ ~ play! 1.2.5, http://www.playframework.org ~ ~ Ctrl+C to stop ~ CompilerOracle: exclude jregex/Pretokenizer.next Listening for transport dt_socket at address: 8000 16:05:00,759 INFO ~ Starting /Applications/eclipse4.2/workspace/playfw12app 16:05:01,614 WARN ~ You're running Play! in DEV mode 16:05:01,761 INFO ~ Listening for HTTP on port 9000 (Waiting a first request to start) ... 16:05:09,783 INFO ~ Application 'playfw12app' is now started !
- http://localhost:9000/ でアクセス確認
$ play deps playfw12app/ $ play ec playfw12app/
Play1.2テスト実行
『play auto-test』で実行が可能。
初期状態でテストしてみる。(play auto-test アプリケーション名)
$ play auto-test playfw12app/ ~ _ _ ~ _ __ | | __ _ _ _| | ~ | '_ \| |/ _' | || |_| ~ | __/|_|\____|\__ (_) ~ |_| |__/ ~ ~ play! 1.2.5, http://www.playframework.org ~ framework ID is test ~ ~ Running in test mode ~ Ctrl+C to stop ~ ~ Deleting /Applications/eclipse4.2/workspace/playfw12app/tmp ~ CompilerOracle: exclude jregex/Pretokenizer .next Listening for transport dt_socket at address: 8000 16:56:44,939 INFO ~ Starting /Applications/eclipse4.2/workspace/playfw12app 16:56:46,000 WARN ~ You're running Play! in DEV mode ~ ~ Go to http://localhost:9000/@tests to run the tests ~ ~ 4 tests to run: ~ ~ AnotherPlayUnitTest... PASSED 1s ~ BasicTest... PASSED 0s ~ ApplicationTest... PASSED 0s ~ Application... PASSED 5s ~ ~ All tests passed ~ $
テスト実行結果は test-result/ フォルダに生成される。
$ pwd /Applications/eclipse4.2/workspace/playfw12app/test-result $ $ ll AnotherPlayUnitTest.class.passed.html Application.test.html.passed.html ApplicationTest.class.passed.html BasicTest.class.passed.html TEST-BasicTest.xml TEST-AnotherPlayUnitTest.xml TEST-ApplicationTest.xml application.log result.passed $
- 結果を開いてみたところ。テスト実行後の連携については別途Jenkinsプラグイン関連のエントリにて。