Skip to content

Commit 6b4b06d

Browse files
authored
check-result, handle errors. (#2)
1 parent 04f51d0 commit 6b4b06d

File tree

31 files changed

+881
-213
lines changed

31 files changed

+881
-213
lines changed

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,16 @@ Environment variables:
1515

1616
### check-result
1717

18+
Parse xcresult bundle, it can:
19+
20+
* Print build warnings and summary.
21+
* Export checkstyle.xml.
22+
1823
Environment variables:
1924

2025
* `CI_XCODE_WARNING_IGNORE_TYPES`: Ignore warning types, separated by comma. eg. `"No-usage,Deprecations,Documentation Issue"`
21-
* `CI_XCODE_WARNING_LIMIT`: Limit warning count. eg. `100`
26+
* `CI_XCODE_WARNING_LIMIT`: Limit warning count. eg. `100`.
27+
* `CI_XCODE_ERROR_LIMIT`: Limit error count. Default is `0`.
2228

2329
### fetch-mr
2430

build-ios

+17-16
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,31 @@ if [[ -z ${XC_RESULT_BUNDLE-} ]]; then
2222
logInfo "[Path] Use default result bundle: $XC_RESULT_BUNDLE"
2323
fi
2424
if [[ ! -v XC_LOG_FILE ]]; then
25-
XC_LOG_FILE="build/xc-build.log"
26-
logInfo "[Path] Use default log file: $XC_LOG_FILE"
27-
elif [[ -n "${CI_CHECK_STYLE_FILE:-}" ]]; then
28-
XC_LOG_FILE="build/xc-build.log"
25+
export XC_LOG_FILE="build/xc-build.log"
2926
logInfo "[Path] Use default log file: $XC_LOG_FILE"
3027
fi
3128

3229
prepeareResultFile "$XC_RESULT_BUNDLE"
30+
if [[ -n $XC_LOG_FILE ]]; then
31+
prepeareResultFile "$XC_LOG_FILE"
32+
fi
3333

3434
logInfo "[Xcode] Building..."
3535

36-
if [[ -n $XC_LOG_FILE ]]; then
37-
# logInfo "Log file: $XC_LOG_FILE"
38-
prepeareResultFile "$XC_LOG_FILE"
39-
xcCommand build | showProgress || {
40-
logError "[Xcode] Build failed:"
41-
tail -n 50 "$XC_LOG_FILE"
42-
exit 1
43-
}
44-
logInfo "[Xcode] Building completed."
45-
tail -n 4 "$XC_LOG_FILE"
36+
code=0
37+
xcCommand build | showProgress || {
38+
code=$?
39+
}
40+
if [[ $code != 0 ]]; then
41+
logError "[Xcode] Building failed."
4642
else
47-
xcCommand build
4843
logInfo "[Xcode] Building completed."
4944
fi
5045

51-
"$(dirname $0)/check-result" listIssues summary checkstyle
46+
resultCommands=("$(dirname $0)/check-result" listIssues summary)
47+
if [[ -n "${CI_CHECK_STYLE_FILE:-}" ]]; then
48+
resultCommands+=("checkstyle")
49+
fi
50+
"${resultCommands[@]}"
51+
52+
exit $code

0 commit comments

Comments
 (0)