LoginSignup
104
80

More than 5 years have passed since last update.

fastlaneを使ってみる

Last updated at Posted at 2015-11-27

fastlaneとは?

image

引用元:https://fastlane.tools/

  • iOSのリリース作業を自動化するCUIツール
  • Rubyで出来てる
  • アクションと呼ばれる機能を組み合わせて使う
  • アクションの組み合わせはレーンで行う
  • レーンはFastfileという設定ファイルに記述する

主なアクション

  • 黒枠で括ったアクションは、最初にセットアップする。

fastlaneを使ってみた.png

引用元:https://fastlane.tools/

とりあえずインストール

1. Xcode command line toolsを最新にする

 xcode-select --install

2. fastlaneをインストール

 sudo gem install fastlane --verbose

3. fastlaneを使用するアプリのディレクトリへ移動して下記のコマンドを実行

 fastlane init

ここで-bash: fastlane: command not foundが出る場合は下記を参照

image

引用元:https://github.com/fastlane/fastlane/blob/master/docs/Actions.md#update_fastlane

セットアップ

1. ./fastlaneフォルダの作成

[apple@sutou graho]$[dev *]$ fastlane init
[03:35:35]: Detected iOS/Mac project in current directory...
[03:35:35]: This setup will help you get up and running in no time.
[03:35:35]: First, it will move the config files from `deliver` and `snapshot`
[03:35:35]: into the subfolder `fastlane`.
[03:35:35]: fastlane will check what tools you're already using and set up
[03:35:35]: the tool automatically for you. Have fun! 
Do you have everything commited in version control? If not please do so now! (y/n)
y
[03:35:38]: Created new folder './fastlane'.
[03:35:38]: ------------------------------

2. Bundle Identifier と Apple IDを設定

  • Bundle Identifier と Apple IDを入力する
[03:35:38]: To not re-enter your username and app identifier every time you run one of the fastlane tools or fastlane, these will be stored from now on.
App Identifier (com.krausefx.app): xxx.xxxxxxxx.アプリの名前
Your Apple ID (fastlane@krausefx.com): xxxxxx.xxxxxx@xxxxx.xxxx.xx.xx
[03:35:56]: Created new file ‘./fastlane/Appfile'. Edit it to manage your preferred app metadata information.

3. deliverの設定

  • 既にアプリをStoreに公開している場合はyを入力する
Do you want to setup 'deliver', which is used to upload app screenshots, 
app metadata and app updates to the App Store?
 This requires the app to be in the App Store already.
(y/n)
y
[03:35:57]: Loading up 'deliver', this might take a few seconds
[03:35:57]: Login to iTunes Connect (xxxxxxx.xxxxxx@xxxxx.xxxxx.xx.xx)
[03:36:00]: Login successful

+-------------------+-----------------------------------+
|                 deliver 1.5.1 Summary                 |
+-------------------+-----------------------------------+
| username          | xxxxxxxx.xxxxxx@xxxxx.xxxxx.xx.xx |
| app_identifier    | xxx.xxxxxxxxxxx.アプリの名前       |
| metadata_path     | ./fastlane/metadata               |
| screenshots_path  | ./fastlane/screenshots            |
| skip_screenshots  | false                             |
| skip_metadata     | false                             |
| force             | false                             |
| submit_for_review | false                             |
| automatic_release | false                             |
+-------------------+-----------------------------------+

4. snapshotの設定

  • snapshotを使用する場合は、yを入力する
  • Storeに公開されている画像がダウンロードされる
Do you want to setup 'snapshot', which will help you to automatically take screenshots
of your iOS app in all languages/devices? (y/n)
y
[03:36:36]: Loading up 'snapshot', this might take a few seconds
Successfully created SnapshotHelper.swift './fastlane/SnapshotHelper.swift'
Successfully created new Snapfile at './fastlane/Snapfile'
-------------------------------------------------------
Open your Xcode project and make sure to do the following:
1) Add the ./SnapshotHelper.swift to your UI Test target
   You can move the file anywhere you want
2) Call `setLanguage(app)` when launching your app
  let app = XCUIApplication()
  setLanguage(app)
  app.launch()
3) Add `snapshot("0Launch")` to wherever you want to create the screenshots More information on GitHub: https://github.com/krausefx/snapshot

5. sighの設定

  • sighを使用する場合は、yを入力する。
  • これでセットアップは終了し、./fastlane/Fastfileファイルが作成される
Do you want to use 'sigh', 
which will maintain and download the provisioning profile
for your app? (y/n)
y
Optional: The scheme name of your app (If you don't need one, just hit Enter): 
[03:37:21]: 'deliver' enabled.
[03:37:21]: 'snapshot' enabled.
[03:37:21]: 'xctool' not enabled.
[03:37:21]: 'cocoapods' not enabled.
[03:37:21]: 'carthage' not enabled.
[03:37:21]: 'sigh' enabled.
[03:37:21]: Created new file './fastlane/Fastfile'. 
Edit it to manage your own deployment lanes.
[03:37:21]: fastlane will send the number of errors for each action to
[03:37:21]: https://github.com/fastlane/enhancer to detect integration issues
[03:37:21]: No sensitive/private information will be uploaded
[03:37:21]: You can disable this by adding `opt_out_usage` to your Fastfile
[03:37:21]: Successfully finished setting up fastlane

Fastfileをチラ見する

fastlaneを使ってみた.png

試しに test の lane を起動する

 fastlane test

  • デフォルトではsanpshotがlaneに指定されているのでsnapshotの設定が表示される
  • 凄い勢いでターミナルにコマンドが流れ、iOSシュミレーターが次々と立ち上がるのでびっくりする
  • テスト終了後、HTMLで結果のレポートが作成される

まとめ

  • 導入は簡単そうだが、使いこなすには色々と研究がまだ必要
  • Fastfileをのぞくとだいたいの作業はわかる
  • イケてる会社のFastfileとかのぞいてみたい
104
80
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
104
80