Compare commits

..
10 Commits
Author SHA1 Message Date
Fedor Korotkov 07be5a66be Update xcode.pkr.hcl 2024-06-10 16:42:24 -04:00
Fedor Korotkov 61f4dee507 Guarantee runner variant to have 100GB free disk space (#159)
Some of the clients require it and hence we use sparsed files it won't be actually 250GB images.
2024-06-05 08:37:35 -04:00
Fedor Korotkov fbcbf4cbfe Align Xcode location with GHA images (#157) 2024-05-17 16:59:24 -04:00
Fedor Korotkov c90679131d Install yq (#156)
fixes #155
2024-05-16 11:21:21 -04:00
Fedor Korotkov c9a92d7a31 Bump runner disk size
Due to all three latest Xcode have different version of simulators
2024-05-14 06:14:33 -04:00
Fedor Korotkov 2793f40e9a Xcode 15.4 (#154)
* Xcode 15.4

* Build runner on a release
2024-05-13 15:18:50 -04:00
Fedor Korotkov 7a7778be0f macOS 14.5 (#153) 2024-05-13 14:47:27 -04:00
Fedor Korotkov 6f7ef84825 Make sure /Users/runner exists in xcode variant (#152)
A follow-up to #145. It seems right now only base variant preserves the symlink. `xcode` and `runner` are missing it and my guess it's due to disk resizing.

This change adds a validation script, so we verify `/Users/runner` folder exists in every variant.
2024-05-13 07:56:29 -04:00
Fedor Korotkov d594e1add0 Install Git Credentials Helper and xcpretty/xcbeauty (#150)
* Install Git Credentials Helper and xcpretty/xcbeauty

Plus move rosetta installation and some other common packages into base variant.

* Fixed Node Path
2024-05-07 15:57:00 -04:00
Fedor Korotkov d50adeeaa2 Use latest Packer plugin (#149) 2024-05-02 13:10:34 -04:00
8 changed files with 78 additions and 26 deletions
+6 -6
View File
@@ -62,12 +62,12 @@ task:
env:
matrix:
- MACOS_VERSION: sonoma
XCODE_VERSION: 15.3
XCODE_VERSION: 15.4
LATEST: true
- MACOS_VERSION: sonoma
XCODE_VERSION: 15.2
XCODE_VERSION: 15.3
- MACOS_VERSION: sonoma
XCODE_VERSION: 15.1
XCODE_VERSION: 15.2
- MACOS_VERSION: ventura
XCODE_VERSION: 14.3.1
LATEST: true
@@ -95,14 +95,14 @@ task:
env:
matrix:
- MACOS_VERSION: sonoma
XCODE_VERSIONS: 15.1,15.2,15.3
only_if: $CIRRUS_CRON == "weekly" # Every Sunday at 14 UTC
XCODE_VERSIONS: 15.2,15.3,15.4
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=130 -var macos_version="$MACOS_VERSION" -var xcode_version="[$XCODE_VERSIONS]" templates/xcode.pkr.hcl
- packer build -var tag=runner -var disk_size=250 -var disk_free_mb=100000 -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-runner:$MACOS_VERSION
always:
+1 -1
View File
@@ -21,5 +21,5 @@ packer build -var macos_version=sonoma templates/base.pkr.hcl
## Building Xcode Image
```bash
packer build -var macos_version=sonoma -var xcode_version=15.3 templates/xcode.pkr.hcl
packer build -var macos_version=sonoma -var xcode_version="[15.4]" templates/xcode.pkr.hcl
```
+1 -1
View File
@@ -24,7 +24,7 @@ monthly on the first Saturday of the month:
* `ghcr.io/cirruslabs/macos-{ventura,sonoma}-base`
* `ghcr.io/cirruslabs/macos-ventura-xcode:{latest,14.3.1,14.2}`
* `ghcr.io/cirruslabs/macos-sonoma-xcode:{latest,15.3,15.2,15.1}`
* `ghcr.io/cirruslabs/macos-sonoma-xcode:{latest,15.4,15.3,15.2}`
Note that `ghcr.io/cirruslabs/macos-runner:sonoma` is updated every Sunday and this image is [optimised for startup](https://cirrus-runners.app/blog/2024/04/11/optimizing-startup-time-of-cirrus-runners/)
on Cirrus Runners and Cirrus CI services.
+14 -2
View File
@@ -1,7 +1,7 @@
packer {
required_plugins {
tart = {
version = ">= 1.2.0"
version = ">= 1.12.0"
source = "github.com/cirruslabs/tart"
}
}
@@ -59,8 +59,10 @@ build {
"source ~/.zprofile",
"brew --version",
"brew update",
"brew install wget cmake gcc git-lfs jq gh gitlab-runner",
"brew install curl wget unzip zip ca-certificates cmake gcc git-lfs jq yq gh gitlab-runner",
"brew install --cask git-credential-manager",
"git lfs install",
"sudo softwareupdate --install-rosetta --agree-to-license"
]
}
@@ -96,6 +98,8 @@ build {
inline = [
"source ~/.zprofile",
"brew install node@20",
"echo 'export PATH=\"/opt/homebrew/opt/node@20/bin:$PATH\"' >> ~/.zprofile",
"source ~/.zprofile",
"node --version",
"npm install --global yarn",
"yarn --version",
@@ -117,4 +121,12 @@ build {
provisioner "shell" {
script = "scripts/automationmodetool.expect"
}
// some other health checks
provisioner "shell" {
inline = [
"source ~/.zprofile",
"test -d /Users/runner"
]
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
packer {
required_plugins {
tart = {
version = ">= 1.2.0"
version = ">= 1.12.0"
source = "github.com/cirruslabs/tart"
}
}
+2 -2
View File
@@ -1,14 +1,14 @@
packer {
required_plugins {
tart = {
version = ">= 1.2.0"
version = ">= 1.12.0"
source = "github.com/cirruslabs/tart"
}
}
}
source "tart-cli" "tart" {
from_ipsw = "https://updates.cdn-apple.com/2024WinterFCS/fullrestores/052-77579/4569734E-120C-4F31-AD08-FC1FF825D059/UniversalMac_14.4.1_23E224_Restore.ipsw"
from_ipsw = "https://updates.cdn-apple.com/2024SpringFCS/fullrestores/062-01897/C874907B-9F82-4109-87EB-6B3C9BF1507D/UniversalMac_14.5_23F79_Restore.ipsw"
vm_name = "sonoma-vanilla"
cpu_count = 4
memory_gb = 8
+1 -1
View File
@@ -1,7 +1,7 @@
packer {
required_plugins {
tart = {
version = ">= 1.2.0"
version = ">= 1.12.0"
source = "github.com/cirruslabs/tart"
}
}
+52 -12
View File
@@ -1,7 +1,7 @@
packer {
required_plugins {
tart = {
version = ">= 1.2.0"
version = ">= 1.12.0"
source = "github.com/cirruslabs/tart"
}
}
@@ -22,7 +22,12 @@ variable "tag" {
variable "disk_size" {
type = number
default = 90
default = 100
}
variable "disk_free_mb" {
type = number
default = 15000
}
variable "android_sdk_tools_version" {
@@ -43,6 +48,26 @@ source "tart-cli" "tart" {
ssh_timeout = "120s"
}
locals {
xcode_install_provisioners = [
for version in var.xcode_version : {
type = "shell"
inline = [
"source ~/.zprofile",
"sudo xcodes install ${version} --experimental-unxip --path /Users/admin/Downloads/Xcode_${version}.xip --select --empty-trash",
// get selected xcode path, strip /Contents/Developer and move to GitHub compatible locations
"INSTALLED_PATH=$(xcodes select -p)",
"CONTENTS_DIR=$(dirname $INSTALLED_PATH)",
"APP_DIR=$(dirname $CONTENTS_DIR)",
"sudo mv $APP_DIR /Applications/Xcode_${version}.app",
"sudo xcode-select -s /Applications/Xcode_${version}.app",
"xcodebuild -downloadAllPlatforms",
"xcodebuild -runFirstLaunch",
]
}
]
}
build {
sources = ["source.tart-cli.tart"]
@@ -52,8 +77,6 @@ build {
"brew --version",
"brew update",
"brew upgrade",
"brew install curl wget unzip zip ca-certificates",
"sudo softwareupdate --install-rosetta --agree-to-license"
]
}
@@ -62,6 +85,13 @@ build {
script = "scripts/install-actions-runner.sh"
}
// make sure our workaround from base is still valid
provisioner "shell" {
inline = [
"sudo ln -s /Users/admin /Users/runner || true"
]
}
provisioner "shell" {
inline = [
"source ~/.zprofile",
@@ -96,11 +126,12 @@ build {
// 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 && sudo xcodes install ${version} --experimental-unxip --path /Users/admin/Downloads/Xcode_${version}.xip --select --empty-trash && xcodebuild -downloadAllPlatforms && xcodebuild -runFirstLaunch"
]
dynamic "provisioner" {
for_each = local.xcode_install_provisioners
labels = ["shell"]
content {
inline = provisioner.value.inline
}
}
provisioner "shell" {
@@ -121,8 +152,10 @@ build {
inline = [
"source ~/.zprofile",
"brew install libimobiledevice ideviceinstaller ios-deploy fastlane carthage",
"brew install xcbeautify",
"gem update",
"gem install cocoapods",
"gem install xcpretty",
"gem uninstall --ignore-dependencies ffi && gem install ffi -- --enable-libffi-alloc"
]
}
@@ -140,7 +173,6 @@ build {
provisioner "shell" {
inline = [
"source ~/.zprofile",
"sudo security delete-certificate -Z FF6797793A3CD798DC5B2ABEF56F73EDC9F83A64 /Library/Keychains/System.keychain",
"curl -o AppleWWDRCAG3.cer https://www.apple.com/certificateauthority/AppleWWDRCAG3.cer",
"curl -o DeveloperIDG2CA.cer https://www.apple.com/certificateauthority/DeveloperIDG2CA.cer",
"curl -o add-certificate.swift https://raw.githubusercontent.com/actions/runner-images/fb3b6fd69957772c1596848e2daaec69eabca1bb/images/macos/provision/configuration/add-certificate.swift",
@@ -158,13 +190,21 @@ build {
]
}
// check there is at least 20GB of free space and fail if not
// check there is at least 15GB 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 15000 ]] && echo OK || exit 1"
"[[ $FREE_MB -gt ${var.disk_free_mb} ]] && echo OK || exit 1"
]
}
// some other health checks
provisioner "shell" {
inline = [
"source ~/.zprofile",
"test -d /Users/runner"
]
}
}