mirror of
https://github.com/cirruslabs/macos-image-templates.git
synced 2026-09-30 11:51:13 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07be5a66be | ||
|
|
61f4dee507 | ||
|
|
fbcbf4cbfe | ||
|
|
c90679131d | ||
|
|
c9a92d7a31 |
+1
-1
@@ -102,7 +102,7 @@ task:
|
||||
- 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:
|
||||
|
||||
@@ -59,7 +59,7 @@ build {
|
||||
"source ~/.zprofile",
|
||||
"brew --version",
|
||||
"brew update",
|
||||
"brew install curl wget unzip zip ca-certificates 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"
|
||||
|
||||
+33
-8
@@ -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"]
|
||||
|
||||
@@ -101,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" {
|
||||
@@ -147,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",
|
||||
@@ -171,7 +196,7 @@ build {
|
||||
"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"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user