onnxruntime/tools/ci_build/github/azure-pipelines/mac-objc-static-analysis-ci-pipeline.yml
Edward Chen b75c1081ca
[Objective-C] Enable static analysis, second try (#8875)
The previous attempt to enable static analysis (#8842) didn't actually run the static analysis checks.

- Run clang-tidy directly.
- Address static analysis warnings.
2021-08-30 10:43:45 -07:00

39 lines
1.2 KiB
YAML

jobs:
- job: ObjCStaticAnalysis
pool:
vmImage: 'macOS-10.15'
timeoutInMinutes: 60
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: "3.9"
addToPath: true
architecture: "x64"
- script: |
pip install -r tools/ci_build/github/apple/objectivec/static_analysis/requirements.txt
displayName: Install tools
- script: |
python tools/ci_build/build.py \
--build_dir "$(Build.BinariesDirectory)" \
--cmake_generator "Ninja" \
--config Debug \
--build_shared_lib --use_coreml --build_objc \
--cmake_extra_defines CMAKE_EXPORT_COMPILE_COMMANDS=ON \
--update \
--build --parallel
displayName: Generate compile_commands.json
- script: |
"$(brew --prefix llvm)/bin/clang-tidy" \
-p="$(Build.BinariesDirectory)/Debug" \
--checks="-*,clang-analyzer-*" \
--header-filter="objectivec/include|objectivec/src|onnxruntime/core" \
./objectivec/src/*.mm \
./onnxruntime/core/platform/apple/logging/apple_log_sink.mm \
./onnxruntime/core/providers/coreml/model/*.mm
displayName: Analyze Objective-C/C++ source code