.NET Core WebApp + GitHubã®ç¶ç¶çã€ã³ãã°ã¬ãŒã·ã§ã³ïŒãã«ãããã¹ãããããã€ïŒã®æ®µéçãªã»ããã¢ãã
ã¿ãªããããã«ã¡ã¯ã ç¶ç¶çã€ã³ãã°ã¬ãŒã·ã§ã³ ïŒCIïŒã¯ããœãããŠã§ã¢éçºã®äžçã«é·ãé浞éããŠãããå€ãã®å Žåããã®äžå¯æ¬ ãªéšåã§ãããéçºã®å®¹æããç¶æããªãããããè¯ãã³ãŒããäœæã§ããŸãã ãããŠãæåã¯ãCIã®ã»ããã¢ããã«ã¯ããªãã®åŽåãšãéãå¿ èŠã§ããããä»ã§ã¯ã¯ããã«æé ãªäŸ¡æ Œã§ãç°¡åã«ãããã«ã¯ç¡æã«ãªããŸããã .NET CoreãªãŒãã³ãœãŒã¹ãããžã§ã¯ãçšã«CIãæ§æããæ¹æ³ã«èå³ãããå Žåã¯ãcatã䜿çšããŠãã ããã
å 責äºé
ãã®èšäºã«ã¯å€ãã®åèæç®ãäºçŽ°ãªç¬éãäœè«ããããŸãããããã¯èè ã®ããã§ã¯ãããŸãããèªè ãã€ãŸããã®ã¯ããªãã«ã¯ããããŸããã
FïŒã¯ãã¢ãããžã§ã¯ãã®äž»èŠèšèªã§ãããããã¥ã¢ã«ã¯CïŒãããžã§ã¯ããšå®å šã«äºææ§ããããŸãã FïŒãéžæãããã®ã¯ã ãã®èšäºãšããã«é¢é£ãããªããžããªã¯ã6æã«äºå®ãããŠãã2çªç®ã®åºçç©ãFïŒ+ Giraffeã§æ¬æ ŒçãªWebã¢ããªã±ãŒã·ã§ã³ããŒãããæ§ç¯ããŠããŸããã®åºç€ãšãªã£ãŠããŸãã
ç®æ¬¡
- å°å ¥ãšå¿ èŠãªããŒã«
- ãªããžããªãäœæãã
- æ°ãããããžã§ã¯ã
- Ciãã«ã
- Ciãã¹ã
- CIã®å±é
- ãŸãšã
- ã¿ã°
- åç §è³æ
å°å ¥ãšå¿ èŠãªããŒã«
ãã®èšäºã§ã¯ãã¢ãªããžããªã䜿çšããŸã ã ãªããžããªã®åç« ã«ã¯ã¿ã°ãäœæãããŠããããã®å®å šãªãªã¹ãã¯èšäºã®æåŸã«ãããŸãã
èšäºã«æžãããŠããããšãç¹°ãè¿ãããå Žåã¯ã以äžãå¿ èŠã§ãã
- Githubã¢ã«ãŠã³ã
- ããŒã«ã«git
- .NET Core SDK> 2.1ã
- FïŒãµããŒãä»ãVisual Studio 2017
- Azureã®ã¢ã«ãŠã³ã ã ããã¯å¿ èŠã§ã¯ãããŸãããããã«ããè©Šçšãããããã®ç¡æã®ã¢ã«ãŠã³ããæäŸããŸãã
ç¬èªã®ãªããžããªãäœæãã
ã¿ã°ïŒInitialMaster
å§ããŸãããã ãŸããäœããã®ããŒãžã§ã³ç®¡çã·ã¹ãã ãå¿ èŠã§ã ã gitãšgithubã䜿çšããŸã
GitHubã«æ°ãããªããžããªãäœæãã.gitignoreãã¡ã€ã«ã®ãã³ãã¬ãŒããšãããžã§ã¯ãã©ã€ã»ã³ã¹ãéžæããŸãã .gitignoreãã¡ã€ã«ã¯ãäœåãªãã¡ã€ã«ããªããžããªã«å ¥ããªãããã«ããããã«å¿ èŠã§ãïŒãã«ãããã»ã¹ã®çµæãªã©ïŒã ã³ãŒãã§èš±å¯ãããã¢ã¯ã·ã§ã³ã®ç¯å²ãç解ã§ããããã«ãã©ã€ã»ã³ã¹ãå¿ èŠã§ãã ãã®ãããžã§ã¯ãã§ã¯ãVisualStudioãã³ãã¬ãŒããšMITã©ã€ã»ã³ã¹ãéžæããŸããã
ãªããžããªãäœæããããã¯ããŒã³ãäœæããå¿ èŠããããŸããå®å šãªã³ããŒãåé€ããŠãããŒã«ã«ãã·ã³ã«é 眮ããŸãã ãããè¡ãã«ã¯ã GitãããŒã«ã«ã«ã€ã³ã¹ããŒã«ããŠã³ãã³ããå®è¡ããŸãïŒ
git clone PATH_TO_YOUR_REPOSITORY
ããã§ãGitHubã®ãªã¢ãŒããªããžããªã«é¢é£ä»ããããããŒã«ã«ãªããžããªãäœæãããŸããã Gitã«ã¯éåžžã«åªããããã¥ã¡ã³ããããã®ã§ãäœãã«ã€ãŸããããããã«æ¥ãŠãã ãã ã
ããŒãžã§ã³ç®¡çã·ã¹ãã ã¯ææ°ã®çºæã§ã¯ãããŸããã æåã®VCSã¯1982幎ã«ç»å ŽããŸããïŒ1972幎ã«ãç»å ŽããŸãããïŒã è¿ä»£çãªéçºãäºå®äžäžå¯èœã§ãã楜åšã®éçºã®æŽå²ã«é¢ãã詳现ã¯ã ããã§èŠã€ããããšãã§ããŸã ã ããããGitã¯æ¯èŒçæè¿ç»å ŽããŸãã-2005幎ãLinuxã®äž»èŠãªäœæè ã§ããLinus Torvaldã«æè¬ããŸãã
æ°ãããããžã§ã¯ã
ã¿ã°ïŒNewFSharpProject
ãªããžããªãã§ããã®ã§ããããžã§ã¯ããäœæããæºåãã§ããŸããã ãªããžããªããããã©ã«ããŒã«ç§»åããã³ãã³ããå®è¡ããŠæ°ãããããžã§ã¯ããäœæããŸãã
dotnet new web -lang F#
ãã®ã³ãã³ããæ©èœããããã«ã¯ã .NET Core SDKãã€ã³ã¹ããŒã«ããå¿ èŠãããããšãéèŠã§ãã Windowsã§äœæ¥ããŠããå Žåãã»ãšãã©ã®å Žåãã·ã¹ãã ãdotnet.exeã®æ°ãããã¹ãéžæããããã«OSãåèµ·åããå¿ èŠããããŸãã FïŒã®æºåããŸã æŽã£ãŠããªãå ŽåïŒããã¯éåžžã«æ¥œããèšèªã§ããããããå§ãããŸãïŒãlangãã©ã¡ãŒã¿ãŒãæž¡ãããšã¯ã§ãããdotnetã¯CïŒWebã¢ããªã±ãŒã·ã§ã³ãäœæããŸãã
ãã®ã³ãã³ããå®è¡ãããšã3ã€ã®æ°ãããã¡ã€ã«ãååŸãããŸãã
- Startup.fs-ããããµãŒããŒæ§æã§ã
- Program.fs-ããã¯ãµãŒããŒã®éå§ç¹ã§ã
- FSharpWebAppWithCIDemo.fsproj-ããã¯ãããžã§ã¯ãæ§é ã®èª¬æã§ã
ãã®ããããªãºã ã«ãããããããããã«ã¡ã¯äžçãèµ·åããã«ã¯ååã§ãã
ããã§ããããžã§ã¯ãã®æ§é ã«åæããŸãããã åãããžã§ã¯ãã¯åå¥ã®ãã©ã«ããŒã«é 眮ããå¿ èŠããããã«ãŒããã©ã«ããŒã«ã¯ãããžã§ã¯ãã«é¢ä¿ãªãæ§æãã¡ã€ã«ã®ã¿ãå«ãŸããŸãã
ãã®çµæããã®æ§é ã®ãããªãã®ãååŸããå¿ èŠããããŸãïŒãã®åŸãVisual Studioãä»ããŠãœãªã¥ãŒã·ã§ã³ã§ãã¹ãŠã®æäœãè¡ããŸãïŒã
-FSharpWebAppWithCIDemo //ãããžã§ã¯ãã®ã¡ã€ã³ãã©ã«ããŒ
--BLL //åºæ¬çãªããžãã¯ãæã€ãããžã§ã¯ã
--WebServer // WebãµãŒããŒãšãã®èšå®ã
éèŠïŒ FïŒã§ã¯ããã¡ã€ã«ãšãããžã§ã¯ãã®é åºãéèŠã§ãã ãããžã§ã¯ãããªãŒã®äžäœã«ãããã¡ã€ã«ã¯ãããªãŒã®äžäœã«ãããã¡ã€ã«ã«ã¢ã¯ã»ã¹ã§ããŸããã ããã¯ãWebãµãŒããŒãä»»æã®ãããžã§ã¯ãã«ã¢ã¯ã»ã¹ã§ããããšãæå³ããŸãïŒæäžéšã«ãããŸãïŒããããžãã¹ããžãã¯ãå«ããããžã§ã¯ãã¯ãç¬èªã®ã³ãŒãã®ã¿ã§ã³ã³ãã³ãã§ããå¿ èŠããããŸãã äžæ¹ã§ã¯ãããã¯ããçããããšã§ãããä»æ¹ã§ã¯ãããã«ã³ãŒããæ§ç¯ããŸãã ããšãã°ãããŒã¿ããŒã¹ãäœããã®WebãµãŒããŒã«ã€ããŠç¥ã£ãŠããå¿ èŠãããã®ã¯ãªãã§ããïŒ äžè¬çã«ã1ã€ã®ã¢ãžã¥ãŒã«ãä»ã®ã¢ãžã¥ãŒã«ã«ã€ããŠèªèããŠããã»ã©ãä»ã®ã¢ãžã¥ãŒã«ã§äœæ¥äžã«ãã®ã¢ãžã¥ãŒã«ãå£ãå¯èœæ§ã¯äœããªããŸãã èšãæããã°ã äœçµåé«ã³ããžã§ã³
Linuxã·ã¹ãã ã«é¢ãããã1ã€ã®éèŠãªãã€ã³ãã§ãã ãåãã®ãšããã.NET Coreã§äœæããããããžã§ã¯ãã¯ã¯ãã¹ãã©ãããã©ãŒã ã§ãããLinuxã·ã¹ãã ã§å®è¡ã§ããŸãã ãã ãããããžã§ã¯ãå šäœãèšè¿°ãããã¡ã€ã«ïŒ.slnãã¡ã€ã«ïŒã¯ãå®å šã«ã¯ãã¹ãã©ãããã©ãŒã ã§ã¯ãããŸããã ãããã£ãŠãWindowsãå®è¡ããŠããå Žåããã®ãã¡ã€ã«å ã®ãããžã§ã¯ããžã®ãã¹ã¯æ£ããæžã蟌ãŸããŸãã-ããã¯ã¹ã©ãã·ã¥æåã\ãã䜿çšããŸãã æ®å¿µãªãããããã¯ä»ã®ãšããåé¡ã§ãã éããªãä¿®æ£ãããŸãã ãã ãããã«ãäžã«ããµãŒããŒãŸãã¯ããŒã«ã«ãã·ã³ã§ã次ã®åœ¢åŒã®ãšã©ãŒã衚瀺ãããŸãã
error MSB4025: The project file could not be loaded. Could not find file ... MySuperProject.fsproj.metaproj.
ã»ãšãã©ã®å Žåãããã¯.slnãã¡ã€ã«ã«ç§»åããã\ããã/ãã«æåã§å€æŽããå¿ èŠãããããšãæå³ããŸãã
ããã§ãããžã§ã¯ãã®æºåãã§ããŸããã ãããåéããæ£åžžã«çµã¿ç«ãŠãããŠããããšã確èªããŠãå ã«é²ã¿ãŸãããã
Hello Worldãèšè¿°ããäŒçµ±ã®ã«ãŒãã¯ã1974幎ã«ããã®ãŒããŸãã ãã®ãšãã Cã®ããã°ã©ãã³ã°ïŒãã¥ãŒããªã¢ã«ã¬ã€ããç»å ŽããŸããã ããã¥ã¢ã«ã«èšèŒãããŠããã³ãŒãäŸããææ°ã®ã³ã³ãã€ã©ã«ãã£ãŠã³ã³ãã€ã«ãããªããªã£ãŠããããšãéèŠã§ãã
CI-ãã«ã
ã¿ã°ïŒTravisSupport
FïŒã«ã¯æ¢ã«åäœããWebã¢ããªã±ãŒã·ã§ã³ããããŸãã çŽæ¥éçºãéå§ããããšã¯å¯èœã§ããããã®èšäºã¯ããã«ã€ããŠã§ã¯ãããŸããã ãããã£ãŠã CIããã»ã¹ã®æ§æãéå§ããæãç°¡åãªãã«ãæ§æã§éå§ããŸãã
å®éãCIã¯ãµãŒãã¹ã§ãããŒã«ã§ããããŸããã ããã¯ããã°ã©ãã³ã°ãžã®ã¢ãããŒãã§ããããã®äž»ãªç°¡ç¥åãããèãæ¹ã¯ãé »ç¹ãªã³ããããèªåæ€èšŒãããã³ãšã³ããŠãŒã¶ãŒãžã®çµæã®é ä¿¡ã§ãã ãããã£ãŠãCIãæ§æãããšèšããšãããã¯ãã¹ãŠã®ãã«èŠæ±ã§èªåãã«ãããã»ã¹ãã»ããã¢ãããããã¹ããå®è¡ãããã®çµæãåæããããšãæå³ããŸãã ãããŠãããããã¹ãŠã®çµæã¯ãã«ãªã¯ãšã¹ãã®ããäžã«è¡šç€ºãããã®ã§ããããžã§ã¯ãã誰ãã©ã®ããã«ç Žã£ãããåžžã«èªèããŸãã
æ°ãããã©ã³ããäœæããŠãTravisSupportãšããååãä»ããŸãããã ã¡ãªã¿ã«ãæ°ããæ©èœãå®è¡ããŠããå Žåã¯ããã¹ã¿ãŒã§ã¯ãªãå¥ã®ãã©ã³ãã§å®è¡ãããšäŸ¿å©ã§ãã æåã«ãããªãã¯ããªãã®ä»²éã圌ãã®ã³ãããããç¬ç«ããŸãã 第äºã«ãããŒã«ã«ãã©ã³ãã§ã¯ãã¡ã€ã³ãã©ã³ãã«èœã¡ãŠäœããå£ãããšãæããã«ã³ããããè¡ãããšãã§ããŸãã 3çªç®ã«ãç§ã®ãæ°ã«å ¥ãã®å©ç¹ã¯ã-squashãã©ã°ã§ããŒãžãããšããã¹ãŠã®ã³ãããã1ã€ã«ããŒãžããã100500åã®è©Šè¡ããªãã£ãããã«èŠããŸããããã¹ãŠãåããŠå€æããŸããã éèŠãªã®ã¯ããœãŒã¹ãã©ã³ããåé€ããããšãå¿ããªãã§ãã ãããããããªããšãäœæ¥ãç¶ããŠå床ã³ãããããããšãããšã競åãçºçããå¯èœæ§ããããŸãã
ãããããã€ã³ãã«è¿ãã CIã®å Žåããããžã§ã¯ããçµã¿ç«ãŠããã¹ãããæ±ããŠããããšãå®è¡ããããŒã«ãå¿ èŠã§ãã ãã®ãããªããŒã«ãšããŠTravis-CIãéžã³ãŸããã ããã¯ãªãŒãã³ãœãŒã¹ã§ã¯ç¡æã§ãæ¯èŒçã·ã³ãã«ã§ãããç§ã¯ããçšåºŠã®çµéšããããŸãã
Travisãšçµ±åããã«ã¯ã次ã®ãã®ãå¿ èŠã§ãã
- Travisã«ãªããžããªãžã®ã¢ã¯ã»ã¹æš©ãä»äžããŸãã
- 圌ã«äœãå¿ èŠãã圌ã«èª¬æããŠãã ããã
æåã®ãã€ã³ãã¯éåžžã«ç°¡åã§ãã éã https://travis-ci.org/ã«ã¢ã¯ã»ã¹ããGitHubã¢ã«ãŠã³ãã䜿çšããŠããã«ãã°ã€ã³ããŸãã 次ã«ã䜿çšå¯èœãªãªããžããªã®ãªã¹ãã«ãªããžããªãè¿œå ããŸãã ãªããžããªã衚瀺ãããªãå Žåã¯ãSyncAccountãã¿ã³ã䜿çšããŸãã
2çªç®ã®ãã€ã³ãã¯ãã¯ããã«èå³æ·±ããã®ã§ãã CIããã»ã¹ã¯ãtravis-aã.travis.ymlãã¡ã€ã«ã䜿çšããŠå¶åŸ¡ããŸãã ãããããã¥ã¡ã³ãã§ãã ãã®ãã¡ã€ã«ããããžã§ã¯ãã®ã«ãŒãã«ã³ããŒããããã«æžãããŠããå 容ãåæããŸãããã
language: csharp dotnet: 2.1.4 sudo: false env: global: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 script: - dotnet build FSharpWebAppWithCIDemo.sln -c Release
- èšèª-ã¢ããªã±ãŒã·ã§ã³ãèšè¿°ãããŠããèšèªã Travisã¯CïŒãšFïŒãåºå¥ãããfsharpãã£ã¬ã¯ãã£ãããããŸããã ãã ãããã®ãã¡ã€ã«ã¯CïŒãããžã§ã¯ãã«ãé©ããŠããŸãã
- dotnet-dotnetã®ããŒãžã§ã³ãããã«æå®ããŠãåéããæ å ±ã確èªã§ããŸãã
- env-ãã®ã»ã¯ã·ã§ã³ã¯ç°å¢å€æ°ãæ åœããŸãã ã芧ã®ãšãããDOTNET_CLI_TELEMETRY_OPTOUTãè¿œå ããŠããã«ãããã»ã¹äžã«ãã¬ã¡ããªéä¿¡ããªãã«ããŸããã ããã«ä»»æã®å€æ°ãæžã蟌ãããšãã§ãããã«ããžã®åŒæ°ãšããŠæž¡ãããŸãã
- ã¹ã¯ãªãã-ãã®ã»ã¯ã·ã§ã³ã¯ãtravis-aã«å¿ èŠãªãã®ãæ åœããŸãã ãã®å Žåãã¢ããªã±ãŒã·ã§ã³ã®ãªãªãŒã¹ã¢ãŒãã§ãã«ããå®è¡ããã ãã§ãã
ããã¯ãæãåçŽã§æãåºæ¬çãªCIã·ããªãªã§ãã ç°¡åã«èšãã°ããã«ãªã¯ãšã¹ãããšã«ããã«ããåéããããšããŸãã è¡ã-ãã¹ãŠé 調ã§ãã è¡ããŸãã-GitHubãšã¡ãŒã«ã§èŠåã衚瀺ãããŸãã CIããã»ã¹ãéå§ããæ¡ä»¶ã¯ã.travis.ymlèªäœãšãµã€ãã®ãããžã§ã¯ãèšå®ã®äž¡æ¹ã§ç°¡åã«æ§æã§ããŸãã ãŸããTravisã®è¿œå æ©èœïŒOSã®éžæãªã©ïŒã«èå³ãããå Žåã¯ã次ã®ããã«ãªããŸãã
ãã«ãäžã«ãMSB4025ããã¡ã€ã«... .fsproj.metaprojãèŠã€ãããŸããã§ããããšãããšã©ãŒãçºçããå Žåã.slnãã¡ã€ã«å ã®ããã¯ã¹ã©ãã·ã¥ãã¹ã©ãã·ã¥ã«çœ®ãæããŠã¿ãŠãã ããã
ãšããã§ããã«ãããã»ã¹ãèŠããšãLinuxã§å®è¡ãããŠããããšãããããŸããããã¯æå ±ã§ãã
ãããŠãåœç¶ãreadmeã«ãµãããããããžãè¿œå ããããšãå¿ããªãã§ãã ããã Travis CIãããžã§ã¯ãã«ãããŸãã
ãããžã®å¯èŠæ§ãæ°ã«å ¥ã£ããã ãã¡ããã芧ã«ãªãããšããå§ãããŸãã ååã§ã¯ãªãå Žåã¯ãããã§ç¬èªã®ãããžãäœæã§ããŸãã
Ciãã¹ã
ã¿ã°ïŒCodeCov
ããã§ã¯ããã¹ãã®æéã§ãã äžè¬ã«ãã³ãŒããèšè¿°ããåã«ãã¹ããèšè¿°ããããšãªãã TDDã®ååã«æ¢ã«éåããŠããŸãã ããã§ããããä¿®æ£ããæãæ¥ãŸããã
Bllãããžã§ã¯ãã®äžã§ãæ°ããBllTestãããžã§ã¯ããäœæããããã«BllTest.fsãè¿œå ããŸãã åããããžã§ã¯ãã«xUnitãã€ã³ã¹ããŒã«ãã
ãããžã§ã¯ãã®æ§é ã¯æ¬¡ã®ããã«ãªããŸãã
-FSharpWebAppWithCIDemo
--ãã«
--BllTest
--WebServer
Bllãããžã§ã¯ãã§ãSayã¢ãžã¥ãŒã«ãšhelloé¢æ°ã䜿çšããŠæ°ããbll.fsãã¡ã€ã«ãäœæããŸãïŒãã¹ãã®åã«ã³ãŒããèšè¿°ããŠTDDã«éåããŸããïŒ
namespace Bll module Say = open System let hello() = "Hello user #" + Guid.NewGuid().ToString()
ãããŠãããããã¹ãããŸããã€ãŸãããã®é¢æ°ãåŒã³åºããçµæãåžžã«åã®ãã®ãšç°ãªãããšã確èªããŸãã ãšããã§ãããã¯ä¿èšŒãããŠããŸããã 2ã€ã®GUIDãçæãããšãåã2ã€ã®GUIDãååŸã§ããå¯èœæ§ããŒãã§ã¯ãããŸããã 確ãã«ããã®ã€ãã³ããåŸ ã€ãŸã§å€ªéœã¯æ¶ããŸããããŸã ãã£ã³ã¹ã¯ãããŸãã
å®éãã³ãŒãèªäœããã¹ãèªäœãéèŠã§ã¯ãããŸããïŒçµå±ãããªãã¯ãã§ã«ãããèããããšããããŸãããïŒïŒã Travisããã³CodeCovãšæ£ããçµ±åããã«ã¯ããããã®ååšã®ã¿ãéèŠã§ãã ãã¹ããæåã§å®è¡ããåæ Œããããšã確èªããŠç¶è¡ããŸãã æåã®ãã¹ããè¡ã£ãåŸããã®ãã¹ããå®è¡ããã«ã¯Travisãå¿ èŠã§ãã ãããè¡ãã«ã¯ã.travis.ymlã§ã¹ã¯ãªããã»ã¯ã·ã§ã³ã«å¥ã®è¡ãè¿œå ããå¿ èŠããããŸã
- dotnet test -c Release --no-build BllTest/BllTest.fsproj
ããã§ã¯ãã¹ãŠãæããã§ã-ãã«ããªãã§ãã¹ããå®è¡ããŸãïŒãã«ãã¢ãŒãã£ãã¡ã¯ãã¯åã®æé ã§æ¢ã«ååŸãããŠããããïŒãããã«ããæéãç¯çŽã§ããŸãã
ããããããã§ã¯ååã§ã¯ãããŸããã ã³ãŒãã«ãã¬ããžçµ±èšãå¿ èŠã§ãã ãã®ããã coverlet.msbuildã¯msbuildã«çµã¿èŸŒãŸã ã å¿ èŠãªopencoverãå«ãããŸããŸãªåœ¢åŒã§ã¬ããŒããäœæããçŽ æŽãããããŒã«ã§ãã Nugetã¿ããéãïŒãŸãã¯ã³ã³ãœãŒã«ããã³ãã³ããå®è¡ãïŒãBllTestãããžã§ã¯ãçšã«ãã®ããã±ãŒãžãã€ã³ã¹ããŒã«ããŸãã ä»ã®ãããžã§ã¯ãã§ã¯å¿ èŠãããŸããã ãã®åŸã.travis.ymlã®åã®è¡ã次ã®ããã«å€æŽããŸãã
- dotnet test -c Release --no-build BllTest/BllTest.fsproj /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
ããã§ã.travis.ymlã®ãã«ããŒãžã§ã³ãããã§éžæã§ããããšãæãåºãããŠãã ãã
ã³ã³ãœãŒã«ããåãã³ãã³ããå®è¡ããŠããã¹ãŠãæ©èœããããšã確èªã§ããŸãã åæã«ããããžã§ã¯ãã®çŸåšã®ã³ãŒãã«ãã¬ããžã衚瀺ãããŸãã
ãã®ããããã¹ãããããå®è¡ãããäœããã®ã³ãŒãã«ãã¬ããžã¬ããŒããèŠãããšãã§ããŸãã ããããããã§ãååã§ã¯ãããŸããã ããã§ããã®ã¬ããŒããåŠçããŠçµæãå ±åã§ãã誰ããå¿ èŠã§ãã ããã§Codecovã䟿å©ã«ãªããŸããããã¯OpenSourceãããžã§ã¯ãã§ãç¡æã§ãã GitHubã¢ã«ãŠã³ãã䜿çšããŠCodecovã«ãã°ã€ã³ããç®çã®ãããžã§ã¯ããè¿œå ããŸãã æåŸã«ãæåŸã«.travis.ymlãæŽæ°ãããšãã«ãæ°ããã»ã¯ã·ã§ã³after_scriptãè¿œå ããŸãã
after_script: - bash <(curl -s https://codecov.io/bash)
ãã®äŸãèŠãŠããããæ³£ããŸããã ãããŸã§ã¯ãã«ããŒãªãŒã«ãžã®ã¬ããŒãã®éä¿¡ãéå§ããããã«çŽ3æéãè²»ãããŸããããããã§ã¯ãã¹ãŠãéåžžã«ã·ã³ãã«ã§ããããšãå€æããŸãã...ç§ã幞ãã«ããŠãããŠããããšãã
ãã¹ãŠã®æºåãå®äºããã®ã§ãã³ããããè¡ãã100ïŒ ã®ã«ããŒçã§ååãªãããžãååŸã§ããŸãã
ã±ã³ãããã¯ãTDD ã®äœè ãšåŒã¶äººãããŸããã圌ã¯æã®ããã°ã©ãã³ã°æ¬ã§ãã£ãšåã«èªãã ãã¯ããã¯ãåçºèŠããã ãã ãšèšããŸãã
CIã®å±é
ã¿ã°ïŒDeployToAzure
æ¯ãåžã£ãŠãã³ãŒããŒã飲ãã§ãã€ã³ãã©ã¹ãã©ã¯ãã£ã®ä»äºã®çµãããè¿ã¥ããŠããŸãã å±éããã»ã¹ã®æºåãéå§ããŸãã
èŠããã«ããããã€ã¡ã³ããšã¯ãå®è¡ã®ããã«äœæ¥çµæïŒãã«ãã¢ãŒãã£ãã¡ã¯ãïŒãæäŸããããã»ã¹ã§ãã ããã¯ãæã§ããŸãã¯èªåã¢ãŒãã§è¡ãããšãã§ããŸããããã¯ãæ ãè ãšããŠãç§ã¯ãã£ãšå¥œãã§ãã Azureã§ãããã€ãèšå®ããæ¹æ³ã玹ä»ããŸãïŒãã ããããã¯æ¢ã«ã¢ã«ãŠã³ããããããŸã æ°ãã«æ®ã£ãŠããããã§ãïŒã ããã«åããªãå Žåã¯ãTravisãæºåãããã«ãã¢ãŒãã£ãã¡ã¯ãã䜿çšã§ããŸãã dotnet buildãdotnet publishã«å€æŽããçµæããµãŒããŒã«éä¿¡ããã ãã§ååã§ãã次ã«äŸã瀺ããŸãã
- AWS S3
- Githubã®ããŒãž
- NPM
- ãšãã¯
- Googleã¢ããªãšã³ãžã³
ããããä»ã§ã¯ããã«ã€ããŠã§ã¯ãªããAzureã«ã€ããŠã§ãã å±éã®ã»ããã¢ããã¯æ¯èŒçç°¡åã§ãïŒäœãããïŒAzureèªäœã®å€éšãã管çãããŸãã ä»ããã話ãããŸãã
ãŸããç¬èªã®Webã¢ããªã±ãŒã·ã§ã³ãäœæããå¿ èŠããããŸãã ããã¯éåžžã«ç°¡åã§ãã Azureã«ç§»åãã[ãªãœãŒã¹ã®äœæ]-> [Webã¢ããª]ãŸãã¯ãã®ãªã³ã¯ãã¯ãªãã¯ããŸãã ããã§ãå°æ¥ã®ãµã€ãã®ååããµãã¹ã¯ãªãã·ã§ã³ïŒãµãã¹ã¯ãªãã·ã§ã³ã¯è«æ±å ã«ãªããããåŠçã®å Žåã¯ç¡æã®ãµã€ããéžæããããšããå§ãããŸãïŒããã³ãµãŒããŒããããã€ãããOSãéžæããŸãã ã³ã¢ã䜿çšããŠãããããLinuxãšWindowsã®äž¡æ¹ãéžæã§ããŸãã Windowsãéžæããçç±ã¯ãããå¿«é©ã«æããããã§ãããäžè¬çã«éãã¯ãããŸããã Webãµã€ããæ§ç¯ããå®éã«æ©èœããããšã確èªããå±éã®ã»ããã¢ãããå§ããŸãããã ãããè¡ãã«ã¯ããããžã§ã¯ãã®ã«ãŒããã©ã«ããŒã«2ã€ã®ãã¡ã€ã«ãè¿œå ããŸãã
- .deployment //ãããã€ã¡ã³ãã®ããã«åŒã³åºãå¿ èŠããããã®ãèšè¿°ããŸãïŒ
- build.cmd //å±éäžã«æ£ç¢ºã«è¡ãããšãèšè¿°ããŸã
äžèŠãbuild.cmdã¯ããªãæãããã«èŠããŸãããå éšã§ã¯éåžžã«äºçŽ°ãªããšãèµ·ãããŸãã
- Node.jsã確èªããŸã//ä¿¡ããããŸããããMicrosoftã¯å±éããã»ã¹ã§Node.jsã䜿çšããŸã
- ãã¹ã§å€æ°ãèšå®ããŸã//ãã¡ã€ã«ãšãµãŒããŒãã¡ã€ã«ãããå Žæ
- kudusync //ãµãŒããŒãã©ã«ããŒã«ã¢ãŒãã£ãã¡ã¯ããã³ããŒããããã®ãŠãŒãã£ãªãã£ãã€ã³ã¹ããŒã«ããŸã
- dotnet publishã³ãã³ããå®è¡ãããŸã//ã³ãŒããã³ã³ãã€ã«ããŸã
- å ¬éçµæã¯wwwrootãã©ã«ããŒã«ã³ããŒãããŸãã //ã¢ããªã±ãŒã·ã§ã³ãå®è¡ããããã«çµæããµãŒããŒã«æž¡ããŸã
ãããã®ãã¡ã€ã«ãè¿œå ããããWebã¢ããªã±ãŒã·ã§ã³ãGitHubã®ãªããžããªã«ãªã³ã¯ããã ãã§ãã ãããè¡ãã«ã¯ãã¢ããªã±ãŒã·ã§ã³ãéžæããDeploymentOptions-> Github-> Project-> BranchãéžæããŸãã ãšããã§ãè² è·ãã¹ããããã§æ§æã§ããŸãã 以äžã§ããã¹ãŠãåæãããŠã·ã£ããããŠã³ããããŸã§åŸ æ©ããããšã«ãªããŸããã
åŸã«Azureã«ãªã£ããããžã§ã¯ãã®ã³ãŒãåã¯ãProject Red Dogãã§ããã
Gitããã¯
CIã«ã€ããŠè©±ãã gitããã¯ã«èšåããªãã®ã¯ããããæ£ãããªãã§ãããã ããã«ãèšäºã§èª¬æãããŠããæ©èœãå¯èœã«ãªãã®ã¯ããŒã«ã§ããããã¯ã§ãã
Gitããã¯ããŸãã¯ããã¯ã¯ããªããžããªå ã®éèŠãªã€ãã³ãã®åãŸãã¯çŽåŸã«ã«ã¹ã¿ã ã¹ã¯ãªãããå®è¡ã§ããç¹å¥ãªã¡ã«ããºã ã§ãã ãããã䜿çšããŠãã³ããããå€æŽããããå€æŽãã°ãç¶æããããèªåãã©ãŒããããå®è¡ããããäžè¬ã«ã·ã¹ãã ã§ååãªæš©éãæã€ãã¹ãŠã®ãã®ã䜿çšãããã§ããŸãã ããã©ã«ãã§ã¯ããããã¯.git / hooksã«ãããŸãã
å°ã颚å€ããã§ãããdotnetã«ã¯ãã«ãåããã«ãåŸãªã©ã®ããã¯ããããŸãã ãŸããã«ã¹ã¿ã ã¹ã¯ãªãããå®è¡ããããšãã§ããŸãã
ãŸãšã
ä»æ¥ãGitããŒã¹ã®ãªããžããªãããžã§ã¯ãã®å®å šãªCIãµã€ã¯ã«ãèšå®ããæ¹æ³ãåŠã³ãŸããã ãã ããäž»ãªè³ªåã®1ã€ã¯æªåçã®ãŸãŸã§ãã-CIèªäœãå¿ èŠã§ããïŒ äžæ¹ã§ã¯ïŒ
...æãã®ã«ãããæéã¯ãããããã§ãããã®æã®å©ç¹ã¯ãã¡ãªã¿ã«ãã£ãªããžå šäœã§ã...©
äžæ¹ãPOCãå®è¡ããŠããå ŽåããŸãã¯æéãé·ãåããŠããå ŽåãCIã¯ããããã€ãŒããã³ãŒãã£ã³ã°ããå¿ èŠã¯ãããŸããã
ã€ãŸããCIã䜿çšãããã©ããã¯ãŠãŒã¶ãŒæ¬¡ç¬¬ã§ãã ãã ãããŸã è©ŠããŠããªãå Žåã¯ã詊飲ããå§ãããŸãã
ã¿ã°
- ã€ãã·ã£ã«ãã¹ã¿ãŒ
- NewFSharpProject
- ãã©ãã¹ãµããŒã
- CodeCov
- DeployToAzure
åç §è³æ
- .NET Core SDK> 2.1ã
- Github
- Git
- ãã©ãã¹-ci
- Travisdocumentation
- Codecov
- 玺Azure
- DemoRepository
- æãé²åºããã©ãã¯ããžãã¯ã®å©ç¹ã«ã€ããŠ
ãã¹ãŠã®æ¬æãæã£ãŠã