mirror of
https://github.com/whisperity/CodeChecker-Action.git
synced 2026-02-09 22:57:45 +00:00
feat: Add flag ignore-analyze-crashes which makes sure the entire job is not failed if the analysis fails
This commit is contained in:
@@ -259,9 +259,10 @@ runs:
|
|||||||
🔖 Read more about [`CodeChecker analyze`](http://codechecker.readthedocs.io/en/latest/analyzer/user_guide/#analyze) in the official documentation.
|
🔖 Read more about [`CodeChecker analyze`](http://codechecker.readthedocs.io/en/latest/analyzer/user_guide/#analyze) in the official documentation.
|
||||||
|
|
||||||
| Variable | Default | Description |
|
| Variable | Default | Description |
|
||||||
|------------------|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|--------------------------|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `analyze-output` | (auto-generated) | The directory where the **raw** analysis output should be stored. |
|
| `analyze-output` | (auto-generated) | The directory where the **raw** analysis output should be stored. |
|
||||||
| `ctu` | `false` | Enable [Cross Translation Unit analysis](http://clang.llvm.org/docs/analyzer/user-docs/CrossTranslationUnit.html) in the _Clang Static Analyzer_. ⚠️ **CAUTION!** _CTU_ analysis might take a very long time, and CTU is officially regarded as experimental. |
|
| `ctu` | `false` | Enable [Cross Translation Unit analysis](http://clang.llvm.org/docs/analyzer/user-docs/CrossTranslationUnit.html) in the _Clang Static Analyzer_. ⚠️ **CAUTION!** _CTU_ analysis might take a very long time, and CTU is officially regarded as experimental. |
|
||||||
|
| `ignore-analyze-crashes` | `true` | If set to `true`, the analysis phase will not report an error if some analysis actions fail (due to potential crashes in Clang). |
|
||||||
|
|
||||||
### Report configuration
|
### Report configuration
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ inputs:
|
|||||||
description: 'Whether to enable Cross Translation Unit (CTU) analysis in the Clang Static Analyzer.'
|
description: 'Whether to enable Cross Translation Unit (CTU) analysis in the Clang Static Analyzer.'
|
||||||
required: true
|
required: true
|
||||||
default: 'false'
|
default: 'false'
|
||||||
|
ignore-analyze-crashes:
|
||||||
|
description: 'If set to "true", the "analyze" action will ALWAYS pass, and not report a failure if some analysis jobs fail to execute due to internal crashes in the Clang analysers.'
|
||||||
|
required: true
|
||||||
|
default: 'true'
|
||||||
|
|
||||||
diff:
|
diff:
|
||||||
description: 'Whether to enable calculating the different of the current analysis results against a run stored on a CodeChecker server. If enabled, other flags, such as "diff-url" must also be set.'
|
description: 'Whether to enable calculating the different of the current analysis results against a run stored on a CodeChecker server. If enabled, other flags, such as "diff-url" must also be set.'
|
||||||
@@ -176,6 +180,7 @@ runs:
|
|||||||
IN_CONFIGFILE: ${{ inputs.config }}
|
IN_CONFIGFILE: ${{ inputs.config }}
|
||||||
IN_CTU: ${{ inputs.ctu }}
|
IN_CTU: ${{ inputs.ctu }}
|
||||||
IN_FLAGS: ${{ inputs.analyze-options }}
|
IN_FLAGS: ${{ inputs.analyze-options }}
|
||||||
|
IN_IGNORE_CRASHES: ${{ inputs.ignore-analyze-crashes }}
|
||||||
IN_OUTPUT_DIR: ${{ inputs.analyze-output }}
|
IN_OUTPUT_DIR: ${{ inputs.analyze-output }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ${{ github.action_path }}/src/execute-analysis.sh
|
run: ${{ github.action_path }}/src/execute-analysis.sh
|
||||||
|
|||||||
@@ -33,17 +33,21 @@ echo "::endgroup::"
|
|||||||
|| true
|
|| true
|
||||||
|
|
||||||
echo "::group::Executing Static Analysis"
|
echo "::group::Executing Static Analysis"
|
||||||
# Note: Ignoring the result of the analyze command in CTU mode, as we do not
|
|
||||||
# wish to break the build on a CTU failure.
|
|
||||||
"$CODECHECKER_PATH"/CodeChecker analyze \
|
"$CODECHECKER_PATH"/CodeChecker analyze \
|
||||||
"$COMPILATION_DATABASE" \
|
"$COMPILATION_DATABASE" \
|
||||||
--output "$OUTPUT_DIR" \
|
--output "$OUTPUT_DIR" \
|
||||||
--jobs $(nproc) \
|
--jobs $(nproc) \
|
||||||
$CONFIG_FLAG_1 $CONFIG_FLAG_2 \
|
$CONFIG_FLAG_1 $CONFIG_FLAG_2 \
|
||||||
$CTU_FLAGS \
|
$CTU_FLAGS
|
||||||
|| [[ "$IN_CTU" == "true" ]]
|
|
||||||
EXIT_CODE=$?
|
EXIT_CODE=$?
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
if [[ $EXIT_CODE -ne 0 && "$IN_IGNORE_CRASHES" == "true" ]]; then
|
||||||
|
# In general it is a good idea not to destroy the entire job just because a
|
||||||
|
# few translation units failed. Crashes are, unfortunately, usual.
|
||||||
|
echo "::warning title=Static Analysis crashed on some inputs::Some of the analysis actions failed to conclude due to internal error in the analyser."
|
||||||
|
EXIT_CODE=0
|
||||||
|
fi
|
||||||
|
|
||||||
echo "::set-output name=OUTPUT_DIR::$OUTPUT_DIR"
|
echo "::set-output name=OUTPUT_DIR::$OUTPUT_DIR"
|
||||||
exit $EXIT_CODE
|
exit $EXIT_CODE
|
||||||
|
|||||||
Reference in New Issue
Block a user