SPB Git

Repository Public

build.sh 3.3 KB 53 lines shellscript

1#!/usr/bin/env bash2# Immo-Ka Admin iOS3# File: Scripts/build.sh4# Description: génération du projet, compilation et tests sur les simulateurs.5#              usage : build.sh generate | debug | release | test | uitest | run [arguments] | shot <nom>6#              IMMOKA_SIM choisit le simulateur (défaut « LouKa-v3 » ; iPad : « LouKa-v3 iPad »).7#8# Author: Simon-Pierre Boucher9# Contact: contact@spboucher.ai10set -uo pipefail11cd "$(dirname "$0")/.."12SIM="${IMMOKA_SIM:-LouKa-v3}"13DD="build/DerivedData"14BUNDLE=com.spboucher.immoka.admin15mkdir -p build/logs build/shots16filter() { grep -E "error:|\*\* |Executed [0-9]+ tests|✘|Testing failed|Test run with|Test [Cc]ase .* (passed|failed)" | sed "s|$PWD/||" | awk '!seen[$0]++' | head -"${LINES_MAX:-60}"; }17generate() { xcodegen generate --quiet; }18udid() { xcrun simctl list devices | grep -F "$SIM (" | head -1 | sed -E 's/.*\(([0-9A-F-]{36})\).*/\1/'; }19boot() { U="$(udid)"; xcrun simctl boot "$U" 2>/dev/null; xcrun simctl bootstatus "$U" >/dev/null 2>&1; }20# jeton de session d'essai de la préproduction (jamais dans le dépôt) : build/session.env, écrit par Scripts/session-essai.sh21if [ -f build/session.env ]; then22  # shellcheck disable=SC109123  . build/session.env24  export TEST_RUNNER_IMMOKA_ADMIN_TOKEN="${IMMOKA_ADMIN_TOKEN:-}" TEST_RUNNER_IMMOKA_ADMIN_BASE="${IMMOKA_ADMIN_BASE:-}"25fi26export TEST_RUNNER_IMMOKA_APPEARANCE="${IMMOKA_APPEARANCE:-light}"27case "${1:-debug}" in28  generate) generate && echo "projet généré" ;;29  debug)30    generate31    xcodebuild -project ImmoKaAdmin.xcodeproj -scheme ImmoKaAdmin -configuration Debug -destination "platform=iOS Simulator,name=$SIM" -derivedDataPath "$DD" build 2>&1 | tee build/logs/debug.log | filter ;;32  release)33    generate34    xcodebuild -project ImmoKaAdmin.xcodeproj -scheme ImmoKaAdmin -configuration Release -destination "generic/platform=iOS Simulator" -derivedDataPath "$DD" build 2>&1 | tee build/logs/release.log | filter ;;35  test)36    shift || true; generate; boot37    xcodebuild -project ImmoKaAdmin.xcodeproj -scheme ImmoKaAdmin -destination "platform=iOS Simulator,name=$SIM" -derivedDataPath "$DD" -only-testing:ImmoKaAdminTests "$@" test 2>&1 | tee build/logs/test.log | filter ;;38  uitest)39    shift || true; generate; boot40    rm -rf "build/results/uitest-${SIM// /_}.xcresult"41    xcodebuild -project ImmoKaAdmin.xcodeproj -scheme ImmoKaAdmin -destination "platform=iOS Simulator,name=$SIM" -derivedDataPath "$DD" -only-testing:ImmoKaAdminUITests -parallel-testing-enabled NO \42      -resultBundlePath "build/results/uitest-${SIM// /_}.xcresult" "$@" test 2>&1 | tee build/logs/uitest.log | filter43    rm -rf "build/shots/uitest-${SIM// /_}"; mkdir -p "build/shots/uitest-${SIM// /_}"44    xcrun xcresulttool export attachments --path "build/results/uitest-${SIM// /_}.xcresult" --output-path "build/shots/uitest-${SIM// /_}" >/dev/null 2>&1 || true ;;45  run)46    boot; U="$(udid)"47    xcrun simctl install "$U" "$DD/Build/Products/Debug-iphonesimulator/ImmoKaAdmin.app" && xcrun simctl terminate "$U" "$BUNDLE" >/dev/null 2>&148    xcrun simctl launch "$U" "$BUNDLE" "${@:2}" ;;49  shot)50    U="$(udid)"; xcrun simctl io "$U" screenshot "build/shots/${2:-capture}.png" >/dev/null 2>&1 && echo "build/shots/${2:-capture}.png" ;;51  *) echo "usage: build.sh generate|debug|release|test|uitest|run [args]|shot <nom>"; exit 2 ;;52esac53
Files main
Menu

Theme