listless

A simple list app for Apple platforms
Log | Files | Refs | README | LICENSE

test-macos-ui.sh (1496B)


      1 #!/bin/bash
      2 set -euo pipefail
      3 
      4 REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
      5 SECRETS="$REPO_ROOT/.asc/secrets.sh"
      6 
      7 if [[ ! -f "$SECRETS" ]]; then
      8     echo "Error: $SECRETS not found. See Scripts/secrets.sh.example for the required format."
      9     exit 1
     10 fi
     11 
     12 source "$SECRETS"
     13 
     14 DEV_P12="$REPO_ROOT/.asc/dev.p12"
     15 TMP_KEYCHAIN="$REPO_ROOT/.asc/build.keychain-db"
     16 
     17 echo "==> Setting up temporary keychain..."
     18 security delete-keychain "$TMP_KEYCHAIN" 2>/dev/null || true
     19 security create-keychain -p "$TMP_KEYCHAIN_PASS" "$TMP_KEYCHAIN"
     20 security unlock-keychain -p "$TMP_KEYCHAIN_PASS" "$TMP_KEYCHAIN"
     21 security set-keychain-settings -lut 21600 "$TMP_KEYCHAIN"
     22 security import "$DEV_P12" -k "$TMP_KEYCHAIN" -P "$DEV_P12_PASS" \
     23     -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
     24 security set-key-partition-list -S apple-tool:,apple:,codesign:,productbuild: \
     25     -s -k "$TMP_KEYCHAIN_PASS" "$TMP_KEYCHAIN"
     26 security list-keychains -d user -s "$TMP_KEYCHAIN" ~/Library/Keychains/login.keychain-db
     27 
     28 cleanup_keychain() {
     29     echo "==> Restoring keychain search list..."
     30     security list-keychains -d user -s ~/Library/Keychains/login.keychain-db
     31     security default-keychain -d user -s ~/Library/Keychains/login.keychain-db
     32     security delete-keychain "$TMP_KEYCHAIN" 2>/dev/null || true
     33 }
     34 trap cleanup_keychain EXIT
     35 
     36 echo "==> Running macOS UI tests..."
     37 xcodebuild test \
     38   -scheme "Listless macOS" \
     39   -destination 'platform=macOS' \
     40   -only-testing:"Listless macOS UI Tests" \
     41   2>&1