ãããããCI/CDãå°å ¥ããæ¹ã«ãããã§ã«æ´»ç¨ããã¦ããæ¹ã«ããCircleCIãéãã¦CI/CDã«å¯¾ããç解ãæ·±ãããæä¼ããã§ããã°å¹¸ãã§ãã
- ååã®è¨äºï¼ãCircleCIã§å§ããCI/CDå°å ¥ã®åºæ¬ã®ãã
対象èªè
- ååã®è¨äºãèªãã§CI/CDã«èå³ãæãããæ¹
- CI/CDã«ã¤ãã¦å¦ã³ããæ¹
- CircleCIã®ã¯ã¼ã¯ããã¼ã使ã£ã¦ã¿ããæ¹
- æ°æ©è½Orbsã«ã¤ãã¦è©³ããç¥ãããæ¹
å¿ è¦ãªç°å¢ï¼ç¥è
- GitHubã®ã¢ã«ã¦ã³ã
- ã½ããã¦ã§ã¢ã®ãã¹ãã«ã¤ãã¦ã®ä¸è¬çç¥è
- ã¢ã¸ã£ã¤ã«éçºã«ã¤ãã¦ã®ä¸è¬ç¥è
çè ã«ã¤ãã¦
ãCircleCIã®å éçºè ã§ãç¾å¨ã¯CircleCIåã®æµ·å¤æ¯ç¤¾ã§ããCircleCI Japanã§ãã¾ãã¾ãªæ´»åãè¡ã£ã¦ãã¾ãã
CI/CDãã¤ãã©ã¤ã³
ãCircleCIã§ã¯ã¼ã¯ããã¼ã¨å¼ã°ããæ©è½ã¯ãå®ã¯ä¼¼ããããªååã§ä»ã®CI/CDãµã¼ãã¹ããã¼ã«ã«ãç¨æããã¦ãã¾ããä¾ãã°CircleCIã¨åããSaaSçCI/CDã®ä»£è¡¨ã§ããTravis CIã«ã¯"Build Stages"ãããã¾ãããJenkinsã«ã¯"Pipeline"ã¨ããæ©è½ãåå¨ãã¾ãã
ãã©ããå¼ã³æ¹ã¯éãã¾ããããããã¯ãã¹ã¦CI/CDãã¤ãã©ã¤ã³ãå®ç¾ããããã®æ©è½ã§ããCI/CDãã¤ãã©ã¤ã³ã¨ã¯CI/CDã§è¡ãããå¦çãè«ççã«ã¾ã¨ãã¦ãããããé çªã«å®è¡ãã¦ãããã¨ãæå³ãã¾ãã
ããã®èª¬æã ãã ã¨ããåãããªãã§ãããå ·ä½çã«ä¾ãåºãã¦èª¬æããã¨ãããã¢ããªã±ã¼ã·ã§ã³ã®CI/CDãåããã¨ããã¨ãã¯ã ããã以ä¸ã®ãããªå¦çãå¿ è¦ã¨ãªãã¾ãã
- ä¾åé¢ä¿ã®ã¤ã³ã¹ãã¼ã«
- éçã³ã¼ã解æ
- ãã¹ãã®å®è¡
- ãããã¤ã¡ã³ã
ããããã®åå¦çãåå¥ã«å®ç¾©ãã¦ããã¤ãã©ã¤ã³ã¨ãã¦å®è¡ãã¾ãããã¤ãã©ã¤ã³ã¨ã¯æ¥æ¬èªã§ç®¡ã®æå³ã§ãCI/CDã®å¦çã管ã®ä¸ãéã£ã¦é çªã«å®è¡ãããã®ã§ããå¼ã°ãã¦ãã¾ãã
ããã¤ãã©ã¤ã³ã使ãä¸çªã®ã¡ãªããã¯CI/CDã®å¦çãåå²ã§ãããã¨ã§ããããããã°åå¦çã並åã«å®è¡ãããããif å¦ç1 then å¦ç2ãã®ãããªããã¼ãä½ã£ãããããã¨ãã§ãã¾ããä¾ãã°ãå ã»ã©ã®ä¾ã ã¨éçã³ã¼ã解æã¨ãã¹ãã®å®è¡ã¯ä¸¦åã§å®è¡ã§ãããã§ããã¾ãããããã¤ã¡ã³ãããã¹ããæåããæã ãå®è¡ããããã«è¨å®ããã°å®å ¨ã«ãªãªã¼ã¹ã®èªååãè¡ããã¨ãã§ãã¾ãã
ããã®ããã«ããã¤ãã©ã¤ã³ã¯è¤éãªæé ãæ½è±¡åãã¦æ±ãæå©ãããã¦ãããã®ã§ãã¢ãã³ãªCI/CDã«ã¯å¿ é ã®æ©è½ã¨ãªã£ã¦ãã¾ããã¾ãæè¿ã§ã¯CI/CDãã³ãã¼ã§ã¯ãªãGitHubãGitHub Actionsã¨å¼ã°ãããã¤ãã©ã¤ã³æ©è½ãçºè¡¨ãããã¨ã§ããã¤ãã©ã¤ã³ã®éè¦æ§ã¯CI/CDã®ä¸çãè¶ ãã¦èªèããã¤ã¤ããã¾ãã
ã¯ã¼ã¯ããã¼ã®è¨å®
ãããã§ã¯å®éã«CircleCIä¸ã§ã¯ã¼ã¯ããã¼ãè¨å®ãã¦ããã¾ãããããµã³ãã«ã³ã¼ãã¯ååã¨åãRuby On Railsã§æ¸ãããããã°ã¢ããªã使ãã¾ãã
ãååã®å
容ãç°¡åã«ããããããã¨ããã®ããã°ã¢ããªã®CI/CDãåãããã«build
ã¨ããã¸ã§ããå®ç¾©ãã¦ããã®ä¸ã§ä¾åé¢ä¿ã®ã¤ã³ã¹ãã¼ã«ããã¹ãã®å®è¡ãã§ããããã«è¨å®ãã¾ããã
ãä¾åé¢ä¿ã®ã¤ã³ã¹ãã¼ã«ãéçã³ã¼ã解æããã¹ãã®å®è¡ãããããã®ã¸ã§ãã«åãåºãã¨ããããå§ãã¾ããããæçµçãªè¨å®ãå
¨é¨æ¸ãã¨ç´é¢ãåãã®ã§ãããã§ã¯å®æå½¢ã®.circleci/config.yml
ã¸ã®ãªã³ã¯ã ããæ²è¼ãã¦ããã¾ãã
ãã¸ã§ãã®å®ç¾©æ¹æ³ã«ã¤ãã¦ã¯åå解説ããã®ã§ãããã§ã¯ã¯ã¼ã¯ããã¼ã«é¢ããé¨åã ããè¦ã¦ããã¾ãããã
version: 2 jobs: install_dependency: <çç¥> run_test: <çç¥> run_lint: <çç¥>
ãã¾ããããããã®ã¸ã§ããjobs
é
ä¸ã«å®ç¾©ãã¾ãã
workflows: version: 2 test-and-lint: jobs: - install_dependency - run_test: requires: - install_dependency - run_lint: requires: - install_dependency
ãããã¦ããããã®ã¸ã§ããworflows
ã§ã¾ã¨ãã¾ãã
- workflowsï¼ã¯ã¼ã¯ããã¼ã®å®ç¾©ãéå§ãã¾ãã
- version: 2ï¼ã¯ã¼ã¯ããã¼ã®ãã¼ã¸ã§ã³ãæå®ãã¾ãã2018å¹´12æã®æç¹ã§ã¯2ã®ã¿æå®å¯è½ã§ãã
- test-and-lintï¼ãã®ã¯ã¼ã¯ããã¼ã®ååãæå®ãã¾ããåãããããååã§ããã°ãªãã§ãæ§ãã¾ããã
- jobsï¼å®è¡ããã¸ã§ããæå®ãã¾ãã
-
requiresï¼ãã®ã¸ã§ããå®è¡ããåã«å®è¡ãããã¹ãã¸ã§ããæå®ãã¾ãããã®ä¾ã§ã¯ã
run_test
ã¨run_lint
ã®ã¸ã§ãã¯å¿ ãinstall_dependency
ã®ãã¨ã«å®è¡ããã¾ããè¤æ°ã®ã¸ã§ããrequires
ãããã¨ãå¯è½ã§ãã
ããã®.circleci/config.yml
ãGitHubã¸ããã·ã¥ããã¨CircleCIã§test-and-lint
ã¨ããååã®ã¯ã¼ã¯ããã¼ãéå§ããã¾ãã
ããã®ããã«ã¯ã¼ã¯ããã¼ã使ãã¨è¨å®ãåå²ã§ããã ãã§ã¯ãªããCI/CDã®å ¨ä½ã®æµããå¯è¦åã§ããããã«ãªããã¨ã¦ã便å©ã§ãã
requiresã®è£è¶³èª¬æ
ãrequires
ã使ããã«ã¸ã§ããæ¸ãã¨åã¸ã§ããé çªã«å®è¡ãããããã«æãããããã¾ããããå®éã«ã¯ãã¹ã¦ã®ã¸ã§ãã並åã§å®è¡ããã¾ããã¸ã§ããé çªã«å®è¡ãããå ´åã¯ãä¸è¨ã®ããã«requires
ã使ãå¿
è¦ãããã¾ãã
jobs: - job1 - job2: requires: - job1 - job3: requires: - job2
ããªããç¡ææ ã§CircleCIã使ç¨ãã¦ããå ´åã並åãã«ããã§ããªãã®ã§run_test
ã¨run_lint
ã¯1ã¤ãã¤ããå®è¡ããã¾ããã