Use AdressSantizer build when cpp files changed (#21809)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/21782/head
congqixia 2023-01-19 13:43:44 +08:00 committed by GitHub
parent e96af4e516
commit 66feb295da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 6 deletions

View File

@ -46,6 +46,26 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Check Changed files'
id: changed-files-cpp
uses: tj-actions/changed-files@v35
with:
since_last_remote_commit: 'true'
files: |
**/*.cpp
**/*.cc
**/*.c
**/*.h
**/*.hpp
**/*.CMakeLists.txt
**/conanfiles.*
- name: 'Setup Use USE_ASAN'
if: steps.changed-files-cpp.outputs.any_changed == 'true'
run: |
echo "useasan=true" >> $GITHUB_ENV
echo "Setup USE_ASAN to true since cpp file(s) changed"
- name: 'Generate CCache Hash'
env:
CORE_HASH: ${{ hashFiles( 'internal/core/**/*.cpp', 'internal/core/**/*.cc', 'internal/core/**/*.c', 'internal/core/**/*.h', 'internal/core/**/*.hpp', 'internal/core/**/CMakeLists.txt') }}
@ -76,7 +96,7 @@ jobs:
docker-compose up -d pulsar etcd minio
- name: Build and UnitTest
run: |
./build/builder.sh /bin/bash -c "make ci-ut"
./build/builder.sh /bin/bash -c "make USE_ASAN={{env.useasan}} ci-ut"
- name: Get the status & restart count for containers when ut failed
if: ${{ failure() }}
run: |

View File

@ -150,7 +150,7 @@ build-cpp-with-unittest: download-milvus-proto
build-cpp-with-coverage: download-milvus-proto
@echo "Building Milvus cpp library with coverage and unittest ..."
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -u -a -c -f "$(CUSTOM_THIRDPARTY_PATH)" -n ${disk_index})
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -u -a ${USE_ASAN} -c -f "$(CUSTOM_THIRDPARTY_PATH)" -n ${disk_index})
# Run the tests.

View File

@ -59,7 +59,7 @@ EMBEDDED_MILVUS="OFF"
BUILD_DISK_ANN="OFF"
USE_ASAN="OFF"
while getopts "p:d:t:s:f:n:ulrcghzmeba" arg; do
while getopts "p:d:t:s:f:n:a:ulrcghzmeb" arg; do
case $arg in
f)
CUSTOM_THIRDPARTY_PATH=$OPTARG
@ -107,8 +107,12 @@ while getopts "p:d:t:s:f:n:ulrcghzmeba" arg; do
BUILD_DISK_ANN=$OPTARG
;;
a)
USE_ASAN="ON"
BUILD_TYPE=Debug
ENV_VAL=$OPTARG
if [[ ${ENV_VAL} == 'true' ]]; then
echo "Set USE_ASAN to ON"
USE_ASAN="ON"
BUILD_TYPE=Debug
fi
;;
h) # help
echo "
@ -127,7 +131,7 @@ parameter:
-e: build without prometheus(default: OFF)
-s: build with CUDA arch(default:DEFAULT), for example '-gencode=compute_61,code=sm_61;-gencode=compute_75,code=sm_75'
-b: build embedded milvus(default: OFF)
-a: build milvus with AddressSanitizer
-a: build milvus with AddressSanitizer(default: false)
-h: help
usage: