diff --git a/.ci/cirrus.base.yml b/.ci/cirrus.base.yml new file mode 100644 index 0000000..2e3732b --- /dev/null +++ b/.ci/cirrus.base.yml @@ -0,0 +1,19 @@ +task: + name: "Update Base Images ($MACOS_VERSION)" + alias: update-base + matrix: + - env: + MACOS_VERSION: sonoma + - env: + MACOS_VERSION: sequoia + <<: *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 diff --git a/.ci/cirrus.release.yml b/.ci/cirrus.release.yml new file mode 100644 index 0000000..55f9cb6 --- /dev/null +++ b/.ci/cirrus.release.yml @@ -0,0 +1,23 @@ +task: + name: "Release Xcode $CIRRUS_TAG ($MACOS_VERSION)" + matrix: + - env: + MACOS_VERSION: sonoma + - env: + MACOS_VERSION: sequoia + <<: *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 diff --git a/.ci/cirrus.runner.yml b/.ci/cirrus.runner.yml new file mode 100644 index 0000000..d7b7add --- /dev/null +++ b/.ci/cirrus.runner.yml @@ -0,0 +1,20 @@ +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" \ No newline at end of file diff --git a/.ci/cirrus.vanilla.yml b/.ci/cirrus.vanilla.yml new file mode 100644 index 0000000..12298b4 --- /dev/null +++ b/.ci/cirrus.vanilla.yml @@ -0,0 +1,44 @@ +task: + name: "Update Vanilla Sonoma Image" + only_if: $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH && changesInclude("templates/vanilla-sonoma.pkr.hcl") + <<: *defaults + build_script: + - 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 sonoma-vanilla ghcr.io/cirruslabs/macos-sonoma-vanilla:latest ghcr.io/cirruslabs/macos-sonoma-vanilla:14.6 + always: + cleanup_script: + - 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.1 + 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-6 + always: + cleanup_script: + - tart delete sequoia-vanilla diff --git a/.ci/cirrus.xcode.yml b/.ci/cirrus.xcode.yml new file mode 100644 index 0000000..9f97a15 --- /dev/null +++ b/.ci/cirrus.xcode.yml @@ -0,0 +1,35 @@ +task: + name: "Update Xcode Images ($MACOS_VERSION $XCODE_VERSION)" + depends_on: update-base + env: + matrix: + - MACOS_VERSION: sequoia + XCODE_VERSION: 16.1-beta-3 + - MACOS_VERSION: sequoia + XCODE_VERSION: 16 + LATEST: true + - 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" diff --git a/.cirrus.star b/.cirrus.star index 1d44010..7460dc1 100644 --- a/.cirrus.star +++ b/.cirrus.star @@ -1,11 +1,13 @@ -load("cirrus", "env", "http") +load("cirrus", "env", "http", "fs") 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") + 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] @@ -19,7 +21,9 @@ def on_build_failed(ctx): "Authorization": "Bearer " + env.get("SLACK_TOKEN"), }, json_body={ "channel": "#image-updates", - "text": "Build 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), + "text": "Build 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: @@ -29,3 +33,15 @@ def on_build_failed(ctx): if resp_json["ok"] != True: fail("got error when posting message to Slack: {}".format(resp_json["error"])) + + +def main(ctx): + result = fs.read(".ci/cirrus.vanilla.yml") + if env.get("CIRRUS_TAG") != None: + result += fs.read(".ci/cirrus.release.yml") + if env.get("CIRRUS_CRON") == "monthly": + result += fs.read(".ci/cirrus.base.yml") + result += fs.read(".ci/cirrus.xcode.yml") + if env.get("CIRRUS_CRON") == "weekly": + result += fs.read(".ci/cirrus.runner.yml") + return result diff --git a/.cirrus.yml b/.cirrus.yml index 287aeb0..aa77118 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -19,145 +19,3 @@ defaults: &defaults info_script: - tart --version - packer --version - -task: - name: "Update Vanilla Sonoma Image" - only_if: $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH && changesInclude("templates/vanilla-sonoma.pkr.hcl") - <<: *defaults - build_script: - - 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 sonoma-vanilla ghcr.io/cirruslabs/macos-sonoma-vanilla:latest ghcr.io/cirruslabs/macos-sonoma-vanilla:14.6.1 - always: - cleanup_script: - - 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 diff --git a/templates/vanilla-sequoia-beta.pkr.hcl b/templates/vanilla-sequoia-beta.pkr.hcl index 2d1d6a1..703c7c4 100644 --- a/templates/vanilla-sequoia-beta.pkr.hcl +++ b/templates/vanilla-sequoia-beta.pkr.hcl @@ -8,7 +8,7 @@ packer { } 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" + from_ipsw = "https://updates.cdn-apple.com/2024FallSeed/fullrestores/072-00383/7EB106DF-9B03-4C2A-ACD1-997B0BFF9364/UniversalMac_15.1_24B5070a_Restore.ipsw" vm_name = "sequoia-vanilla" cpu_count = 4 memory_gb = 8 diff --git a/templates/vanilla-sonoma.pkr.hcl b/templates/vanilla-sonoma.pkr.hcl index fd8b5d8..5fb7fda 100644 --- a/templates/vanilla-sonoma.pkr.hcl +++ b/templates/vanilla-sonoma.pkr.hcl @@ -8,7 +8,7 @@ packer { } source "tart-cli" "tart" { - from_ipsw = "https://updates.cdn-apple.com/2024SummerFCS/fullrestores/062-52859/932E0A8F-6644-4759-82DA-F8FA8DEA806A/UniversalMac_14.6.1_23G93_Restore.ipsw" + from_ipsw = "https://updates.cdn-apple.com/2024SummerFCS/fullrestores/052-69922/F5DA2B64-25EB-4370-9E89-FA5689859796/UniversalMac_14.6_23G80_Restore.ipsw" vm_name = "sonoma-vanilla" cpu_count = 4 memory_gb = 8