Introduce Runner Variant (#138)
* Introduce Runner Variant This image will contain multiple version of Xcode to pick with https://github.com/MobileDevOps/xcode-select-version-action This image will updated weekly and will be warm on our runners. * Introduce Runner Variant This image will contain multiple version of Xcode to pick with https://github.com/MobileDevOps/xcode-select-version-action This image will updated weekly and will be warm on our runners. * Don't forget brackets * Update templates/xcode.pkr.hcl Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com> --------- Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
This commit is contained in:
parent
9b2a899ea8
commit
7026060433
24
.cirrus.yml
24
.cirrus.yml
|
|
@ -73,7 +73,7 @@ task:
|
|||
LATEST: true
|
||||
- MACOS_VERSION: ventura
|
||||
XCODE_VERSION: 14.2
|
||||
only_if: $CIRRUS_CRON != ""
|
||||
only_if: $CIRRUS_CRON == "monthly" # Every first Saturday of a month at 14 UTC
|
||||
<<: *defaults
|
||||
pull_base_script:
|
||||
- tart pull ghcr.io/cirruslabs/macos-$MACOS_VERSION-base:latest
|
||||
|
|
@ -91,6 +91,26 @@ task:
|
|||
cleanup_script:
|
||||
- tart delete "$MACOS_VERSION-xcode:$XCODE_VERSION"
|
||||
|
||||
task:
|
||||
name: "Update Runner Image ($MACOS_VERSIONS)"
|
||||
depends_on: update-base
|
||||
env:
|
||||
matrix:
|
||||
- MACOS_VERSION: sonoma
|
||||
XCODE_VERSIONS: 15.1,15.2,15.3
|
||||
only_if: $CIRRUS_TAG != "" || $CIRRUS_CRON == "weekly" # Every Sunday at 14 UTC
|
||||
<<: *defaults
|
||||
pull_base_script:
|
||||
- tart pull ghcr.io/cirruslabs/macos-$MACOS_VERSION-base:latest
|
||||
build_xcode_script:
|
||||
- packer init templates/xcode.pkr.hcl
|
||||
- packer build -var tag=runner -var disk_size=150 -var macos_version="$MACOS_VERSION" -var xcode_version="[$XCODE_VERSIONS]" templates/xcode.pkr.hcl
|
||||
push_script: |
|
||||
tart push "$MACOS_VERSION-xcode:runner" ghcr.io/cirruslabs/macos-$MACOS_VERSION-runner:latest
|
||||
always:
|
||||
cleanup_script:
|
||||
- tart delete "$MACOS_VERSION-xcode:runner"
|
||||
|
||||
task:
|
||||
name: "Release Xcode $CIRRUS_TAG"
|
||||
only_if: $CIRRUS_TAG != ""
|
||||
|
|
@ -99,7 +119,6 @@ task:
|
|||
<<: *defaults
|
||||
pull_base_script:
|
||||
- tart pull ghcr.io/cirruslabs/macos-$MACOS_VERSION-base:latest
|
||||
- tart clone ghcr.io/cirruslabs/macos-$MACOS_VERSION-base:latest $MACOS_VERSION-base
|
||||
build_script:
|
||||
- packer init templates/xcode.pkr.hcl
|
||||
- packer build -var macos_version="$MACOS_VERSION" -var xcode_version="$CIRRUS_TAG" templates/xcode.pkr.hcl
|
||||
|
|
@ -112,5 +131,4 @@ task:
|
|||
fi
|
||||
always:
|
||||
cleanup_script:
|
||||
- tart delete $MACOS_VERSION-base || true
|
||||
- tart delete $MACOS_VERSION-xcode:$CIRRUS_TAG || true
|
||||
|
|
|
|||
|
|
@ -12,7 +12,17 @@ variable "macos_version" {
|
|||
}
|
||||
|
||||
variable "xcode_version" {
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "tag" {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "disk_size" {
|
||||
type = number
|
||||
default = 90
|
||||
}
|
||||
|
||||
variable "android_sdk_tools_version" {
|
||||
|
|
@ -22,10 +32,10 @@ variable "android_sdk_tools_version" {
|
|||
|
||||
source "tart-cli" "tart" {
|
||||
vm_base_name = "ghcr.io/cirruslabs/macos-${var.macos_version}-base:latest"
|
||||
vm_name = "${var.macos_version}-xcode:${var.xcode_version}"
|
||||
vm_name = "${var.macos_version}-xcode:${var.tag != "" ? var.tag : var.xcode_version[-1]}"
|
||||
cpu_count = 4
|
||||
memory_gb = 8
|
||||
disk_size_gb = 90
|
||||
disk_size_gb = var.disk_size
|
||||
headless = true
|
||||
ssh_password = "admin"
|
||||
ssh_username = "admin"
|
||||
|
|
@ -69,21 +79,28 @@ build {
|
|||
]
|
||||
}
|
||||
|
||||
provisioner "file" {
|
||||
source = pathexpand("~/Downloads/Xcode_${var.xcode_version}.xip")
|
||||
destination = "/Users/admin/Downloads/Xcode_${var.xcode_version}.xip"
|
||||
}
|
||||
|
||||
provisioner "shell" {
|
||||
inline = [
|
||||
"source ~/.zprofile",
|
||||
"brew install xcodesorg/made/xcodes",
|
||||
"xcodes version",
|
||||
"xcodes install ${var.xcode_version} --experimental-unxip --path /Users/admin/Downloads/Xcode_${var.xcode_version}.xip --select --empty-trash",
|
||||
"xcodebuild -downloadAllPlatforms",
|
||||
"xcodebuild -runFirstLaunch",
|
||||
]
|
||||
}
|
||||
|
||||
provisioner "file" {
|
||||
sources = [ for version in var.xcode_version : pathexpand("~/Downloads/Xcode_${version}.xip")]
|
||||
destination = "/Users/admin/Downloads/"
|
||||
}
|
||||
|
||||
// iterate over all Xcode versions and install them
|
||||
// select the latest one as the default
|
||||
provisioner "shell" {
|
||||
inline = [
|
||||
for version in var.xcode_version :
|
||||
"source ~/.zprofile && xcodes install ${version} --experimental-unxip --path /Users/admin/Downloads/Xcode_${version}.xip --select --empty-trash && xcodebuild -downloadAllPlatforms && xcodebuild -runFirstLaunc"
|
||||
]
|
||||
}
|
||||
|
||||
provisioner "shell" {
|
||||
inline = [
|
||||
"source ~/.zprofile",
|
||||
|
|
@ -138,4 +155,14 @@ build {
|
|||
"flutter doctor"
|
||||
]
|
||||
}
|
||||
|
||||
// check there is at least 20GB of free space and fail if not
|
||||
provisioner "shell" {
|
||||
inline = [
|
||||
"source ~/.zprofile",
|
||||
"df -h",
|
||||
"export FREE_MB=$(df -m | awk '{print $4}' | head -n 2 | tail -n 1)",
|
||||
"[[ $FREE_MB -gt 20000 ]] && echo OK || exit 1"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue