Codemagicã§Flutter(iOS & Android)ã¢ããªãèªåé ä¿¡-å ¨ä½è¨å®ç·¨
Codemagicã«ã¤ãã¦ã®æ¥æ¬èªè¨äºã¯ãã§ã«è¯è³ªãªãã®ãããã¾ãããã¾ã ã¾ã ä»ã®CI/CDãµã¼ãã¹ã¨æ¯ã¹ãã¨éãå°ãªããã¨ããå人çãªåå¿é²ã¨ãã¦ãæ¸ãæ®ãã¦ããã¾ãâï¸
ãã®è¨äºã§ã¯ã以ä¸ã®å 容ãã¹ã¯ãªã¼ã³ã·ã§ããä»ãã§è§£èª¬ãã¦ããã¾ãã
- freezedã使ç¨ããFlutterã¢ããªãiOS, Androidã§ãã«ã
- iOS, Androidã®ã³ã¼ãç½²å(Code signing)
- App Store Connectã¸ã®é ä¿¡ï¼ã¢ããªå ¬éã¨TestFlightãå©ç¨ã§ããï¼
- Google Play Consoleã¸ã®é ä¿¡
- Slackã¸ã®éç¥
Firebase(Auth, Firestore, RemoteConfigçï¼ã使ç¨ãã¦ãã¾ãããCodemagicä¸ã§ã¯ç¹ã«å°ããã¨ã¯ããã¾ããã§ããã
ãªããå½è¨äºã§ã¯é£æã§ãããFlavorã使ç¨ããªãã·ã³ãã«ãªè¨å®ã¨ãªã£ã¦ãã¾ãã
ã¢ããªãFlavorã«å¯¾å¿ããå ´åã®Codemagic追å è¨å®ã¯å¥è¨äºã«æ¸ãã¾ããâ
ã¢ããªã¸ã®Flavor対å¿èªä½ã¯ç¹ã« mono ããã®è¨äºã«è©³ããæ¸ããã¦ãã¾ãã
ãã®ä»ãCodemagicãå°å
¥ããã«ãããå
¨ä½çã«åèã«ããã¦ããã ãã¾ããããããã¨ããããã¾ãð
ã¾ãã¯å種ã¢ã«ã¦ã³ãã®é£æº
User Settingsç»é¢ã®IntegrationsããGitãããã¤ããSlackãApple Developer Portalã®ã¢ã«ã¦ã³ãã¨é£æºã§ãã¾ããSlackã®é£æºã«WebHookã¯ä¸è¦ã§ç°¡åã§ãã
GitHubçã®ã¢ã«ã¦ã³ããé£æºããã¨ãèªåã®ãªãã¸ããªåè£ã表示ãããã®ã§ããã«ããããããªãã¸ããªãé¸æãã¾ãããã
Storeé ä¿¡ç¨ã®Workflowãæ§ç¯
ããã§ã¯ãDefault Workflowã®ååãåããããããUpload to Storeãã¸å¤æ´ããã¨ãã¾ããï¼å¥½ããªååãã¤ãã¾ãããï¼
Duplicate workflowã§Workflowãè¤è£½ã§ãã¾ãã
Max build durationã§è¨å®ããæéãè¶ ããã¨ãã¿ã¤ã ã¢ã¦ãã§ãã«ããçµäºãã¾ããFirabaseã使ç¨ããiOSã®ãã«ãã¯æãã®å¤æéããããã®ã§é·ãã«è¨å®ãã¦ããã¾ããã
Build triggersï¼ãã«ãå®è¡æ¡ä»¶ï¼
ãã«ã対象ã«ããããã©ã³ãåãæååã§æå®ã
Includeã¯å«ããExcludeã®å ´åã¯ä¸ã§æå®ãããã©ã³ãåãé¤å¤ããè¨å®ã«ãªãã¾ãã
Source, Targetã¯ããã«ãªã¯ã¨ã¹ãç¨ã®è¨å®ã§ãã対象ãã©ã³ããå ã»å ã©ã¡ãã®ãã©ã³ãããæå®ãã¾ãã
ãã«ããèªåã§éå§ãããæ¡ä»¶
- Trigger on push: 対象ãã©ã³ãã«ã³ããããPushãããæ
- Trigger on pull request update: ãã«ãªã¯ã¨ã¹ããéããããæ´æ°ãããæ
- Trigger on tag creation: ã¿ã°ãä½æãããæ
Environment variablesï¼ç°å¢å¤æ°ï¼
ä»åã¯ä½¿ç¨ãã¾ããã
Dependency cachingï¼ä¾åã®ãã£ãã·ã¥ï¼
Enable dependency caching
ã¯ãpubspec.yaml
ã§æå®ããããã±ã¼ã¸çã®ä¾åç©ããã£ãã·ã¥ãããã©ããã
Storeé ä¿¡ç¨ãªã®ã§ãä»åã¯æå¹ã«ã¯ãã¾ããã§ããã
é »ç¹ã«åããã«ãç¨ã§ããã°ãæå¹åãããã¨ã§ãã«ãæéã®ç縮ãçããã®ã§ã¯ãªãã§ãããã
ã¡ãªã¿ã«ãããã¥ã¡ã³ãã§ã¯ä»¥ä¸ã®ãã£ãã·ã¥ãã¹ãä¾ã¨ãã¦æ示ããã¦ãã¾ããã
å¿ è¦ã§ããã°Addãã¦ã¿ã¾ãããã
$FLUTTER_ROOT/.pub-cache
: Dartã®ãã£ãã·ã¥$HOME/.gradle/caches
: Gradleã®ãã£ãã·ã¥$HOME/Library/Caches/CocoaPods
: CocoaPodsã®ãã£ãã·ã¥
Pre-test scriptï¼ãã¹ãåã«å®è¡ããã¹ã¯ãªããï¼
Dependency cachingã¨Testã®éã®ãï¼ããã¿ã³ã¾ãã¯æ¯è»ãã¿ã³ãæ¼ããã¨ã§ç·¨éã§ãã¾ãã
freezedçã®ã³ã¼ãã¸ã§ãã¬ã¼ã¿ã使ç¨ãã¦ããããã¤çæå¾ã®ã³ã¼ãï¼*.freezed.dartã*.g.dartãªã©ï¼ãgitignoreãã¦ããå ´åã«å¿ è¦ãªã¹ã¯ãªããã«ãªãã¾ãã
#!/bin/sh
set -e # ã¨ã©ã¼ãåºããçµäºãã
# Generate by freezed with JSON
flutter pub pub run build_runner build
ãã®ã¹ã¯ãªãããå®è¡ããªãå ´åããã¡ã¤ã«ã足ããªãTestãBuildã失æãã¾ãã
Testï¼ãã¹ãã¨è§£æï¼
Flutter analyzerã¨Flutter testãèµ°ããããã¾ãã
Stop build if tests failããã§ãã¯ããã¨ããã¹ã失ææã¯ãã«ããä¸æãã¾ãã
ãã¹ãé¢é£ã«ã¤ãã¦ã¯çãã以ä¸æ¥æ¬èªè¨äºãåèã«å®è£ ãã¦ããããã¨æã£ã¦ãã¾ãã
Flutterã®ãã¹ãå ¨ä½ã«ã¤ãã¦
https://itome.team/blog/2019/12/flutter-advent-calendar-day20/
Flutter Driver testã«ã¤ãã¦
https://qiita.com/sensuikan1973/items/c8b56dfaf780e61af567
Buildï¼ãã©ãããã©ã¼ã ãã¨ã®ãã«ãï¼
å種ãã¼ã¸ã§ã³ãç´æ¥æå®ããããLatestãDefaultã¨ãã£ãããã«ããç¨åº¦ä»»ãããã¨ãã§ãã¾ãã
- åºæ¬ããã¡ãã®è¨å®ããã¼ã«ã«ã®ç°å¢ã«åããã¦ãã
- Latestã«è¨å®ãã¦ããããã«ãæåããããã¼ã«ã«ã®versionãã¢ãããã¼ããã
ã®ã©ã¡ããããªã¨æãã¾ããã
ä»åã¯ãStoreç³è«ç¨ãªã®ã§å®å ¨ãªãã¼ã«ã«ã§ä½¿ç¨ãã¦ãããã¼ã¸ã§ã³ã«åããã¦æå®ãã¦ãã¾ãã
対象ãã©ãããã©ã¼ã ã¨ãã«ãã¢ã¼ã
対象ã¨ãªããã©ãããã©ã¼ã ãé¸æãã¾ãã
Firebaseçã使ã£ã¦ããã¨iOSã®ãã«ãã¯é·ããªããã¡ãªã®ã§ããã¹ãæã¯Androidã¨iOSçæ¹ã ãã§ãã«ããã¹ãããæ¹ãè¯ãã¨æãã¾ãã
Build Android App Bundlesããã§ãã¯ããã¨App Bundlesãçæããã¾ãã
Google Play Storeã§ã¯App Bundlesãæ¨å¥¨ããã¦ããã®ã§ãã§ãã¯ãã¦ããã¾ãããã
ä»åã¯Storeé
ä¿¡ç¨ãªã®ã§Mode: Release
ãé¸æãã¦ãã¾ãã
Build argumentsã§ã¯ãã®ä»ãã«ãæã®è¨å®ã追å ã§ãã¾ãã-t lib/main.dart
ã®ããã«å¯¾è±¡ã®main.dartãã¡ã¤ã«ã®ãã¹ãæå®ã§ãã¾ãã
ãã«ãçªå·ã®ã¤ã³ã¯ãªã¡ã³ã
App Storeã«é ä¿¡ããã«ããããåããã¼ã¸ã§ã³ã»åããã«ããã³ãã¼ã®ã¢ããªã¯ã¢ãããã¼ãã§ãã¾ããã
pubspec.yamlãæåã§æ¸ãæãã¦pushãç´ãã®ã¯æéãªã®ã§ãèªåã§ã¤ã³ã¯ãªã¡ã³ããããããã«è¨å®ãã¦ããã¾ãã
--build-number=$BUILD_NUMBER
ã¨ããã¨ãWorkflowã®ãã«ãçªå·(ååã¯#1ï¼ãåæ ãããããã«ãªãã¾ãã
Xcodeã§ãã Build
ã§ãã
å¾ããCodemagicãæ¡ç¨ããã¨ããªã©ã¯ãç¾å¨ã®ãã«ãçªå·ã¨Workflowã®ãã«ãçªå·ãä¹é¢ãã¦ãããã¨ããããã¨æãã¾ãã
ãã®å ´åã¯ä¸è¨ã®ããã«ç¾å¨ã®ãã«ãçªå·ã足ãã°è¯ããã¨ã
--build-number=$(($BUILD_NUMBER + 100))
https://docs.codemagic.io/building/build-versioning/
Publishï¼é ä¿¡ã»éç¥ï¼
æå¾ã«ãåStoreã¸ã®ã¢ããªé ä¿¡ãSlackã¸ã®éç¥ãè¨å®ãã¾ãã
Android code signing
çæããkey.jksãã¡ã¤ã«ãã¢ãããã¼ãã
çææã«è¨å®ããKeystore passwordãå
¥å
Key aliasã¯ããã©ã«ã㧠key
ã§ãã
iOS code signing
iOSã®ç½²åè¨å®ã
å人éçºçã¯ãçç±ããªããã°Automaticãé¸æããã®ãç°¡åã§è¯ãã¨æãã¾ãã
ä»åã¯Storeç³è«ç¨ãªã®ã§ Provisioning profile type: App store
ãé¸æãã¦ãã¾ãã
Bundle identifierã¯æªå ¥åã§ã大ä¸å¤«ã ã¨ã¯æãã¾ãããç°å¢ã«ãã£ã¦Bundle identifierãå¤ããå ´åçã¯å ¥åãå¿ è¦ãã¨æãã¾ãã
Automaticã§ã¯ãªãManualãé¸æããå ´åã¯ä»¥ä¸ã®ãã¡ã¤ã«ãã¢ãããã¼ãããå¿ è¦ãããã¾ãã
- Certificate
- Provisioning profiles
åãã¡ã¤ã«ã¯Appleã®Developerãµã¤ãã§ä½æãã¾ãã
https://developer.apple.com/account/resources/certificates/list
Slack
ããã©ã«ãã§Emailéç¥ãæå¹åããã¦ãã¾ãã
åé ã§Slacké£æºãæ¸ã¾ãã¦ããã°ãSlackéç¥ã¯ç°¡åã§ãã
- æ稿å ã¨ãªãChannelãé¸ã¶
- ãã«ãéå§æã«éç¥ãã¦ã»ãããã°
Notify when build starts
ã«ãã§ãã¯ãå ¥ãã¾ãã - ãã«ã失ææã«ãAPKãIPAãã¡ã¤ã«ãªã©ã®ææç©ãé
ä¿¡ããããæã¯
Publish artifacts even if tests fail
ã«ãã§ãã¯
Google Play
Androidã¢ããªãGoogle Play Storeã«ã¢ãããã¼ãããããã«æå¹åãã¾ãã
Credentials (.json)
Google Play Storeçµç±ã§åå¾ããJSONãã¡ã¤ã«ãã¢ãããã¼ããã¾ãã
æé ãã¡ãã£ã¨åããã«ããã§ãã
- è¨å®>APIã¢ã¯ã»ã¹>ãµã¼ãã¹ã¢ã«ã¦ã³ããä½æ>ãGoogle API ã³ã³ã½ã¼ã«ããªã³ã¯ãã¯ãªãã¯ããã¨Google Cloud Platformã®ãã¼ã¸ãã²ãk
- ããµã¼ãã¹ã¢ã«ã¦ã³ãã®ä½æããã¿ã³ããã権éï¼ãµã¼ãã¹ã¢ã«ã¦ã³ãâãµã¼ãã¹ã¢ã«ã¦ã³ãã¦ã¼ã¶ã¼ããé¸æãã¦é²ã¿ã¾ãã
- éµã®ç¨®é¡ã¯ãJSONããç§å¯éµã®æä¾ã«ãã§ãã¯ãã¦é²ã¿ã¾ãã
- ä½æããJSONèªè¨¼æ å ±ãã¡ã¤ã«ããã¦ã³ãã¼ããã¾ãã
- Google Play Consoleã«æ»å©ããå®äºããã¿ã³ãæ¼ãã¾ãã
- ã¢ã¯ã»ã¹æ¨©éãæ¿èªãããã¿ã³ãã¯ãªãã¯ããå½¹å²ãã«ãã¦ã³ããããªãªã¼ã¹ããã¼ã¸ã£ã¼ããé¸æãã¾ãã
- Codemagicã§JSONãã¡ã¤ã«ãã¢ãããã¼ãããã°OKã§ãã
Codemagicå
¬å¼ããã¥ã¡ã³ã
https://docs.codemagic.io/publishing/publishing-to-google-play/
ãã©ãã¯ã®é¸æ
- å é¨ãã¹ãï¼Internalï¼
- ã¯ãã¼ãºãï¼Alphaï¼
- ãªã¼ãã³ï¼Betaï¼
- 製åçï¼Productionï¼
å¥éãã¹ãé ä¿¡ããå¿ è¦ããªãã®ã§ããã°ãProductionï¼è£½åçï¼ãé¸æãã¦ããã°ããã«å ¬éã«åãæãããã¨ãã§ãã¾ãã
ãªãããâ»Codemagicã§ã®é ä¿¡åã«ä¸åº¦æåã§ã¢ããªãGoogle Play Storeã«ã¢ãããã¼ãããå¿ è¦ãããã¾ããã¨æ¸ããã¦ããã®ã§ãåã¯ãããããApp Bundleãä¸åº¦æåã§ã¢ãããã¼ããã¦ããã¾ããã
ãã©ãã¯ä½æã«ã¯ãã©ã¤ãã·ã¼ããªã·ã¼ã®è¨å®ãå¿ è¦ãªã®ã§æ¸ã¾ãã¦ããã¾ããï¼ã¢ããªã®ã³ã³ãã³ã>ãã©ã¤ãã·ã¼ããªã·ã¼ï¼
App Store Connect
App Storeã¸ã¢ããªãå ¬éããããTestFlightã使ç¨ããããã«è¨å®ãã¾ãã
App-specific password㯠Apple IDã®ãã¹ã¯ã¼ãã§ã¯ãªããApple IDã®ã¢ã«ã¦ã³ã管çç»é¢ã§çºè¡ãããã®ã使ç¨ãã¾ãã
https://appleid.apple.com/account/manage
App IDãè¥å¹²ç´ããããã®ã§ãããBundle IDã®ãã¨ã§ã¯ããã¾ããã
App Store Connectã§ã¢ããªãä½æããå¾ãAppæ å ±ãã確èªã§ãããApple IDããå ¥åãã¦ãã ããã
READMEçã«ããã¸ã表示ãã
ãã«ãç¶æ³ï¼passed, failedçï¼ã®ããã¸ã表示ã§ãã¾ãã
Badge markdownã®ãªã³ã¯ãã³ãã¼ãã¦READMEã«è²¼ãä»ããã ããªã®ã§ç°¡åã§ãã
ãã«ãç¶æ³ã«ããèªåã§è¡¨ç¤ºãåãæ¿ããã¾ãã
ç¡æãªã®ã¯500å/æ
Mac miniã§ãã«ãããã¾ãããç¡æã§ãã«ãã§ããæéã¯500åã¨ãªãã¾ãã
ã¯ã¬ã¸ããã«ã¼ããç»é²ããã°500åãè¶ ããåãææã§ãã«ãããããMac Proã§ã®ãã«ããå©ç¨ã§ãã¾ãã
2020å¹´7æ1æ¥ç¾å¨ã®ä¾¡æ ¼ã¯ä»¥ä¸ã®ããã«ãªã£ã¦ãã¾ãã
- Mac mini: $0.038/åï¼10åã§ç´40åï¼
- Mac Pro: $0.095/åï¼10åã§ç´100åï¼
Mac Proã§ã®ãã«ãã¯ã©ã®ããããã«ãæéãç縮ãããã®ãæ°ã«ãªãã¨ããã§ããð§
ãã«ãæ©ã§ããMac mini, Mac Pro, Xcodeçã®è©³ããæ
å ±ã¯ãã¡ãï¼
https://docs.codemagic.io/releases-and-versions/versions/
以ä¸ãåã®ç°å¢ã§ã¯ãã«ããå®è¡ã§ãã¢ããªãåã¹ãã¢ã«ã¢ãããã¼ããããã¨ãã§ãã¾ããï¼
åããã«ããç¹ãééã£ã¦ããç¹ãªã©ããã¾ãããã³ã¡ã³ããTwitter(@Riscait)ãããé£çµ¡ããã ããã¨å¤§å¤å¬ããã§ãð
ä»ã«ãCodemagicã«ã¤ãã¦ã®ç´ æ´ãããæ¥æ¬èªè¨äºãããã¾ããã®ã§ãªã³ã¯ãè²¼ããã¦ããã ãã¾ãã
ãé²è¦§ãããã¨ããããã¾ããï¼
å°ãã§ããå½¹ã«ç«ã¦ãã®ãªãã°ãClapðããã ãããå¬ããã§ãï¼