task: name: hello macos_instance: # can be a remote or a local virtual machine # image: ghcr.io/cirruslabs/macos-sonoma-base:latest image: sonoma-xcode hello_script: - echo"Hello from within a Tart VM!" - echo"Here is my CPU info:" - sysctl -n machdep.cpu.brand_string - sleep 15
运行该task
将上述 .cirrus.yml 文件放入存储库的根目录中,并使用以下命令运行它:
1 2
brew install cirruslabs/cli/cirrus cirrus run
从 Tart VM 中检索工件
在许多情况下,需要从 Tart 虚拟机中检索特定文件或文件夹。例如,以下 .cirrus.yml 配置定义了一个任务,该任务构建二进制 tart 文件并通过 artifacts 指令公开它:
1 2 3 4 5 6 7
task: name: Build macos_instance: image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest build_script: swift build --product tart binary_artifacts: path: .build/debug/tart
task: name: xcode test macos_instance: # can be a remote or a local virtual machine # image: ghcr.io/cirruslabs/macos-sonoma-base:latest image: sonoma-xcode hello_script: - echo"Hello from within a Tart VM!" - echo"Here is my CPU info:" - sysctl -n machdep.cpu.brand_string build_script: xcodebuild -scheme DemoApp -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2' clean test binary_artifacts: path: .build/debug/tart
GitHub Actions 部分log
1 2 3 4 5 6 7 8 9 10
Run cirrus run 'xcode test' task pull virtual machine clone virtual machine boot virtual machine syncing working directory 'hello' script 'build' script 'binary' artifacts 'xcode test' task succeeded in 03:17!