0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

持て余してるM1 Mac miniでIntegration testing

Last updated at Posted at 2020-12-10

事の発端

M1 Mac mini性能いいしビルドめっちゃ早くなるじゃん!!!

ただメモリ少ないし大食いChromeのおかげでスワップ入りまくって快適じゃない...

メイン開発機にはスペック不足だけど置いとくのももったいない...

なんかIntegration testいい感じにアップデートされたっぽいしやってみるか

↓ テスト実行に毎回ビルド必要っぽいしトライアンドエラー時間かかるなぁ ↓ テストだけMac miniで回せばよくない? ← いまここ

(M1である必要性は全くない)

動作概要

結局はrsyncで必要そうなファイルを同期してテスト実行するだけ。

スクリプト書いた sync_and_test.sh
同期元と同期先のディレクトリを指定して、実行するテストを指定する
(テストを実行したいマシン(本記事ではM1 Mac mini)にsshして実行する)

プロジェクト自体はgit clone済みで、よく変更するかもしれないファイルだけを同期する形

Flavorなどを渡したい場合はflutter drive でも--dart-defineが使える

# !/bin/bash -eu

if [ $# -ne 3 ]; then
  echo "e.g. ./sync_and_test.sh from/path to/path target_test_dart" 1>&2
  echo "e.g. ./sync_and_test.sh your-mac.local:~/Develop/projectA/ projectA splash_page_test.dart" 1>&2
  exit 1
fi

rsync -ahv --progress \
--exclude='.DS_Store' \
--include='lib/**' \
--include='assets/**' \
--include='scripts/**' \
--include='test/**' \
--include='integration_test/**' \
--include='test_driver/**' \
--include='pubspec.yaml' \
--include='pubspec.lock' \
--exclude='android' \
--exclude='ios' \
--exclude='build' \
--exclude='*.*' \
$1 $2

APP_NAME=アプリの名前
APP_SUFFIX=.dev
APP_ENV=dev

( \
cd $2 && \
flutter drive \
--dart-define APP_NAME=$APP_NAME \
--dart-define APP_SUFFIX=$APP_SUFFIX \
--dart-define APP_ENV=$APP_ENV \
--driver=test_driver/integration_test_driver.dart \
--target=integration_test/$3 \
)
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?