SPB Git

Repository Public

build.sh 3.5 KB 79 lines shellscript

1#!/usr/bin/env bash2# =============================================================================3#                  SP BOUCHER | SOFTWARE & RESEARCH4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : SPB Git for iOS and iPadOS8# File             : scripts/build.sh9# Module           : Scripts10# Repository       : https://git.spboucher.ai/spbgit-ios11# Project Website  : Not specified12# Created          : 2026-12-0213# Last Modified    : 2026-12-0214#15# Author           : Simon-Pierre Boucher16# Position         : Professor of Finance17# Institution      : Université du Québec en Outaouais (UQO)18# Organization     : SP Boucher19# Website          : https://spboucher.ai20# Git              : https://git.spboucher.ai21#22# Preferred Contact: contact@spboucher.ai23# Development      : dev@spboucher.ai24# Support          : support@spboucher.ai25# Security/Admin   : admin@spboucher.ai26#27# Copyright (c) 202628# Simon-Pierre Boucher29# All rights reserved where applicable. This file is governed by the30# applicable project license, copyright notices and relevant law.31# Existing third-party rights and notices remain unaffected.32#33# License          : None specified (no license file in this repository)34#35# Do not embed credentials, private keys, access tokens,36# certificates or confidential personal information.37#38# =============================================================================39# END OF SP BOUCHER SOURCE HEADER40# =============================================================================4142# One xcodebuild at a time, output to a log, errors summarised.43#   scripts/build.sh build            build the app and the test bundles (simulator)44#   scripts/build.sh test [filter]    unit tests (SPBGitTests), optionally -only-testing:<filter>45#   scripts/build.sh uitest           UI tests (SPBGitUITests)46#   scripts/build.sh live             unit tests including the live visitor-pass round trip (hits production once)47set -uo pipefail48cd "$(dirname "$0")/.."49DEVICE="${SPBGIT_SIMULATOR:-SPBGit iPhone}"50DEST="platform=iOS Simulator,name=$DEVICE"51COMMON=(-project SPBGit.xcodeproj -scheme SPBGit -destination "$DEST" -derivedDataPath build/dd)52mkdir -p build/logs53# Never two builds at once on this machine (it froze under parallel builds): wait for any other xcodebuild.54waited=055while pgrep -x xcodebuild >/dev/null; do56  [ "$waited" -ge 1500 ] && { echo "another xcodebuild is still running after 25 min; giving up"; exit 3; }57  sleep 10; waited=$((waited + 10))58done59xcodegen generate --quiet || exit 160summary() {61  grep -E "error:|\*\* .* \*\*|Executed [0-9]+ tests|Test run with [0-9]+ tests|✘|recorded an issue" "$1" | sort -u | head -6062}63case "${1:-build}" in64build)65  xcodebuild build-for-testing "${COMMON[@]}" > build/logs/build.log 2>&1; code=$?66  summary build/logs/build.log; exit $code ;;67test)68  only=(-only-testing:SPBGitTests); [ -n "${2:-}" ] && only=(-only-testing:"$2")69  xcodebuild test "${COMMON[@]}" "${only[@]}" > build/logs/test.log 2>&1; code=$?70  summary build/logs/test.log; exit $code ;;71uitest)72  xcodebuild test "${COMMON[@]}" -only-testing:SPBGitUITests > build/logs/uitest.log 2>&1; code=$?73  summary build/logs/uitest.log; exit $code ;;74live)75  TEST_RUNNER_SPBGIT_LIVE=1 xcodebuild test "${COMMON[@]}" -only-testing:SPBGitTests/VisitorPassLiveTests > build/logs/live.log 2>&1; code=$?76  summary build/logs/live.log; grep -E "LIVE:" build/logs/live.log | sort -u; exit $code ;;77*) echo "usage: $0 build|test [filter]|uitest|live"; exit 2 ;;78esac79
Files main
Menu

Theme