-
Notifications
You must be signed in to change notification settings - Fork 3
/
step.sh
89 lines (74 loc) · 2.59 KB
/
step.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/sh
# Metadata
export MDEV_CI="bitrise"
# Parse env variables
env_list=""
if [ -n "$env" ]; then
# Replace '\n' with ' -e '
envs="${env//\\n/ -e }"
# Prefix the whole string with '-e '
env_list="-e $envs"
fi
# Refine variables
[[ "$async" == "true" ]] && is_async="true"
[[ "$export_test_report" == "true" ]] && is_export="true"
# Test report file
if [[ "$is_export" == "true" ]]; then
if [[ -z "$export_output" ]]; then
export_file="report.xml"
fi
fi
set -ex
# Change to source directory
cd $BITRISE_SOURCE_DIR
# Maestro version
if [[ -z "$maestro_cli_version" ]]; then
echo "Maestro CLI version not specified, using latest"
else
echo "Maestro CLI version: $maestro_cli_version"
export MAESTRO_VERSION=$maestro_cli_version;
fi
# Get the version of curl
curl_version=$(curl --version | head -n 1 | awk '{print $2}')
echo "Current curl version: $curl_version"
required_version="7.71.0"
# Compare versions
if [ "$(printf '%s\n' "$required_version" "$curl_version" | sort -V | head -n1)" = "$required_version" ]; then
# If the version of curl is greater than or equal to 7.71.0, execute with --retry-all-errors
echo "version is higher or equal 7.71.0"
curl --retry 5 --retry-all-errors -Ls "https://get.maestro.mobile.dev" | bash
else
# If the version of curl is less than 7.71.0, execute without --retry-all-errors
echo "version is lower than 7.71.0"
curl --retry 5 -Ls "https://get.maestro.mobile.dev" | bash
fi
export PATH="$PATH":"$HOME/.maestro/bin"
# Run Maestro Cloud
EXIT_CODE=0
maestro cloud \
--apiKey $api_key \
${branch:+--branch "$branch"} \
${repo_name:+--repoName "$repo_name"} \
${repo_owner:+--repoOwner "$repo_owner"} \
${mapping_file:+--mapping "$mapping_file"} \
${upload_name:+--name "$upload_name"} \
${is_async:+--async} \
${pull_request_id:+--pullRequestId "$pull_request_id"} \
${android_api_level:+--android-api-level "$android_api_level"} \
${ios_version:+--ios-version "$ios_version"} \
${device_locale:+--device-locale "$device_locale"} \
${include_tags:+--include-tags "$include_tags"} \
${exclude_tags:+--exclude-tags "$exclude_tags"} \
${is_export:+--format "junit"} \
${export_file:+--output "$export_file"} \
${env_list:+ $env_list} \
${timeout:+--timeout "$timeout"} \
$app_file $workspace || EXIT_CODE=$?
# Export test results
if [[ -n "$export_file" && -f "$export_file" ]]; then
test_run_dir="$BITRISE_TEST_RESULT_DIR/maestro"
mkdir "$test_run_dir"
cp "$export_file" "$test_run_dir/maestro_report.xml"
echo '{"maestro-test-report":"Maestro Cloud Flows"}' >> "$test_run_dir/test-info.json"
fi
exit $EXIT_CODE