LoginSignup
0
1

More than 3 years have passed since last update.

GitHubActionsにてCookiecutterで作ったiOS向けボイラープレートをCIしてみた

Posted at

はじめに

以前投稿したCookiecutter用のiOS向けのボイラープレート
今後も有効利用すべくGithubActionsで回してみた際の備忘録です。

※GithubActions や Cookiecutter等の説明は省略します

GitHubActionsで設定しているyml

スクリーンショット 2020-10-30 0.17.53.png

前半部分: 実行環境の設定

前半部分でビルドをするための準備を各ステップにて設定しています。

後述のbootstrap.shの中で実行している
carthage bootstrap --platform ios --no-use-binaries
SwinjectStoryboardのみビルドエラーになっていた為
Carhageのキャッシュディレクトリを削除して解決しました。

github/workflows/swift.yml
#前半部分省略

steps:
    - uses: actions/checkout@v2
    - name: Xcode Select
      run: sudo xcode-select -s '/Applications/Xcode_11.3.1.app/Contents/Developer'
    - name: Show version
      run: |
        xcodebuild -version
        pod --version
        carthage version
    - name: Carhtage Cache Clear
      run: |
        rm -rf ~/Library/Cache/carthage
        rm -rf ~/Library/Cache/org.carthage.CarthageKit

後半部分: Cookiecutterを実行してビルド

後半部分でcookiecutterコマンドでプロジェクトを生成した上で
プロジェクトに内包しているbootstrap.shにて
pod installcarthage bootstrapを走らせます。

ちなみに
--no-input --config-file default_config.yml(※デフォルト値のyml)
オプションでcookiecutterコマンドの対話を省略することが可能です。

github/workflows/swift.yml
## 上の続き
    - name: Install
      run: |
        brew install cookiecutter
        cookiecutter https://github.com/SatoshiN303/iOS-Blueprints-CleanArchitecture.git --no-input --config-file /Users/runner/work/iOS-Blueprints-CleanArchitecture/iOS-Blueprints-CleanArchitecture/default_config_for_actions.yml
    - name: Setup and Build
      run: |
        cd ./SampleApp
        ./bootstrap.sh
        xcodebuild build -workspace "SampleApp.xcworkspace" -scheme "SampleApp_Debug" -sdk iphonesimulator

とりあえずcookiecutterで生成したプロジェクトがビルドできるところまでは回せました

Swift

参考にさせて頂きました🙇‍♂️

0
1
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
0
1