Compare commits

...
154 Commits
Author SHA1 Message Date
fedor 9a16028831 No additional_runtimes 2024-10-15 14:42:06 -04:00
fedor cd817762c5 Xcode 16.1 Beta 3 2024-10-15 14:40:31 -04:00
fedor 32c59db145 No additional runtimes 2024-10-06 20:44:48 -04:00
fedor 8dcd824d76 Default for additional_runtimes 2024-10-05 20:27:36 -04:00
Fedor Korotkov 200bc65efb Update vanilla-sequoia.pkr.hcl 2024-10-05 20:26:00 -04:00
Nikolay Edigaryev 74aca70ef6 Send Slack alerts on build failures (#189)
* Send Slack alerts on build failures

* Only send Slack notifications for failed cron builds
2024-10-01 14:54:02 -04:00
Fedor Korotkov 1e710b24b9 Pre-install gnupg (#188)
Useful for doing manual encription/decryption
2024-10-01 10:42:25 -04:00
Fedor Korotkov 26c6575d1c Add additional runtimes (#186) 2024-09-26 06:21:40 -04:00
Fedor Korotkov 63e491fbf8 Fixed version 2024-09-24 10:39:24 -04:00
Fedor Korotkov 600cb89e35 Start building Sequoia images (#184)
Only base the runner images. We are not planning to build per Xcode images to reduce amount of variants to support.

Related to #183
2024-09-19 10:45:24 -04:00
fedor dbde34c6a8 Reapply "Sonoma 14.6.1 (#170)" (#179)
This reverts commit 760e04e340.
2024-09-18 17:55:42 -07:00
Fedor Korotkov ef6d97a77e Build more images (#178)
Build Sequoia 15.0 and 15.1 separately since 15.0 is RC and about ot be released and 15.1 is still in beta.

Plus added Xcode 16 RC to the big runner image. But since it's RC put it first in the list so it's not default.
2024-09-10 10:18:11 -04:00
Fedor Korotkov 760e04e340 Revert "Sonoma 14.6.1 (#170)" (#179) 2024-09-10 08:39:26 -04:00
Nikolay Edigaryev b863116992 macOS Sequoia 15.1 beta 3 (#175)
* macOS Sequoia 15.1 beta 3

* No need to disable Voice Over
2024-09-09 14:57:03 +04:00
Isaac Halvorson 444b21aba2 Use Keyboard navigation instead of Voice Over for System Settings navigation (#174)
* Enable Keyboard navigation setting instead of using Voice Over for System Settings

* Only use space bar to get past final setup screen

* Remove unnecessary setdisplaysleep and setcomputersleep usage
2024-09-09 11:58:39 +04:00
fedor 525f51a54e macOS 15 beta 8 2024-08-31 09:44:45 -04:00
fedor 5c7259d9a9 Sequoia 15 Beta 5
And build on Sonoma
2024-08-23 13:00:23 -04:00
Fedor Korotkov 24ff639c4d Update .cirrus.yml
Don't build runner on beta
2024-08-12 16:06:31 -04:00
Fedor Korotkov 0be36e7056 Update .cirrus.yml 2024-08-12 15:31:28 -04:00
Fedor Korotkov ed0b1e4c15 sequoia 15.1 beta 2 2024-08-12 15:30:03 -04:00
Fedor Korotkov 489255bec4 Sonoma 14.6.1 (#170) 2024-08-07 14:12:46 -04:00
fedor 92c70a2e79 Proper Tags 2024-07-30 15:22:35 -04:00
fedor 5de5e0997b Sonoma 14.6 and Sequoia 15.1 2024-07-30 15:21:21 -04:00
Fedor Korotkov 127683c285 Sequoia Beta 3 (#166) 2024-07-11 09:36:31 -04:00
leavesster 98a8ed97a4 Update README.md (#165) 2024-07-05 22:06:22 -04:00
Fedor Korotkov 3d76cfe25e Do not use Sequoia hosts
Fixes https://github.com/cirruslabs/tart/issues/851
2024-07-01 11:31:47 -04:00
Fedor Korotkov 4a45e89e9f Update .cirrus.yml 2024-06-28 15:34:57 -04:00
Fedor Korotkov f887c42ab1 Don't use experimental yet 2024-06-28 15:20:03 -04:00
Fedor Korotkov cabda00d2a Sequoia Beta 2 (#164) 2024-06-24 15:45:08 -04:00
Fedor Korotkov 118270dd45 Use dev-mini-experimental for Sequoia images (#163) 2024-06-24 09:09:43 -04:00
fedor c80a91a5bf Longer SSH timeout 2024-06-17 16:14:12 -04:00
fedor da6beb5b44 Account for an extra screen and long user creation 2024-06-17 15:44:35 -04:00
Fedor Korotkov 7a36c811f9 macOS Sequoia (#161)
* macOS Sequoia

* Sequoia cadence and base/xcode variants
2024-06-17 10:56:57 -04:00
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
Fedor Korotkov 5d1abcb935 Lower the expected free disk size 2024-05-02 09:28:23 -04:00
Fedor Korotkov 8151177d8f Revert "Fixed Simulator Opening" (#148)
This reverts commit e45042edb8.
2024-05-02 09:27:49 -04:00
Fedor Korotkov 2cd59ec2b4 Fixed Simulator Opening (#146) 2024-05-01 15:39:25 +02:00
fedor 2dcf12940d Add Java to path 2024-05-01 08:07:25 -04:00
fedor acd0ec5913 Use OpenJDK 2024-05-01 08:00:09 -04:00
fedor f2d703668c Fixed JDK 2024-05-01 07:55:20 -04:00
fedor 54a41a1e0a Use sudo 2024-05-01 07:51:33 -04:00
Nikolay Edigaryev 57a0eb2d30 /Users/runner → /Users/admin symlink to support certain GitHub Actions (#145) 2024-04-22 11:04:53 -04:00
Fedor Korotkov c73a2a5fe9 Update .cirrus.yml 2024-04-22 05:01:14 -04:00
Fedor Korotkov 989b0d8f1a Updated ReadMe (#144)
Included release and update cadence of the images

Fixes #142
2024-04-18 14:07:51 -04:00
Fedor Korotkov 415bb40956 Install Node.js LTS (#143)
Right now `brew install node` installs the current version 21 of Node.js. Let's make sure we install an LTS version. It's updated not that often so can update it manually.
2024-04-18 21:11:25 +04:00
Fedor Korotkov 9ccac855c3 Update README.md 2024-04-08 12:41:50 -04:00
fedor 31bc126bc4 fixes 2024-04-07 20:10:13 -04:00
Fedor Korotkov 7932133d6f Pass as list 2024-04-07 19:38:13 -04:00
Fedor Korotkov c254792f80 Only two version of Ruby 2024-04-07 14:18:20 -04:00
Fedor Korotkov 00fd234514 Update .cirrus.yml 2024-04-05 15:55:30 -04:00
Fedor Korotkov df763eb2d6 Latest runner 2024-04-05 15:54:59 -04:00
Fedor Korotkov e1755912e6 Preinstall last 3 versions of Ruby (#141) 2024-04-05 10:29:53 -04:00
Fedor Korotkov f1715dca7b Automatically re-run tasks in case of network issues (#140)
* Automatically re-run tasks in case of network issues

* new line
2024-04-01 08:06:20 -04:00
Fedor Korotkov e89c673a33 Change macOS runner image name (#139)
To be consistent with ubuntu ones where tag is the version of OS.
2024-04-01 07:40:57 -04:00
fedor 264c3e8fb0 Fixed typo 2024-03-27 12:16:34 +04:00
fedor 0215733c42 Runner variant tweaks 2024-03-27 11:09:42 +04:00
fedor d3f7a8f37d Sonoma 14.4.1 2024-03-26 13:51:09 +04:00
Fedor KorotkovandNikolay Edigaryev 7026060433 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>
2024-03-25 12:40:18 -04:00
Nikolay Edigaryev 9b2a899ea8 Enable UI automation by default (#137) 2024-03-19 10:32:12 -04:00
fedor 08d9f601e4 Fixed ReadMe examples 2024-03-11 14:02:48 -04:00
anders-nylander 8b0607128f Don't run rbenv'd gem commands with sudo (#135) 2024-03-11 08:36:49 -04:00
Fedor Korotkov bf9f6a6146 Sonoma 14.4 (#133) 2024-03-07 13:54:03 -05:00
Fedor Korotkov d367ab61c8 Fixed Xcode release 2024-03-06 07:55:57 -05:00
Fedor Korotkov f06b997060 Xcode 15.3 2024-03-06 07:53:50 -05:00
Fedor Korotkov 5b625c9167 Delete the right VM 2024-03-02 09:32:15 -05:00
Fedor Korotkov 03e06aff01 Fixed VM name 2024-03-02 08:25:55 -05:00
Fedor Korotkov 7849005130 Pull Vanilla Images (#132)
Don't forget to pull the latest Vanilla version first
2024-02-28 13:04:00 -05:00
Fedor Korotkov c03e2f3253 Concurrent builds (#131) 2024-02-28 11:04:51 -05:00
Fedor Korotkov 882cbe2344 Regularly update multiple tags (#130)
* Regularly update multiple tags

Update the last two version of macOS and the last two versions of Xcode for each of macOS versions.

Fixed #128

* Missing `matrix`
2024-02-27 17:14:29 -05:00
Fedor Korotkov 0cc9b01623 No need to populate /usr/local/bin/ (#129)
Plus we only need `add-certificate` during the build and don't need it in the image
2024-02-26 08:39:54 -05:00
Fedor Korotkov 9940dd3705 Backport language fix to Ventura and Sonoma (#126)
Fixes #125
Related to #107
2024-02-01 09:56:39 -05:00
Fedor Korotkov a1a1fd7d36 14.3 2024-01-25 14:17:35 -05:00
Fedor Korotkov fc41a4d619 Update .cirrus.yml 2024-01-25 12:43:27 -05:00
Fedor Korotkov a80bae15d9 Fixed full disk access (#124)
As the default was changed in Sonoma as reported in #113

Fixes #113
2024-01-24 12:33:37 -05:00
umläute 104e432eb4 parameterize 'xcodes' (#123)
Closes: https://github.com/cirruslabs/macos-image-templates/issues/122
2024-01-24 12:09:28 -05:00
Fedor Korotkov 002717156a Use local Xcode cache (#121) 2024-01-24 15:15:09 +04:00
Fedor Korotkov 13071e71be Just enable remote automation for Safari (#120)
Enabling `Develop` menu started failing in 14.3 with:

```console
Could not write domain /Users/admin/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari; exiting
```

We actually only interested in enabling remote automation for CI which is done by `safaridriver`. Having `Develop` menu item is not necessary.
2024-01-23 14:14:16 -05:00
Fedor Korotkov fb83953b1b macOS 14.3 (#119)
Plus automatically update vanilla images
2024-01-22 13:34:52 -05:00
Nikolay Edigaryev 19ccfde91c Always install the latest GitHub Actions Runner (#117) 2024-01-17 08:56:53 -05:00
Fedor Korotkov 4b3f94df8d Update variables.pkrvars.hcl 2024-01-16 23:04:32 -05:00
Fedor Korotkov 5aa1d63f6a Update variables.pkrvars.hcl 2024-01-16 23:04:01 -05:00
fedor a63fb03f2e Ventura 13.6 2024-01-10 20:04:47 +04:00
Fedor Korotkov 8f93e8eae2 Removed chunking 2023-12-26 07:59:50 -05:00
Nikolay Edigaryev 8b9f6ce141 Tag vanilla image as 14.1 (#111)
Since we currently use UniversalMac_14.1_23B74_Restore.ipsw to build it.
2023-12-22 12:31:18 +04:00
Nikolay Edigaryev a9d8536f46 disable-sip.pkr.hcl: a better way to open Terminal (#110)
Without it, we open the "Share Disk..." menu option instead.

Also there's no more default language choice on Sonoma.
2023-12-21 21:03:02 +04:00
Nikolay Edigaryev 73dea7bcb0 Disable SIP in vanilla images (#109) 2023-12-20 19:14:56 +04:00
Nikolay Edigaryev e5f5edca05 .cirrus.yml: introduce "Update Vanilla Images" task (#108) 2023-12-20 15:11:26 +01:00
Nikolay Edigaryev 21522999bb Don't mistakenly select "English (UK)" language instead of "English" one (#107) 2023-12-19 12:12:17 +04:00
Nikolay Edigaryev 664d47260e Hide useless systemsetup errors and avoid scary Safari kill error (#106) 2023-12-15 11:14:20 +04:00
fedor 67a57c3064 Xcode 15.1 2023-12-12 21:56:50 +01:00
fedor fabd89cead Fixed tag 2023-12-12 21:56:10 +01:00
Fedor Korotkov b19d3fa66c Use alias for ECR pushes 2023-11-27 12:51:22 -05:00
Fedor Korotkov 3f1850ad07 ECR chunked push 2023-11-27 12:50:17 -05:00
Fedor Korotkov 4b7ac1f76f Increased timeout 2023-11-10 13:20:59 -05:00
Fedor Korotkov 98b522dbfa Push images to public ECR (#103)
* Push images to public ECR

Related to https://github.com/cirruslabs/tart/discussions/652

* Use the default alias until we get the custom one
2023-11-10 09:28:47 -05:00
fedor 41b20ab533 Revert "Pin version of activesupport (#101)"
This reverts commit 6555932569.
2023-11-06 11:22:57 -05:00
Fedor Korotkov b28936faa2 Xcode 15.0.1 2023-11-06 11:21:47 -05:00
fedor 3e3e6818f3 Sonoma 14.1 2023-10-25 16:10:45 -04:00
Fedor Korotkov 47695a9abd Runner 2.311.0 2023-10-23 16:30:43 -04:00
Fedor Korotkov 6555932569 Pin version of activesupport (#101)
* Pin version of `activesupport`

Fixes #100 while https://github.com/CocoaPods/CocoaPods/issues/12081 is not released.

* Fixed installation
2023-10-10 07:56:40 -04:00
Fedor Korotkov 4513f2adad GHA Runner 2.310.0 2023-10-09 09:51:05 -04:00
Fedor Korotkov 0a4f436302 Update README.md 2023-10-05 07:03:08 -04:00
Rui Marinho 277b13fb59 macOS 13.5.2 (#97) 2023-09-27 12:34:46 -04:00
Fedor Korotkov 19a8271935 Switch to Sonoma (#98)
Use RC and update all the scripts
2023-09-20 10:59:13 -04:00
fedor ba158f524c Removed quotes from Xcode version 2023-09-04 00:24:18 +02:00
fedor a34d6d3e51 macOS 13.5.1 2023-09-04 00:11:48 +02:00
Fedor Korotkov 59624221fe Update Xcode Image (#94)
During the monthly cron update. Fixes #93
2023-08-14 11:22:36 -04:00
Fedor Korotkov ac0d6efcf5 Update variables.pkrvars.hcl 2023-08-14 09:29:17 -04:00
Fedor Korotkov 4e75d95247 Update variables.pkrvars.hcl 2023-07-25 09:19:13 -04:00
fedor 7fcf10afd6 Build sonoma 2023-07-13 06:46:47 -04:00
fedor 0f7f741d45 Use latest 2023-07-13 06:46:17 -04:00
fedor f0e06a7c5e Bump the GHA runner 2023-07-13 06:46:09 -04:00
Melvin GundlachandMelvin Gundlach 21e5a3eb86 Update vanilla-sonoma to Beta 3 Update (#91)
Co-authored-by: Melvin Gundlach <mgundlach@it-economics.de>
2023-07-12 07:46:12 -04:00
Melvin GundlachandMelvin Gundlach a2d379b619 Update vanilla-sonoma to Beta 3 (#90)
Co-authored-by: Melvin Gundlach <mgundlach@it-economics.de>
2023-07-11 07:50:09 -04:00
Grigory Entin 5d00757016 Disabled screensaver for admin user. (#88) 2023-06-22 18:50:44 +04:00
Fedor Korotkov 04eaf0415f Update vanilla-sonoma 2023-06-21 17:56:27 -04:00
Nikolay Edigaryev fc12391db4 Use host's DNS servers (#87) 2023-06-21 17:04:50 +04:00
fedor 62bb71fc2c Persist add-certificate binary
Fixes #82
2023-06-16 12:34:42 -04:00
Fedor Korotkov 4625de36fc Update .cirrus.yml 2023-06-14 07:51:50 -04:00
fedor 7221de2158 Bump xcode version 2023-06-14 07:28:53 -04:00
fedor 3ac3ec803c Bump Xcode 2023-06-14 07:28:33 -04:00
fedor 620771594e Bump GHA version 2023-06-14 07:27:53 -04:00
fedor a7907e34db Source 2023-06-14 07:27:53 -04:00
Fedor Korotkov 0f02d0a14f Update .cirrus.yml 2023-06-13 17:00:46 -04:00
fedor 7be84bd9d9 Reverted 2023-06-13 07:27:11 -04:00
fedor 8c1d1b889a Support beta tags 2023-06-13 07:26:46 -04:00
fedor 703e5f8e35 Formatted 2023-06-13 07:21:03 -04:00
Szymon Mrozek 94dc6c6d03 Add AWS-CLI and ImageMagick tools (#85)
* Add AWS-CLI and ImageMagick tools

* Apply code review suggestions
2023-06-13 07:20:34 -04:00
fedor 7e5b78ae4c macOS 13.4 as base
Related to #84
2023-06-12 10:27:02 -04:00
Nikolay Edigaryev 42b40752b5 macOS 14 (Sonoma) template (#81)
* macOS 14 (Sonoma) template

* Use publicly available IPSW link in "from_ipsw"
2023-06-08 15:26:06 +04:00
fedor 072558f6ab Bump version 2023-04-27 14:12:57 -04:00
fedor e4af3c70c1 Don't check brew temporary 2023-04-14 09:38:45 +02:00
fedor 55ec020db9 Fixed syntax 2023-04-14 09:20:03 +02:00
fedor a7bdd003d4 Check flutter first 2023-04-14 09:17:42 +02:00
fedor 19ff55570e Install yarn 2023-04-09 18:51:52 -04:00
fedor 4d038de343 Install node through brew 2023-04-09 16:25:45 -04:00
fedor 8faf32710b Install NVM via official script 2023-04-09 14:18:53 -04:00
fedor be1be002c4 Fixed NVM installation 2023-04-08 20:22:11 -04:00
fedor 920aa01e4f Bump Xcode version 2023-04-08 19:45:25 -04:00
fedor b24d5c0ffb Better NVM installation 2023-04-08 19:45:07 -04:00
Fedor Korotkov 1629c949a6 Install Ruby 2.x.x and Node.JS LTS (#79)
* Install Ruby 2.x.x and Node.JS LTS

* Install Yarn as well

* Pre-install graphicsmagick and applesimutils

* Tweak maxfiles

* macOS 13.3.1
2023-04-08 11:25:32 -04:00
Fedor Korotkov 5828bf5b7c Preinstall gitlab-runner 2023-04-04 17:37:28 -04:00
fedor 6ef994bd48 macOS 13.3 2023-03-28 16:44:12 -04:00
Fedor Korotkov 98a1b71d19 Update variables.pkrvars.hcl 2023-03-17 12:05:32 -04:00
Szymon Mrozek e627b0f992 Install Carthage in Xcode template (#77) 2023-02-28 11:55:05 -05:00
15 changed files with 766 additions and 194 deletions
+31
View File
@@ -0,0 +1,31 @@
load("cirrus", "env", "http")
load("github.com/cirrus-modules/graphql", "rerun_task_if_issue_in_logs")
def on_task_failed(ctx):
if ctx.payload.data.task.automaticReRun:
print("Task is already an automatic re-run! Won't even try to re-run it...")
return
rerun_task_if_issue_in_logs(ctx.payload.data.task.id, "The network connection was lost")
def on_build_failed(ctx):
# Only send Slack notifications for failed cron builds[1]
#
# [1]: https://cirrus-ci.org/guide/writing-tasks/#cron-builds
if "Cron" not in ctx.payload.data.build.changeMessageTitle:
return
resp = http.post("https://slack.com/api/chat.postMessage", headers={
"Content-Type": "application/json",
"Authorization": "Bearer " + env.get("SLACK_TOKEN"),
}, json_body={
"channel": "#image-updates",
"text": "Build <https://cirrus-ci.com/build/{build_id}|{build_id} (\"{change_message_title}\")> failed on branch \"{branch_name}\" in repository \"{repository_name}\".".format(build_id=ctx.payload.data.build.id, change_message_title=ctx.payload.data.build.changeMessageTitle, branch_name=ctx.payload.data.build.branch, repository_name=ctx.payload.data.repository.name),
})
if resp.status_code != 200:
fail("failed to post message to Slack: got unexpected HTTP {}".format(resp.status_code))
resp_json = resp.json()
if resp_json["ok"] != True:
fail("got error when posting message to Slack: {}".format(resp_json["error"]))
+154 -38
View File
@@ -1,47 +1,163 @@
task:
name: "Update Base Image"
only_if: $CIRRUS_CRON != ""
persistent_worker:
labels:
name: dev-mini
env:
TART_REGISTRY_USERNAME: fkorotkov # GitHub supports only PATs
TART_REGISTRY_PASSWORD: ENCRYPTED[!82ed873afdf627284305afef4958c85a8f73127b09978a9786ac521559630ea6c9a5ab6e7f8315abf9ead09b6eff6eae!]
update_script: brew update && brew upgrade
persistent_worker:
labels:
name: dev-mini
resources:
tart-vms: 1
env:
TART_REGISTRY_HOSTNAME: ghcr.io
TART_REGISTRY_USERNAME: fkorotkov # GitHub supports only PATs
TART_REGISTRY_PASSWORD: ENCRYPTED[!82ed873afdf627284305afef4958c85a8f73127b09978a9786ac521559630ea6c9a5ab6e7f8315abf9ead09b6eff6eae!]
AWS_ACCESS_KEY_ID: ENCRYPTED[c187b670a17eead88c1698849376273991d09678efe37ae2f0c9738c27a2422741a71c501ef4b6a4df7bff3eca5213a9]
AWS_SECRET_ACCESS_KEY: ENCRYPTED[e456254a53b82e3167f2da23e24c389620cb3f7d47e4e5e7d993813bf9bb18c784d5cb8d88d19632073acc9e1f6096c9]
defaults: &defaults
timeout_in: 3h
update_script:
- brew update || true
- brew upgrade || true
info_script:
- tart --version
- packer --version
build_script:
- packer init templates/base.pkr.hcl
- packer build -var-file="variables.pkrvars.hcl" templates/base.pkr.hcl
push_script:
- tart push ventura-base ghcr.io/cirruslabs/macos-ventura-base:latest
always:
cleanup_script:
- tart delete ventura-base
task:
name: "Release Xcode $CIRRUS_TAG"
only_if: $CIRRUS_TAG != ""
persistent_worker:
labels:
name: dev-mini
env:
TART_REGISTRY_USERNAME: fkorotkov # GitHub supports only PATs
TART_REGISTRY_PASSWORD: ENCRYPTED[!82ed873afdf627284305afef4958c85a8f73127b09978a9786ac521559630ea6c9a5ab6e7f8315abf9ead09b6eff6eae!]
update_script: brew update && brew upgrade
info_script:
- tart --version
- packer --version
pull_base_script:
- tart pull ghcr.io/cirruslabs/macos-ventura-base:latest
- tart clone ghcr.io/cirruslabs/macos-ventura-base:latest ventura-base
name: "Update Vanilla Sonoma Image"
only_if: $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH && changesInclude("templates/vanilla-sonoma.pkr.hcl")
<<: *defaults
build_script:
- packer init templates/xcode.pkr.hcl
- packer build -var-file="variables.pkrvars.hcl" -var xcode_version="$CIRRUS_TAG" templates/xcode.pkr.hcl
- packer init templates/vanilla-sonoma.pkr.hcl
- packer build templates/vanilla-sonoma.pkr.hcl
disable_sip_script:
- packer build -var vm_name=sonoma-vanilla templates/disable-sip.pkr.hcl
push_script:
- tart push ventura-xcode:$CIRRUS_TAG ghcr.io/cirruslabs/macos-ventura-xcode:$CIRRUS_TAG ghcr.io/cirruslabs/macos-ventura-xcode:latest
- tart push sonoma-vanilla ghcr.io/cirruslabs/macos-sonoma-vanilla:latest ghcr.io/cirruslabs/macos-sonoma-vanilla:14.6.1
always:
cleanup_script:
- tart delete ventura-base || true
- tart delete ventura-xcode:$CIRRUS_TAG || true
- tart delete sonoma-vanilla
task:
name: "Update Vanilla Sequoia Image"
only_if: $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH && changesInclude("templates/vanilla-sequoia.pkr.hcl")
<<: *defaults
build_script:
- packer init templates/vanilla-sequoia.pkr.hcl
- packer build templates/vanilla-sequoia.pkr.hcl
disable_sip_script:
- packer build -var vm_name=sequoia-vanilla templates/disable-sip.pkr.hcl
push_script:
- tart push sequoia-vanilla ghcr.io/cirruslabs/macos-sequoia-vanilla:latest ghcr.io/cirruslabs/macos-sequoia-vanilla:15.0-rc
always:
cleanup_script:
- tart delete sequoia-vanilla
task:
name: "Update Vanilla Sequoia Beta Image"
only_if: $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH && changesInclude("templates/vanilla-sequoia-beta.pkr.hcl")
<<: *defaults
build_script:
- packer init templates/vanilla-sequoia-beta.pkr.hcl
- packer build templates/vanilla-sequoia-beta.pkr.hcl
disable_sip_script:
- packer build -var vm_name=sequoia-vanilla templates/disable-sip.pkr.hcl
push_script:
- tart push sequoia-vanilla ghcr.io/cirruslabs/macos-sequoia-vanilla:15.1-beta-3
always:
cleanup_script:
- tart delete sequoia-vanilla
task:
name: "Update Base Images ($MACOS_VERSION)"
alias: update-base
matrix:
- env:
MACOS_VERSION: sonoma
- env:
MACOS_VERSION: sequoia
only_if: $CIRRUS_CRON == "monthly"
<<: *defaults
pull_vanilla_script:
- tart pull ghcr.io/cirruslabs/macos-$MACOS_VERSION-vanilla:latest
build_base_script:
- packer init templates/base.pkr.hcl
- packer build -var macos_version="$MACOS_VERSION" templates/base.pkr.hcl
push_base_script:
- tart push $MACOS_VERSION-base ghcr.io/cirruslabs/macos-$MACOS_VERSION-base:latest
always:
cleanup_script:
- tart delete $MACOS_VERSION-base
task:
name: "Update Xcode Images ($MACOS_VERSION $XCODE_VERSION)"
depends_on: update-base
only_if: $CIRRUS_CRON == "monthly" # Every first Saturday of a month at 14 UTC
env:
matrix:
- MACOS_VERSION: sonoma
XCODE_VERSION: 16
LATEST: true
- MACOS_VERSION: sonoma
XCODE_VERSION: 15.4
- MACOS_VERSION: sonoma
XCODE_VERSION: 15.3
- MACOS_VERSION: sonoma
XCODE_VERSION: 15.2
<<: *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 macos_version="$MACOS_VERSION" -var xcode_version="[\"$XCODE_VERSION\"]" templates/xcode.pkr.hcl
push_script: |
if [[ -z "$LATEST" ]]
then
tart push "$MACOS_VERSION-xcode:$XCODE_VERSION" ghcr.io/cirruslabs/macos-$MACOS_VERSION-xcode:$XCODE_VERSION
else
tart push "$MACOS_VERSION-xcode:$XCODE_VERSION" ghcr.io/cirruslabs/macos-$MACOS_VERSION-xcode:$XCODE_VERSION ghcr.io/cirruslabs/macos-$MACOS_VERSION-xcode:latest
fi
always:
cleanup_script:
- tart delete "$MACOS_VERSION-xcode:$XCODE_VERSION"
task:
name: "Update Runner Image ($MACOS_VERSION)"
env:
matrix:
- MACOS_VERSION: sonoma
XCODE_VERSIONS: 15.2,15.3,15.4,16
- MACOS_VERSION: sequoia
XCODE_VERSIONS: "\"16.1-beta-3\",15.4,16"
only_if: $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=300 -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:
cleanup_script:
- tart delete "$MACOS_VERSION-xcode:runner"
task:
name: "Release Xcode $CIRRUS_TAG ($MACOS_VERSION)"
only_if: $CIRRUS_TAG != ""
matrix:
- env:
MACOS_VERSION: sonoma
<<: *defaults
pull_base_script:
- tart pull ghcr.io/cirruslabs/macos-$MACOS_VERSION-base:latest
build_script:
- packer init templates/xcode.pkr.hcl
- packer build -var macos_version="$MACOS_VERSION" -var xcode_version="[\"$CIRRUS_TAG\"]" templates/xcode.pkr.hcl
push_script: |
if [[ $CIRRUS_TAG == *"beta"* ]]
then
tart push $MACOS_VERSION-xcode:$CIRRUS_TAG ghcr.io/cirruslabs/macos-$MACOS_VERSION-xcode:$CIRRUS_TAG
else
tart push $MACOS_VERSION-xcode:$CIRRUS_TAG ghcr.io/cirruslabs/macos-$MACOS_VERSION-xcode:$CIRRUS_TAG ghcr.io/cirruslabs/macos-$MACOS_VERSION-xcode:latest
fi
always:
cleanup_script:
- tart delete $MACOS_VERSION-xcode:$CIRRUS_TAG || true
+25
View File
@@ -0,0 +1,25 @@
## Building Vanilla Image
To build `macos-sonoma-vanilla`:
```bash
packer build templates/vanilla-sonoma.pkr.hcl
```
Optionally, SIP can be disabled for each image by running the following commands:
```bash
packer build -var vm_name=sonoma-vanilla templates/disable-sip.pkr.hcl
```
## Building Base Image
```bash
packer build -var macos_version=sonoma templates/base.pkr.hcl
```
## Building Xcode Image
```bash
packer build -var macos_version=sonoma -var xcode_version="[15.4]" templates/xcode.pkr.hcl
```
+20 -35
View File
@@ -1,45 +1,30 @@
## macOS Packer Templates for Cirrus CI
## macOS Packer Templates for Tart
Repository with Packer templates to build [Tart VMs](https://github.com/cirruslabs/tart) to use with [Cirrus CI](https://cirrus-ci.org/guide/macOS/).
Repository with Packer templates to build macOS [Tart](https://tart.run/) virtual machines to use with [Cirrus Runners](https://cirrus-runners.app/),
[Cirrus CI](https://cirrus-ci.org/guide/macOS/) or [any other automation](https://tart.run/integrations/cirrus-cli/).
* `macos-{monterey,ventura}-vanilla` image has nothing pre-installed
* `macos-{monterey,ventura}-base` image has only `brew` pre-installed
* `macos-{monterey,ventura}-xcode:N` image is based on `macos-{monterey,ventura}-base` image and has `Xcode N` with [`Flutter`](https://flutter.dev/) pre-installed
The following image variants are currently available:
See a full list of VMs available on Cirrus CI [here](https://github.com/orgs/cirruslabs/packages?tab=packages&q=macos-).
* `macos-{sequoia,sonoma}-base` image has only `brew` pre-installed and the latest version of `macOS` available
* `macos-{sequoia,sonoma}-xcode:N` image is based on `macos-{sequoia,sonoma}-base` image and has `Xcode N` with [`Flutter`](https://flutter.dev/) pre-installed
* `macos-runner:sonoma` image is a variant of `xcode:N` with 3 latest versions of `Xcode` pre-installed and [`xcodes` tool](https://github.com/XcodesOrg/xcodes) to switch between them.
## Building Vanilla Image
See a full list of VMs available [here](https://github.com/orgs/cirruslabs/packages?tab=packages&q=macos-).
To build `macos-monterey-vanilla`:
## Release Cadence
```bash
packer build templates/vanilla-monterey.pkr.hcl
```
Once a new version of Xcode is released, we will initiate a GitHub release which will automatically build and push
a new version of the `macos-{sequoia,sonoma}-xcode:N` image as well as `macos-runner:sonoma`. This generally happens within 24 hours
of a release. Please watch this repository releases to get notified about new images.
To build `macos-ventura-vanilla`:
## Update Cadence
```bash
packer build templates/vanilla-ventura.pkr.hcl
```
Some of the images are regularly getting rebuild in order to update the pre-installed packages. The following images are updated
monthly on the first Saturday of the month:
Optionally, SIP can be disabled for each image by running the following commands:
* `ghcr.io/cirruslabs/macos-{sequoia,sonoma}-base`
* `ghcr.io/cirruslabs/macos-sonoma-xcode:{16-beta,latest,15.4,15.3,15.2}`
* `ghcr.io/cirruslabs/macos-sequoia-xcode:{16-beta}`
```bash
packer build -var vm_name=monterey-vanilla templates/disable-sip.pkr.hcl
```
```bash
packer build -var vm_name=ventura-vanilla templates/disable-sip.pkr.hcl
```
## Building Base Image
```bash
packer build -var-file="variables.pkrvars.hcl" templates/base.pkr.hcl
```
## Building Xcode Image
```bash
packer build -var-file="variables.pkrvars.hcl" templates/xcode.pkr.hcl
```
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.
+21
View File
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>limit.maxfiles</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
<string>maxfiles</string>
<string>65536</string>
<string>524288</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/expect -f
spawn automationmodetool enable-automationmode-without-authentication
expect "Enter the password for user 'admin':"
send "admin\n"
expect "Setting up machine to allow Automation Mode without requiring user authentication... succeeded."
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
# Set shell options to enable fail-fast behavior
#
# * -e: fail the script when an error occurs or command fails
# * -u: fail the script when attempting to reference unset parameters
# * -o pipefail: by default an exit status of a pipeline is that of its
# last command, this fails the pipe early if an error in
# any of its commands occurs
#
set -euo pipefail
source ~/.zprofile
brew install jq
DOWNLOAD_URL=$(curl -sS 'https://api.github.com/repos/actions/runner/releases/latest' | jq --raw-output '.assets[] | select(.name | test("actions-runner-osx-arm64-[0-9.]+.tar.gz")) | .browser_download_url')
rm -rf actions-runner && mkdir actions-runner && cd actions-runner
wget -O - "${DOWNLOAD_URL}" | tar xz
+68 -29
View File
@@ -1,22 +1,18 @@
packer {
required_plugins {
tart = {
version = ">= 0.5.4"
version = ">= 1.12.0"
source = "github.com/cirruslabs/tart"
}
}
}
variable "macos_version" {
type = string
}
variable "gha_version" {
type = string
type = string
}
source "tart-cli" "tart" {
vm_base_name = "ghcr.io/cirruslabs/macos-${var.macos_version}-vanilla:13.2.1"
vm_base_name = "ghcr.io/cirruslabs/macos-${var.macos_version}-vanilla:latest"
vm_name = "${var.macos_version}-base"
cpu_count = 4
memory_gb = 8
@@ -29,17 +25,19 @@ source "tart-cli" "tart" {
build {
sources = ["source.tart-cli.tart"]
provisioner "shell" {
inline = [
"echo 'Disabling spotlight...'",
"sudo mdutil -a -i off",
]
provisioner "file" {
source = "data/limit.maxfiles.plist"
destination = "~/limit.maxfiles.plist"
}
# setup DNS
provisioner "shell" {
inline = [
"networksetup -setdnsservers Ethernet 8.8.8.8 8.8.4.4 1.1.1.1",
"echo 'Configuring maxfiles...'",
"sudo mv ~/limit.maxfiles.plist /Library/LaunchDaemons/limit.maxfiles.plist",
"sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist",
"sudo chmod 0644 /Library/LaunchDaemons/limit.maxfiles.plist",
"echo 'Disabling spotlight...'",
"sudo mdutil -a -i off",
]
}
@@ -51,15 +49,6 @@ build {
]
}
provisioner "shell" {
inline = [
"cd $HOME",
"mkdir actions-runner && cd actions-runner",
"curl -O -L https://github.com/actions/runner/releases/download/v${var.gha_version}/actions-runner-osx-arm64-${var.gha_version}.tar.gz",
"tar xzf ./actions-runner-osx-arm64-${var.gha_version}.tar.gz",
"rm actions-runner-osx-arm64-${var.gha_version}.tar.gz",
]
}
provisioner "shell" {
inline = [
"/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"",
@@ -70,19 +59,50 @@ build {
"source ~/.zprofile",
"brew --version",
"brew update",
"brew install wget cmake gcc git-lfs jq gh",
"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"
]
}
// Install the GitHub Actions runner
provisioner "shell" {
script = "scripts/install-actions-runner.sh"
}
// Create a /Users/runner → /Users/admin symlink to support certain GitHub Actions
// like ruby/setup-ruby that hard-code the "/Users/runner/hostedtoolcache" path[1]
//
// [1]: https://github.com/ruby/setup-ruby/blob/6bd3d993c602f6b675728ebaecb2b569ff86e99b/common.js#L268
provisioner "shell" {
inline = [
"sudo ln -s /Users/admin /Users/runner"
]
}
provisioner "shell" {
inline = [
"source ~/.zprofile",
"brew install libyaml", # https://github.com/rbenv/ruby-build/discussions/2118
"brew install rbenv",
"echo 'if which rbenv > /dev/null; then eval \"$(rbenv init -)\"; fi' >> ~/.zprofile",
"source ~/.zprofile",
"rbenv install 2.7.8", // latest 2.x.x before EOL
"rbenv install -l | grep -v - | tail -2 | xargs -L1 rbenv install",
"rbenv global $(rbenv install -l | grep -v - | tail -1)",
"gem install bundler",
]
}
provisioner "shell" {
inline = [
"source ~/.zprofile",
"brew install rbenv",
"echo 'if which rbenv > /dev/null; then eval \"$(rbenv init -)\"; fi' >> ~/.zprofile",
"brew install node@20",
"echo 'export PATH=\"/opt/homebrew/opt/node@20/bin:$PATH\"' >> ~/.zprofile",
"source ~/.zprofile",
"rbenv install 3.0.5",
"rbenv global 3.0.5",
"gem install bundler",
"node --version",
"npm install --global yarn",
"yarn --version",
]
}
provisioner "shell" {
@@ -90,4 +110,23 @@ build {
"sudo safaridriver --enable",
]
}
provisioner "shell" {
inline = [
"source ~/.zprofile",
"brew install awscli"
]
}
# Enable UI automation, see https://github.com/cirruslabs/macos-image-templates/issues/136
provisioner "shell" {
script = "scripts/automationmodetool.expect"
}
// some other health checks
provisioner "shell" {
inline = [
"source ~/.zprofile",
"test -d /Users/runner"
]
}
}
+2 -5
View File
@@ -1,7 +1,7 @@
packer {
required_plugins {
tart = {
version = ">= 0.5.4"
version = ">= 1.12.0"
source = "github.com/cirruslabs/tart"
}
}
@@ -22,11 +22,8 @@ source "tart-cli" "tart" {
# Skip over "Macintosh" and select "Options"
# to boot into macOS Recovery
"<wait60s><right><right><enter>",
# Select default language
"<wait10s><enter>",
# Open Terminal
"<wait10s><leftCtrlOn><f2><leftCtrlOff>",
"<right><right><right><right><down><down><down><enter>",
"<wait10s><leftAltOn>T<leftAltOff>",
# Disable SIP
"<wait10s>csrutil disable<enter>",
"<wait10s>y<enter>",
+121
View File
@@ -0,0 +1,121 @@
packer {
required_plugins {
tart = {
version = ">= 1.12.0"
source = "github.com/cirruslabs/tart"
}
}
}
source "tart-cli" "tart" {
from_ipsw = "https://updates.cdn-apple.com/2024SummerSeed/fullrestores/062-74506/D50AC8F9-4795-4711-9C1A-907B6EB829A2/UniversalMac_15.1_24B5035e_Restore.ipsw"
vm_name = "sequoia-vanilla"
cpu_count = 4
memory_gb = 8
disk_size_gb = 40
ssh_password = "admin"
ssh_username = "admin"
ssh_timeout = "300s"
boot_command = [
# hello, hola, bonjour, etc.
"<wait60s><spacebar>",
# Language: most of the times we have a list of "English"[1], "English (UK)", etc. with
# "English" language already selected. If we type "english", it'll cause us to switch
# to the "English (UK)", which is not what we want. To solve this, we switch to some other
# language first, e.g. "Italiano" and then switch back to "English". We'll then jump to the
# first entry in a list of "english"-prefixed items, which will be "English".
#
# [1]: should be named "English (US)", but oh well 🤷
"<wait30s>italiano<esc>english<enter>",
# Select Your Country and Region
"<wait30s>united states<leftShiftOn><tab><leftShiftOff><spacebar>",
# Written and Spoken Languages
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>",
# Accessibility
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>",
# Data & Privacy
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>",
# Migration Assistant
"<wait10s><tab><tab><tab><spacebar>",
# Sign In with Your Apple ID
"<wait10s><leftShiftOn><tab><leftShiftOff><leftShiftOn><tab><leftShiftOff><spacebar>",
# Are you sure you want to skip signing in with an Apple ID?
"<wait10s><tab><spacebar>",
# Terms and Conditions
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>",
# I have read and agree to the macOS Software License Agreement
"<wait10s><tab><spacebar>",
# Create a Computer Account
"<wait10s>admin<tab><tab>admin<tab>admin<tab><tab><tab><spacebar>",
# Enable Location Services
"<wait120s><leftShiftOn><tab><leftShiftOff><spacebar>",
# Are you sure you don't want to use Location Services?
"<wait10s><tab><spacebar>",
# Select Your Time Zone
"<wait10s><tab>UTC<enter><leftShiftOn><tab><leftShiftOff><spacebar>",
# Analytics
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>",
# Screen Time
"<wait10s><tab><spacebar>",
# Siri
"<wait10s><tab><spacebar><leftShiftOn><tab><leftShiftOff><spacebar>",
# Choose Your Look
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>",
# Welcome to Mac
"<wait10s><spacebar>",
# Enable Keyboard navigation
# This is so that we can navigate the System Settings app using the keyboard
"<wait10s><leftAltOn><spacebar><leftAltOff>Terminal<enter>",
"<wait10s>defaults write NSGlobalDomain AppleKeyboardUIMode -int 3<enter>",
"<wait10s><leftAltOn>q<leftAltOff>",
# Now that the installation is done, open "System Settings"
"<wait10s><leftAltOn><spacebar><leftAltOff>System Settings<enter>",
# Navigate to "Sharing"
"<wait10s><leftAltOn>f<leftAltOff>sharing<enter>",
# Navigate to "Screen Sharing" and enable it
"<wait10s><tab><tab><tab><tab><tab><spacebar>",
# Navigate to "Remote Login" and enable it
"<wait10s><tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><spacebar>",
# Quit System Settings
"<wait10s><leftAltOn>q<leftAltOff>",
]
// A (hopefully) temporary workaround for Virtualization.Framework's
// installation process not fully finishing in a timely manner
create_grace_time = "30s"
}
build {
sources = ["source.tart-cli.tart"]
provisioner "shell" {
inline = [
// Enable passwordless sudo
"echo admin | sudo -S sh -c \"mkdir -p /etc/sudoers.d/; echo 'admin ALL=(ALL) NOPASSWD: ALL' | EDITOR=tee visudo /etc/sudoers.d/admin-nopasswd\"",
// Enable auto-login
//
// See https://github.com/xfreebird/kcpassword for details.
"echo '00000000: 1ced 3f4a bcbc ba2c caca 4e82' | sudo xxd -r - /etc/kcpassword",
"sudo defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser admin",
// Disable screensaver at login screen
"sudo defaults write /Library/Preferences/com.apple.screensaver loginWindowIdleTime 0",
// Disable screensaver for admin user
"defaults -currentHost write com.apple.screensaver idleTime 0",
// Prevent the VM from sleeping
"sudo systemsetup -setsleep Off 2>/dev/null",
// Launch Safari to populate the defaults
"/Applications/Safari.app/Contents/MacOS/Safari &",
"SAFARI_PID=$!",
"disown",
"sleep 30",
"kill -9 $SAFARI_PID",
// Enable Safari's remote automation
"sudo safaridriver --enable",
// Disable screen lock
//
// Note that this only works if the user is logged-in,
// i.e. not on login screen.
"sysadminctl -screenLock off -password admin",
]
}
}
+121
View File
@@ -0,0 +1,121 @@
packer {
required_plugins {
tart = {
version = ">= 1.12.0"
source = "github.com/cirruslabs/tart"
}
}
}
source "tart-cli" "tart" {
from_ipsw = "https://updates.cdn-apple.com/2024FallFCS/fullrestores/072-01423/566E5B4E-1100-4643-91B3-131247351844/UniversalMac_15.0.1_24A348_Restore.ipsw"
vm_name = "sequoia-vanilla"
cpu_count = 4
memory_gb = 8
disk_size_gb = 40
ssh_password = "admin"
ssh_username = "admin"
ssh_timeout = "300s"
boot_command = [
# hello, hola, bonjour, etc.
"<wait60s><spacebar>",
# Language: most of the times we have a list of "English"[1], "English (UK)", etc. with
# "English" language already selected. If we type "english", it'll cause us to switch
# to the "English (UK)", which is not what we want. To solve this, we switch to some other
# language first, e.g. "Italiano" and then switch back to "English". We'll then jump to the
# first entry in a list of "english"-prefixed items, which will be "English".
#
# [1]: should be named "English (US)", but oh well 🤷
"<wait30s>italiano<esc>english<enter>",
# Select Your Country and Region
"<wait30s>united states<leftShiftOn><tab><leftShiftOff><spacebar>",
# Written and Spoken Languages
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>",
# Accessibility
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>",
# Data & Privacy
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>",
# Migration Assistant
"<wait10s><tab><tab><tab><spacebar>",
# Sign In with Your Apple ID
"<wait10s><leftShiftOn><tab><leftShiftOff><leftShiftOn><tab><leftShiftOff><spacebar>",
# Are you sure you want to skip signing in with an Apple ID?
"<wait10s><tab><spacebar>",
# Terms and Conditions
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>",
# I have read and agree to the macOS Software License Agreement
"<wait10s><tab><spacebar>",
# Create a Computer Account
"<wait10s>admin<tab><tab>admin<tab>admin<tab><tab><tab><spacebar>",
# Enable Location Services
"<wait120s><leftShiftOn><tab><leftShiftOff><spacebar>",
# Are you sure you don't want to use Location Services?
"<wait10s><tab><spacebar>",
# Select Your Time Zone
"<wait10s><tab>UTC<enter><leftShiftOn><tab><leftShiftOff><spacebar>",
# Analytics
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>",
# Screen Time
"<wait10s><tab><spacebar>",
# Siri
"<wait10s><tab><spacebar><leftShiftOn><tab><leftShiftOff><spacebar>",
# Choose Your Look
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>",
# Welcome to Mac
"<wait10s><spacebar>",
# Enable Keyboard navigation
# This is so that we can navigate the System Settings app using the keyboard
"<wait10s><leftAltOn><spacebar><leftAltOff>Terminal<enter>",
"<wait10s>defaults write NSGlobalDomain AppleKeyboardUIMode -int 3<enter>",
"<wait10s><leftAltOn>q<leftAltOff>",
# Now that the installation is done, open "System Settings"
"<wait10s><leftAltOn><spacebar><leftAltOff>System Settings<enter>",
# Navigate to "Sharing"
"<wait10s><leftAltOn>f<leftAltOff>sharing<enter>",
# Navigate to "Screen Sharing" and enable it
"<wait10s><tab><tab><tab><tab><tab><spacebar>",
# Navigate to "Remote Login" and enable it
"<wait10s><tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><spacebar>",
# Quit System Settings
"<wait10s><leftAltOn>q<leftAltOff>",
]
// A (hopefully) temporary workaround for Virtualization.Framework's
// installation process not fully finishing in a timely manner
create_grace_time = "30s"
}
build {
sources = ["source.tart-cli.tart"]
provisioner "shell" {
inline = [
// Enable passwordless sudo
"echo admin | sudo -S sh -c \"mkdir -p /etc/sudoers.d/; echo 'admin ALL=(ALL) NOPASSWD: ALL' | EDITOR=tee visudo /etc/sudoers.d/admin-nopasswd\"",
// Enable auto-login
//
// See https://github.com/xfreebird/kcpassword for details.
"echo '00000000: 1ced 3f4a bcbc ba2c caca 4e82' | sudo xxd -r - /etc/kcpassword",
"sudo defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser admin",
// Disable screensaver at login screen
"sudo defaults write /Library/Preferences/com.apple.screensaver loginWindowIdleTime 0",
// Disable screensaver for admin user
"defaults -currentHost write com.apple.screensaver idleTime 0",
// Prevent the VM from sleeping
"sudo systemsetup -setsleep Off 2>/dev/null",
// Launch Safari to populate the defaults
"/Applications/Safari.app/Contents/MacOS/Safari &",
"SAFARI_PID=$!",
"disown",
"sleep 30",
"kill -9 $SAFARI_PID",
// Enable Safari's remote automation
"sudo safaridriver --enable",
// Disable screen lock
//
// Note that this only works if the user is logged-in,
// i.e. not on login screen.
"sysadminctl -screenLock off -password admin",
]
}
}
@@ -1,17 +1,15 @@
packer {
required_plugins {
tart = {
version = ">= 0.5.4"
version = ">= 1.12.0"
source = "github.com/cirruslabs/tart"
}
}
}
source "tart-cli" "tart" {
# You can find macOS IPSW URLs on various websites like https://ipsw.me/
# and https://www.theiphonewiki.com/wiki/Beta_Firmware/Mac/13.x
from_ipsw = "https://updates.cdn-apple.com/2022FallFCS/fullrestores/012-40537/0EC7C669-13E9-49FB-BD64-9EECC1D174B2/UniversalMac_12.6_21G115_Restore.ipsw"
vm_name = "monterey-vanilla"
from_ipsw = "https://updates.cdn-apple.com/2024SummerFCS/fullrestores/062-52859/932E0A8F-6644-4759-82DA-F8FA8DEA806A/UniversalMac_14.6.1_23G93_Restore.ipsw"
vm_name = "sonoma-vanilla"
cpu_count = 4
memory_gb = 8
disk_size_gb = 40
@@ -21,8 +19,14 @@ source "tart-cli" "tart" {
boot_command = [
# hello, hola, bonjour, etc.
"<wait60s><spacebar>",
# Language
"<wait30s><enter>",
# Language: most of the times we have a list of "English"[1], "English (UK)", etc. with
# "English" language already selected. If we type "english", it'll cause us to switch
# to the "English (UK)", which is not what we want. To solve this, we switch to some other
# language first, e.g. "Italiano" and then switch back to "English". We'll then jump to the
# first entry in a list of "english"-prefixed items, which will be "English".
#
# [1]: should be named "English (US)", but oh well 🤷
"<wait30s>italiano<esc>english<enter>",
# Select Your Country and Region
"<wait30s>united states<leftShiftOn><tab><leftShiftOff><spacebar>",
# Written and Spoken Languages
@@ -44,13 +48,13 @@ source "tart-cli" "tart" {
# Create a Computer Account
"<wait10s>admin<tab><tab>admin<tab>admin<tab><tab><tab><spacebar>",
# Enable Location Services
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>",
"<wait30s><leftShiftOn><tab><leftShiftOff><spacebar>",
# Are you sure you don't want to use Location Services?
"<wait10s><tab><spacebar>",
# Select Your Time Zone
"<wait10s><tab>UTC<enter><leftShiftOn><tab><leftShiftOff><spacebar>",
# Analytics
"<wait10s><tab><spacebar><leftShiftOn><tab><leftShiftOff><spacebar>",
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>",
# Screen Time
"<wait10s><tab><spacebar>",
# Siri
@@ -59,14 +63,14 @@ source "tart-cli" "tart" {
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>",
# Enable Voice Over
"<wait10s><leftAltOn><f5><leftAltOff><wait5s>v",
# Now that the installation is done, open "System Preferences"
"<wait10s><leftAltOn><spacebar><leftAltOff>System Preferences<enter>",
# Now that the installation is done, open "System Settings"
"<wait10s><leftAltOn><spacebar><leftAltOff>System Settings<enter>",
# Navigate to "Sharing"
"<wait10s>sharing<enter>",
# Enable Screen Sharing
"<wait10s><tab><tab><tab><tab><spacebar>",
# Enable Remote Login
"<wait10s><down><down><down><down><spacebar><tab><tab><spacebar>",
"<wait10s><leftAltOn>f<leftAltOff>sharing<enter>",
# Navigate to "Screen Sharing" and enable it
"<wait10s><tab><tab><tab><tab><tab><spacebar>",
# Navigate to "Remote Login" and enable it
"<wait10s><tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><spacebar>",
# Disable Voice Over
"<leftAltOn><f5><leftAltOff>",
]
@@ -82,7 +86,7 @@ build {
provisioner "shell" {
inline = [
// Enable passwordless sudo
"echo admin | sudo -S sh -c \"echo 'admin ALL=(ALL) NOPASSWD: ALL' | EDITOR=tee visudo /etc/sudoers.d/admin-nopasswd\"",
"echo admin | sudo -S sh -c \"mkdir -p /etc/sudoers.d/; echo 'admin ALL=(ALL) NOPASSWD: ALL' | EDITOR=tee visudo /etc/sudoers.d/admin-nopasswd\"",
// Enable auto-login
//
// See https://github.com/xfreebird/kcpassword for details.
@@ -90,18 +94,20 @@ build {
"sudo defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser admin",
// Disable screensaver at login screen
"sudo defaults write /Library/Preferences/com.apple.screensaver loginWindowIdleTime 0",
// Disable screensaver for admin user
"defaults -currentHost write com.apple.screensaver idleTime 0",
// Prevent the VM from sleeping
"sudo systemsetup -setdisplaysleep Off",
"sudo systemsetup -setsleep Off",
"sudo systemsetup -setcomputersleep Off",
"sudo systemsetup -setdisplaysleep Off 2>/dev/null",
"sudo systemsetup -setsleep Off 2>/dev/null",
"sudo systemsetup -setcomputersleep Off 2>/dev/null",
// Launch Safari to populate the defaults
"/Applications/Safari.app/Contents/MacOS/Safari &",
"sleep 3",
"kill -9 %1",
// Enable Safari's remote automation and "Develop" menu
"SAFARI_PID=$!",
"disown",
"sleep 30",
"kill -9 $SAFARI_PID",
// Enable Safari's remote automation
"sudo safaridriver --enable",
"defaults write com.apple.Safari.SandboxBroker ShowDevelopMenu -bool true",
"defaults write com.apple.Safari IncludeDevelopMenu -bool true",
// Disable screen lock
//
// Note that this only works if the user is logged-in,
+21 -12
View File
@@ -1,7 +1,7 @@
packer {
required_plugins {
tart = {
version = ">= 0.5.4"
version = ">= 1.12.0"
source = "github.com/cirruslabs/tart"
}
}
@@ -10,7 +10,7 @@ packer {
source "tart-cli" "tart" {
# You can find macOS IPSW URLs on various websites like https://ipsw.me/
# and https://www.theiphonewiki.com/wiki/Beta_Firmware/Mac/13.x
from_ipsw = "https://updates.cdn-apple.com/2023WinterFCS/fullrestores/032-48346/EFF99C1E-C408-4E7A-A448-12E1468AF06C/UniversalMac_13.2.1_22D68_Restore.ipsw"
from_ipsw = "https://updates.cdn-apple.com/2023FallFCS/fullrestores/042-55833/C0830847-A2F8-458F-B680-967991820931/UniversalMac_13.6_22G120_Restore.ipsw"
vm_name = "ventura-vanilla"
cpu_count = 4
memory_gb = 8
@@ -21,8 +21,14 @@ source "tart-cli" "tart" {
boot_command = [
# hello, hola, bonjour, etc.
"<wait60s><spacebar>",
# Language
"<wait30s>english<enter>",
# Language: most of the times we have a list of "English"[1], "English (UK)", etc. with
# "English" language already selected. If we type "english", it'll cause us to switch
# to the "English (UK)", which is not what we want. To solve this, we switch to some other
# language first, e.g. "Italiano" and then switch back to "English". We'll then jump to the
# first entry in a list of "english"-prefixed items, which will be "English".
#
# [1]: should be named "English (US)", but oh well 🤷
"<wait30s>italiano<esc>english<enter>",
# Select Your Country and Region
"<wait30s>united states<leftShiftOn><tab><leftShiftOff><spacebar>",
# Written and Spoken Languages
@@ -88,7 +94,7 @@ build {
provisioner "shell" {
inline = [
// Enable passwordless sudo
"echo admin | sudo -S sh -c \"echo 'admin ALL=(ALL) NOPASSWD: ALL' | EDITOR=tee visudo /etc/sudoers.d/admin-nopasswd\"",
"echo admin | sudo -S sh -c \"mkdir -p /etc/sudoers.d/; echo 'admin ALL=(ALL) NOPASSWD: ALL' | EDITOR=tee visudo /etc/sudoers.d/admin-nopasswd\"",
// Enable auto-login
//
// See https://github.com/xfreebird/kcpassword for details.
@@ -96,23 +102,26 @@ build {
"sudo defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser admin",
// Disable screensaver at login screen
"sudo defaults write /Library/Preferences/com.apple.screensaver loginWindowIdleTime 0",
// Disable screensaver for admin user
"defaults -currentHost write com.apple.screensaver idleTime 0",
// Prevent the VM from sleeping
"sudo systemsetup -setdisplaysleep Off",
"sudo systemsetup -setsleep Off",
"sudo systemsetup -setcomputersleep Off",
"sudo systemsetup -setdisplaysleep Off 2>/dev/null",
"sudo systemsetup -setsleep Off 2>/dev/null",
"sudo systemsetup -setcomputersleep Off 2>/dev/null",
// Launch Safari to populate the defaults
"/Applications/Safari.app/Contents/MacOS/Safari &",
"SAFARI_PID=$!",
"disown",
"sleep 30",
"kill -9 %1",
// Enable Safari's remote automation and "Develop" menu
"kill -9 $SAFARI_PID",
// Enable Safari's remote automation
"sudo safaridriver --enable",
"defaults write com.apple.Safari.SandboxBroker ShowDevelopMenu -bool true",
"defaults write com.apple.Safari IncludeDevelopMenu -bool true",
// Disable screen lock
//
// Note that this only works if the user is logged-in,
// i.e. not on login screen.
"sysadminctl -screenLock off -password admin",
"defaults -currentHost write com.apple.screensaver idleTime 0"
]
}
}
+125 -47
View File
@@ -1,71 +1,107 @@
packer {
required_plugins {
tart = {
version = ">= 0.5.4"
version = ">= 1.12.0"
source = "github.com/cirruslabs/tart"
}
}
}
variable "macos_version" {
type = string
type = string
}
variable "xcode_version" {
type = string
type = list(string)
}
variable "gha_version" {
type = string
variable "additional_runtimes" {
type = list(string)
default = []
}
variable "tag" {
type = string
default = ""
}
variable "disk_size" {
type = number
default = 100
}
variable "disk_free_mb" {
type = number
default = 15000
}
variable "android_sdk_tools_version" {
type = string
default = "9477386" # https://developer.android.com/studio/#command-tools
type = string
default = "11076708" # https://developer.android.com/studio/#command-tools
}
source "tart-cli" "tart" {
vm_base_name = "${var.macos_version}-base"
vm_name = "${var.macos_version}-xcode:${var.xcode_version}"
vm_base_name = "ghcr.io/cirruslabs/macos-${var.macos_version}-base:latest"
// use tag or the last element of the xcode_version list
vm_name = "${var.macos_version}-xcode:${var.tag != "" ? var.tag : var.xcode_version[length(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"
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"]
// re-install the actions runner
provisioner "shell" {
inline = [
"cd $HOME",
"rm -rf actions-runner",
"mkdir actions-runner && cd actions-runner",
"curl -O -L https://github.com/actions/runner/releases/download/v${var.gha_version}/actions-runner-osx-arm64-${var.gha_version}.tar.gz",
"tar xzf ./actions-runner-osx-arm64-${var.gha_version}.tar.gz",
"rm actions-runner-osx-arm64-${var.gha_version}.tar.gz",
]
}
provisioner "shell" {
inline = [
"source ~/.zprofile",
"brew --version",
"brew update",
"brew upgrade",
"brew install curl wget unzip zip ca-certificates",
"sudo softwareupdate --install-rosetta --agree-to-license"
]
}
// Re-install the GitHub Actions runner
provisioner "shell" {
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",
"brew install homebrew/cask-versions/temurin11",
"brew install openjdk@17",
"echo 'export PATH=\"/opt/homebrew/opt/openjdk@17/bin:$PATH\"' >> ~/.zprofile",
"echo 'export ANDROID_HOME=$HOME/android-sdk' >> ~/.zprofile",
"echo 'export ANDROID_SDK_ROOT=$ANDROID_HOME' >> ~/.zprofile",
"echo 'export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator' >> ~/.zprofile",
@@ -76,28 +112,40 @@ build {
"rm android-sdk-tools.zip",
"mv $ANDROID_HOME/cmdline-tools/cmdline-tools $ANDROID_HOME/cmdline-tools/latest",
"yes | sdkmanager --licenses",
"yes | sdkmanager 'platform-tools' 'platforms;android-33' 'build-tools;33.0.1' 'ndk;25.1.8937393'"
"yes | sdkmanager 'platform-tools' 'platforms;android-33' 'build-tools;34.0.0' 'ndk;25.2.9519653'"
]
}
provisioner "shell" {
inline = [
"echo 'export PATH=/usr/local/bin/:$PATH' >> ~/.zprofile",
"source ~/.zprofile",
"wget --quiet https://github.com/RobotsAndPencils/xcodes/releases/latest/download/xcodes.zip",
"unzip xcodes.zip",
"rm xcodes.zip",
"chmod +x xcodes",
"sudo mkdir -p /usr/local/bin/",
"sudo mv xcodes /usr/local/bin/xcodes",
"brew install xcodesorg/made/xcodes",
"xcodes version",
"wget --quiet https://storage.googleapis.com/xcodes-cache/Xcode_${var.xcode_version}.xip",
"xcodes install ${var.xcode_version} --experimental-unxip --path $PWD/Xcode_${var.xcode_version}.xip",
"sudo rm -rf ~/.Trash/*",
"xcodes select ${var.xcode_version}",
"xcodebuild -downloadAllPlatforms",
"xcodebuild -runFirstLaunch",
]
}
provisioner "file" {
sources = [ for version in var.xcode_version : pathexpand("~/XcodesCache/Xcode_${version}.xip")]
destination = "/Users/admin/Downloads/"
}
// iterate over all Xcode versions and install them
// select the latest one as the default
dynamic "provisioner" {
for_each = local.xcode_install_provisioners
labels = ["shell"]
content {
inline = provisioner.value.inline
}
}
provisioner "shell" {
inline = [
for runtime in var.additional_runtimes :
"source ~/.zprofile && sudo xcodes runtimes install ${runtime}"
]
}
provisioner "shell" {
inline = [
"source ~/.zprofile",
@@ -115,31 +163,61 @@ build {
provisioner "shell" {
inline = [
"source ~/.zprofile",
"brew install libimobiledevice ideviceinstaller ios-deploy fastlane",
"sudo gem update",
"sudo gem install cocoapods",
"sudo gem uninstall --ignore-dependencies ffi && sudo gem install ffi -- --enable-libffi-alloc"
"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"
]
}
# useful utils for mobile development
provisioner "shell" {
inline = [
"source ~/.zprofile",
"brew install graphicsmagick imagemagick",
"brew install wix/brew/applesimutils",
"brew install gnupg"
]
}
# inspired by https://github.com/actions/runner-images/blob/fb3b6fd69957772c1596848e2daaec69eabca1bb/images/macos/provision/configuration/configure-machine.sh#L33-L61
provisioner "shell" {
inline = [
"source ~/.zprofile",
"sudo security delete-certificate -Z FF6797793A3CD798DC5B2ABEF56F73EDC9F83A64 /Library/Keychains/System.keychain",
"curl -o add-certificate.swift https://raw.githubusercontent.com/actions/runner-images/fb3b6fd69957772c1596848e2daaec69eabca1bb/images/macos/provision/configuration/add-certificate.swift",
"swiftc add-certificate.swift",
"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",
"swiftc -suppress-warnings add-certificate.swift",
"sudo ./add-certificate AppleWWDRCAG3.cer",
"sudo ./add-certificate DeveloperIDG2CA.cer",
"rm add-certificate* *.cer"
]
}
provisioner "shell" {
inline = [
"source ~/.zprofile",
"brew doctor",
"flutter doctor"
]
}
// 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 ${var.disk_free_mb} ]] && echo OK || exit 1"
]
}
// some other health checks
provisioner "shell" {
inline = [
"source ~/.zprofile",
"test -d /Users/runner"
]
}
}
-3
View File
@@ -1,3 +0,0 @@
macos_version = "ventura"
gha_version = "2.302.1"
xcode_version = "14.2"