はじめに
以前投稿したCookiecutter用のiOS向けのボイラープレートを
今後も有効利用すべくGithubActionsで回してみた際の備忘録です。
※GithubActions や Cookiecutter等の説明は省略します
GitHubActionsで設定しているyml
前半部分: 実行環境の設定
前半部分でビルドをするための準備を各ステップにて設定しています。
後述の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 install
や carthage 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