Add dual nightly track regression test

This commit is contained in:
Lawrence Chen 2026-03-08 03:08:21 -07:00
parent 1ed4aa159d
commit 939560262f

View file

@ -1,19 +1,24 @@
#!/usr/bin/env bash
# Regression test for nightly universal macOS builds.
# Regression test for dual nightly macOS tracks.
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
WORKFLOW_FILE="$ROOT_DIR/.github/workflows/nightly.yml"
if ! awk '
/^ - name: Build app \(Release\)/ { in_build=1; next }
in_build && /^ - name:/ { in_build=0 }
in_build && /-destination '\''generic\/platform=macOS'\''/ { saw_destination=1 }
in_build && /ARCHS="arm64 x86_64"/ { saw_archs=1 }
in_build && /ONLY_ACTIVE_ARCH=NO/ { saw_only_active_arch=1 }
END { exit !(saw_destination && saw_archs && saw_only_active_arch) }
/^ - name: Build Apple Silicon app \(Release\)/ { in_arm=1; next }
/^ - name: Build universal app \(Release\)/ { in_universal=1; next }
in_arm && /^ - name:/ { in_arm=0 }
in_universal && /^ - name:/ { in_universal=0 }
in_arm && /-destination '\''platform=macOS,arch=arm64'\''/ { saw_arm_destination=1 }
in_universal && /-destination '\''generic\/platform=macOS'\''/ { saw_universal_destination=1 }
in_universal && /ARCHS="arm64 x86_64"/ { saw_universal_archs=1 }
in_universal && /ONLY_ACTIVE_ARCH=NO/ { saw_universal_only_active_arch=1 }
END {
exit !(saw_arm_destination && saw_universal_destination && saw_universal_archs && saw_universal_only_active_arch)
}
' "$WORKFLOW_FILE"; then
echo "FAIL: nightly build step must target generic macOS with explicit universal ARCHS"
echo "FAIL: nightly workflow must build both Apple Silicon and universal variants explicitly"
exit 1
fi
@ -28,6 +33,21 @@ if ! awk '
exit 1
fi
if ! grep -Fq 'com.cmuxterm.app.nightly.universal' "$WORKFLOW_FILE"; then
echo "FAIL: nightly workflow must set a distinct .universal bundle ID"
exit 1
fi
if ! grep -Fq 'https://github.com/manaflow-ai/cmux/releases/download/nightly/appcast-universal.xml' "$WORKFLOW_FILE"; then
echo "FAIL: nightly workflow must publish a separate universal appcast feed"
exit 1
fi
if ! grep -Fq './scripts/sparkle_generate_appcast.sh "$NIGHTLY_UNIVERSAL_DMG_IMMUTABLE" nightly appcast-universal.xml' "$WORKFLOW_FILE"; then
echo "FAIL: nightly workflow must generate a separate universal appcast"
exit 1
fi
if ! grep -Fq "core.setOutput('should_publish', isMainRef ? 'true' : 'false');" "$WORKFLOW_FILE"; then
echo "FAIL: nightly decide step must expose should_publish based on whether the ref is main"
exit 1
@ -38,9 +58,12 @@ if ! awk '
in_upload && /^ - name:/ { in_upload=0 }
in_upload && /if: needs\.decide\.outputs\.should_publish != '\''true'\''/ { saw_if=1 }
in_upload && /uses: actions\/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4/ { saw_upload=1 }
END { exit !(saw_if && saw_upload) }
in_upload && /cmux-nightly-macos\*\.dmg/ { saw_arm_artifacts=1 }
in_upload && /cmux-nightly-universal-macos\*\.dmg/ { saw_universal_artifacts=1 }
in_upload && /appcast-universal\.xml/ { saw_universal_appcast=1 }
END { exit !(saw_if && saw_upload && saw_arm_artifacts && saw_universal_artifacts && saw_universal_appcast) }
' "$WORKFLOW_FILE"; then
echo "FAIL: non-main nightly runs must upload artifacts instead of publishing the official nightly release"
echo "FAIL: non-main nightly runs must upload both nightly variants and both appcasts"
exit 1
fi
@ -58,10 +81,13 @@ if ! awk '
/^ - name: Publish nightly release assets/ { in_publish=1; next }
in_publish && /^ - name:/ { in_publish=0 }
in_publish && /if: needs\.decide\.outputs\.should_publish == '\''true'\''/ { saw_publish_if=1 }
END { exit !saw_publish_if }
in_publish && /cmux-nightly-universal-macos-\$\{\{ github\.run_id \}\}\*\.dmg/ { saw_universal_immutable=1 }
in_publish && /cmux-nightly-universal-macos\.dmg/ { saw_universal_stable=1 }
in_publish && /appcast-universal\.xml/ { saw_universal_appcast=1 }
END { exit !(saw_publish_if && saw_universal_immutable && saw_universal_stable && saw_universal_appcast) }
' "$WORKFLOW_FILE"; then
echo "FAIL: publishing nightly release assets must be gated to main nightly publishes"
echo "FAIL: main nightly publish must include the universal assets and appcast"
exit 1
fi
echo "PASS: nightly workflow keeps universal builds and safe branch dispatch behavior"
echo "PASS: nightly workflow keeps separate Apple Silicon and universal nightly tracks"