-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_tests.sh
executable file
·37 lines (30 loc) · 1.19 KB
/
run_tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Load configurations from YAML file
# You’ll need a way to read and parse the YAML file from your script. While bash itself does not support parsing YAML natively, you can use a command-line tool like yq (a lightweight and portable command-line YAML processor).
# brew install yq
# Before you can run the script, you need to make it executable:
# chmod +x run_tests.sh
# Now, you can run your script from the command line:
# ./run_tests.sh
CONFIG_FILE="test_config.yml"
echo "Looking for config file at: $PWD/$CONFIG_FILE"
if [ ! -f "$CONFIG_FILE" ]; then
echo "Config file not found: $CONFIG_FILE"
exit 1
fi
# Load configurations from YAML file
PROJECT=$(yq e '.test_config.project' $CONFIG_FILE)
SCHEME=$(yq e '.test_config.scheme' $CONFIG_FILE)
# Initialize an empty array
DESTINATIONS=()
# Read destinations into the array
while IFS= read -r line; do
DESTINATIONS+=("$line")
done < <(yq e '.test_config.destinations[]' $CONFIG_FILE)
# Loop through each destination and run tests
echo "Starting test runs..."
for DESTINATION in "${DESTINATIONS[@]}"
do
echo "Running tests on $DESTINATION"
xcodebuild test -project "$PROJECT" -scheme "$SCHEME" -destination "$DESTINATION" | xcpretty
done