From 6ce0e4402cf29c712efe6b413f4e59b3078ce40a Mon Sep 17 00:00:00 2001 From: Deda Date: Sun, 25 Feb 2024 22:06:11 +0100 Subject: [PATCH] Test code analysis and benchmark fixes --- .github/workflows/testflow.yml | 15 +++++++-------- release/package/run2.sh | 4 ++-- tests/code_analysis/clang_tidy.sh | 14 ++++---------- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/.github/workflows/testflow.yml b/.github/workflows/testflow.yml index a72cc7e25..ab820f9af 100644 --- a/.github/workflows/testflow.yml +++ b/.github/workflows/testflow.yml @@ -4,14 +4,13 @@ concurrency: cancel-in-progress: true on: - # UNCOMMENT THIS BEFORE MERGE - # pull_request: - # paths-ignore: - # - "docs/**" - # - "**/*.md" - # - ".clang-format" - # - "CODEOWNERS" - # - "licenses/*" + pull_request: + paths-ignore: + - "docs/**" + - "**/*.md" + - ".clang-format" + - "CODEOWNERS" + - "licenses/*" jobs: community_build: diff --git a/release/package/run2.sh b/release/package/run2.sh index 3741bb685..433d08bb2 100755 --- a/release/package/run2.sh +++ b/release/package/run2.sh @@ -363,7 +363,7 @@ test_memgraph() { upload-to-bench-graph) shift 1 local setup_ve3_env="virtualenv -p python3 ve3 && source ve3/bin/activate && pip install -r requirements.txt" - docker exec -u mg $build_container bash -c "$EXPORT_LICENSE && $EXPORT_ORG_NAME && cd $MGBUILD_ROOT_DIR/tools/bench-graph-client && $setup_ve3_env && ./main.py $@" + docker exec -u mg $build_container bash -c "$EXPORT_LICENSE && $EXPORT_ORG_NAME && cd $MGBUILD_ROOT_DIR/tools/bench-graph-client && $setup_ve3_env "'&& ./main.py $@' ;; code-analysis) shift 1 @@ -377,7 +377,7 @@ test_memgraph() { ;; clang-tidy) shift 1 - docker exec -u mg $build_container bash -c "$EXPORT_LICENSE && $EXPORT_ORG_NAME && export THREADS=$threads && $ACTIVATE_TOOLCHAIN && cd $MGBUILD_ROOT_DIR/tests/code_analysis && ./clang_tidy.sh $@" + docker exec -u mg $build_container bash -c "$EXPORT_LICENSE && $EXPORT_ORG_NAME && export THREADS=$threads && $ACTIVATE_TOOLCHAIN && cd $MGBUILD_ROOT_DIR/tests/code_analysis "'&& ./clang_tidy.sh $@' ;; *) echo "Error: Unknown test '$1'" diff --git a/tests/code_analysis/clang_tidy.sh b/tests/code_analysis/clang_tidy.sh index 816f6e6be..f8bdfc252 100755 --- a/tests/code_analysis/clang_tidy.sh +++ b/tests/code_analysis/clang_tidy.sh @@ -4,26 +4,20 @@ PROJECT_ROOT="$SCRIPT_DIR/../.." BASE_BRANCH="origin/master" THREADS=${THREADS:-$(nproc)} -if [[ "$#" -ne 1 ]]; then - echo "Error: This script requires exactly 1 argument '--base-branch string', not $#" - exit 1 -fi - -while [[ "$#" -gt 0 ]]; do +if [[ "$#" -gt 0 ]]; then case "$1" in --base-branch) BASE_BRANCH=$2 - shift 2 ;; *) echo "Error: Unknown flag '$1'" - shift 2 + exit 1 ;; esac -done +fi cd $PROJECT_ROOT -git diff -U0 $BASE_BRANCH ... -- src | ./tools/github/clang-tidy/clang-tidy-diff.py -p 1 -j $THREADS -path build -regex ".+\.cpp" | tee ./build/clang_tidy_output.txt +git diff -U0 $BASE_BRANCH... -- src | ./tools/github/clang-tidy/clang-tidy-diff.py -p 1 -j $THREADS -path build -regex ".+\.cpp" | tee ./build/clang_tidy_output.txt # Fail if any warning is reported ! cat ./build/clang_tidy_output.txt | ./tools/github/clang-tidy/grep_error_lines.sh > /dev/null cd $SCRIPT_DIR