Skip to content

Commit

Permalink
check-result, handle errors. (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
BB9z authored Jan 21, 2024
1 parent 04f51d0 commit 6b4b06d
Show file tree
Hide file tree
Showing 31 changed files with 881 additions and 213 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@ Environment variables:

### check-result

Parse xcresult bundle, it can:

* Print build warnings and summary.
* Export checkstyle.xml.

Environment variables:

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

### fetch-mr

Expand Down
33 changes: 17 additions & 16 deletions build-ios
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,31 @@ if [[ -z ${XC_RESULT_BUNDLE-} ]]; then
logInfo "[Path] Use default result bundle: $XC_RESULT_BUNDLE"
fi
if [[ ! -v XC_LOG_FILE ]]; then
XC_LOG_FILE="build/xc-build.log"
logInfo "[Path] Use default log file: $XC_LOG_FILE"
elif [[ -n "${CI_CHECK_STYLE_FILE:-}" ]]; then
XC_LOG_FILE="build/xc-build.log"
export XC_LOG_FILE="build/xc-build.log"
logInfo "[Path] Use default log file: $XC_LOG_FILE"
fi

prepeareResultFile "$XC_RESULT_BUNDLE"
if [[ -n $XC_LOG_FILE ]]; then
prepeareResultFile "$XC_LOG_FILE"
fi

logInfo "[Xcode] Building..."

if [[ -n $XC_LOG_FILE ]]; then
# logInfo "Log file: $XC_LOG_FILE"
prepeareResultFile "$XC_LOG_FILE"
xcCommand build | showProgress || {
logError "[Xcode] Build failed:"
tail -n 50 "$XC_LOG_FILE"
exit 1
}
logInfo "[Xcode] Building completed."
tail -n 4 "$XC_LOG_FILE"
code=0
xcCommand build | showProgress || {
code=$?
}
if [[ $code != 0 ]]; then
logError "[Xcode] Building failed."
else
xcCommand build
logInfo "[Xcode] Building completed."
fi

"$(dirname $0)/check-result" listIssues summary checkstyle
resultCommands=("$(dirname $0)/check-result" listIssues summary)
if [[ -n "${CI_CHECK_STYLE_FILE:-}" ]]; then
resultCommands+=("checkstyle")
fi
"${resultCommands[@]}"

exit $code
Loading

0 comments on commit 6b4b06d

Please sign in to comment.