Modern Apps git

xtool.git

Public
git clone https://git.maproj.org/xtool.git
appstore-distribution ▾

xtool.git / integration-tests / run.sh

run.sh49 lines · 1.1 KiBRaw
1#!/bin/bash
2
3set -euo pipefail
4
5xcode_path="${XTL_TEST_XCODE_APP:-}"
6
7if [[ -z "$xcode_path" && $(uname -s) == "Darwin" ]]; then
8 xcode_path="$(dirname $(dirname $(/usr/bin/xcode-select -p)))"
9fi
10
11if [[ -z "$xcode_path" && -d /usr/local/share/Xcode.app ]]; then
12 xcode_path="/usr/local/share/Xcode.app"
13fi
14
15if [[ -z "$xcode_path" ]]; then
16 echo "Xcode.app not found. Please set XTL_TEST_XCODE_APP."
17 exit 1
18fi
19
20export XTL_TEST_XCODE_APP="$xcode_path"
21
22if [[ -z "${XTL_TEST_ENV:-}" ]]; then
23 [[ -t 1 ]] && tty_flag="-it" || tty_flag=""
24
25 echo "Running"
26
27 exec docker compose run --build --rm -e XTL_CI=1 -v "$xcode_path":/usr/local/share/Xcode.app:ro \
28 xtool-test bash -c \
29 "./integration-tests/run.sh"
30fi
31
32cd "$(dirname "$0")/.."
33
34project_dir="$PWD"
35
36swift build --product xtool
37swift test
38ln -fs $PWD/.build/debug/xtool /usr/local/bin/xtool
39hash -r
40
41mkdir /testroot
42cd /testroot
43export XDG_CONFIG_HOME="/testroot/config"
44
45echo "Installing SDK"
46xtool sdk install --slim "$XTL_TEST_XCODE_APP"
47
48echo "Running tests..."
49bats "$project_dir/integration-tests/suite"