clone

an offline map explorer where each world, from a game map to a city's open data, ships as one .atlas file

feat/atlas-next-horizon
atlas / scripts / release / smoke-macos.sh
smoke-macos.sh 1.8K executable
1#!/usr/bin/env bash2set -euo pipefail34if [[ $# -ne 3 ]]; then5 echo "usage: smoke-macos.sh <package.zip> <version> <repo-root>" >&26 exit 27fi89package=$110version=$211root=$312version_number=${version#v}13mac_version=0.0.014if [[ "$version_number" =~ ^[0-9]+(\.[0-9]+){0,2} ]]; then15 mac_version=${BASH_REMATCH[0]}16fi17stage=$(mktemp -d)18app_pid=""19cleanup() {20 if [[ -n "$app_pid" ]]; then kill "$app_pid" >/dev/null 2>&1 || true; fi21 rm -rf "$stage"22}23trap cleanup EXIT2425ditto -x -k "$package" "$stage/unpacked"26app="$stage/unpacked/Atlas.app"27executable="$app/Contents/MacOS/Atlas"28test -x "$executable"29codesign --verify --deep --strict --verbose=2 "$app"30[[ "$(plutil -extract CFBundleIdentifier raw "$app/Contents/Info.plist")" == dev.felinestatemachine.atlas ]]31[[ "$(plutil -extract CFBundleShortVersionString raw "$app/Contents/Info.plist")" == "$mac_version" ]]32plutil -extract UTExportedTypeDeclarations.0.UTTypeIdentifier raw "$app/Contents/Info.plist" \33 | grep -Fx dev.felinestatemachine.atlas.volume34"$executable" --version | grep -Fx "Atlas $version"3536go run "$root/cmd/atlas" build -cache "$stage/cache" -bundles "$stage/source" \37 "$root/examples/sample-region.atlas-project"38artifact=$(find "$stage/source" -maxdepth 1 -type f -name 'sample-region-*.atlas' -print -quit)39test -n "$artifact"40mkdir -p "$stage/library" "$stage/data"41ATLAS_BUNDLES_DIR="$stage/library" ATLAS_DATA_DIR="$stage/data" \42 "$executable" "$artifact" >"$stage/atlas.log" 2>&1 &43app_pid=$!44for _ in $(seq 1 60); do45 if find "$stage/library" -maxdepth 1 -type f -name 'sample-region-*.atlas' -print -quit | grep -q .; then46 break47 fi48 kill -0 "$app_pid" 2>/dev/null || { cat "$stage/atlas.log" >&2; exit 1; }49 sleep 150done51installed=$(find "$stage/library" -maxdepth 1 -type f -name 'sample-region-*.atlas' -print -quit)52test -n "$installed"53cmp "$artifact" "$installed"