runmacos
クラウドの macOS ビルダーでシェルスクリプトを実行し(プロジェクトのソースの有無は問いません)、指定したファイルを持ち帰ります。
runmacos は、チームの環境から、Xcode を備えた macOS ビルダー上で Bash スクリプトを 1 つ実行します。airbuild.yaml は不要です。macOS と Xcode のバージョン確認、swift test の実行、macOS アプリのツールの実行など、サンドボックスだけではできないことに使います。
これは クラウドチーム専用 です。Mac チームでは runmacos is only available in cloud Teams; local Teams provide runtest. と表示されて停止します。
書式
runmacos [<project-id>] [--source <directory>] [--output <relative-path>]... --command '<shell script>' [--environment ID] [--no-cache]
runmacos --follow [--run ID] # reattach; starts nothing
runmacos --cancel [--run ID]
runmacos --list-environments
runmacos --helpオプション
| オプション | 値 | デフォルト | 動作 |
|---|---|---|---|
--command |
シェルスクリプト | 必須 | 実行する Bash スクリプト。アップロードされたルートで -e -o pipefail で実行されます。 |
<project-id> |
UUID | なし | このプロジェクトをアップロードし、そのルートで実行します。 |
--source |
ディレクトリ | なし | 代わりにこのディレクトリをアップロードします。現在のディレクトリからの相対パスです。両方指定した場合は --source がアップロードされます。 |
--output |
相対パス | なし | 持ち帰るファイルまたはディレクトリ。複数指定するには繰り返します。 |
--environment |
--list-environments で得られる ID |
デフォルト | 別のビルダー環境(macOS と Xcode のバージョン)で実行します。 |
--no-cache |
— | キャッシュあり | ビルダーのキャッシュを使わずに実行し、何も保存しません。 |
--follow |
— | — | 実行中の run に、どのモードでも再接続します。終了済みの run ではその旨を伝え、保存済みの出力を再生します。 |
--run |
実行 ID | 実行中のもの、なければ最新のもの | --follow または --cancel と併用。 |
--cancel |
— | — | run に停止を要求し、確認を最大 30 秒待ちます。 |
--list-environments |
— | — | ビルダー環境を一覧表示します。 |
プロジェクト ID も --source もなければ、スクリプトは空のディレクトリで実行され、ソースはアップロードされません。ただし、コマンドとそのヘルパーを含む小さなパッケージは送られます。runmacos は --platform、--sign、--unsigned、--script、--additional-options を受け付けません。
ビルダー上の環境
airbuild-xcodeがPATHにあります。run 内で最初のairbuild-xcode installまたはtestがプロジェクトの DerivedData を復元し、スクリプトの後に run がそれを保存します。archiveと素のxcodebuildには復元されません。airbuild-xcode を参照してください。- ほかのファイルを実行間で保持するための
airbuild-cacheがPATHにあります。スクリプトが復元したものは、終了後に毎回保存し直されます。airbuild-cache を参照してください。 - Node、npm、pnpm がインストールされています。
- 署名用の素材は提供されません。
出力ファイル
各 --output は作業ディレクトリからの具体的な相対パスでなければなりません。絶対パス、..、ワイルドカード、シンボリックリンク、特殊ファイルは使えず、ほかのパスの内側にあるパスも使えません。失敗したスクリプトでも存在する出力は持ち帰られ、スクリプト自身の 0 以外の終了コードで終了します。スクリプトが成功しても宣言された出力がなければ、終了コード 65 で失敗します。
出力
• Build started in the Environment. Run: <run-id>
• It runs to completion even if this command is interrupted (reattach with: runmacos --follow --run <run-id>).
Airbuild remote execution
… the script's output …
✓ Command succeeded in <time>.
✓ Command finished.
Build: <build-id>
Artifact: <path to the collected outputs>--output がない場合は No outputs requested; skipping artifact download. と表示されます。
複数を実行する
runmacos には runbuild、runtest、runlinux とは別の専用スロットがあります。複数の runmacos を同時に実行できます。開始すると実行 ID が表示されます。複数が実行中のときは、--follow と --cancel に --run ID(またはそのうち 1 つだけが使っているプロジェクト ID)が必要です。Ctrl-C は切り離すだけです。
終了コード
| コード | 意味 |
|---|---|
0 |
スクリプトが成功し、すべての出力が書き出されました。 |
1 |
run を開始できなかったか、見失われました。 |
2 |
オプションが誤っているか、--command がありません。何も実行されていません。 |
65 |
宣言された出力がないか、書き出せません。 |
130 |
キャンセルされたか、Ctrl-C で切り離しました。 |
| その他 | スクリプト自身の終了コード。 |
エラー
| メッセージ | 対処 |
|---|---|
--command requires a nonempty shell script and is only available with runmacos and runlinux. |
スクリプトを渡してください。 |
--output requires a working-directory-relative path and is only available with runmacos and runlinux. |
相対パスを指定してください。 |
--platform takes a platform (…) and is only available with runbuild and runtest. |
--platform を外してください。 |
runmacos does not accept build or signing options. |
--sign / --unsigned を外してください。 |
--follow and --cancel cannot submit a command, outputs, or test options. |
follow やキャンセルのときはコマンドを省いてください。 |
Declared output was not produced: <path> |
スクリプトがそれを書き出すようにするか、その --output を外してください。 |
The command failed and its output files could not be downloaded. |
もう一度実行してください。終了コードはスクリプトのものです。 |
N runmacos executions are running; choose one with --run. |
一覧にある実行 ID のいずれかを渡してください。 |
This Team's Environment is already running N runmacos executions, the limit. |
どれかが終わるのを待つか、どれかを follow してください。 |
例
# What the builder has, no source uploaded
runmacos --command 'xcodebuild -version; swift --version'# Run a package's tests in the Project
runmacos 3f6c1a2e-8b4d-4f0a-9c1e-2d7b5a6e9f10 --command 'swift test'# Build a worktree and bring back a report
runmacos --source ../feature-branch --output build/report.txt \
--command 'mkdir -p build && swift build 2>&1 | tee build/report.txt'