From d3482182690372b8acfbbde8eeccc1e1d078568d Mon Sep 17 00:00:00 2001 From: Elssky <1914127671@qq.com> Date: Tue, 8 Oct 2024 18:11:00 +0800 Subject: [PATCH 1/2] fix(c++,spark): clean the output directory before running unit test --- cpp/CMakeLists.txt | 68 ++++++++++++++++++++++++++++++++++++++++++++++ pyspark/Makefile | 6 ++++ 2 files changed, 74 insertions(+) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index d162392b8..608d2b677 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -177,6 +177,74 @@ macro(install_graphar_target target) ) endmacro() +# ------------------------------------------------------------------------------ +# clean output data +# ------------------------------------------------------------------------------ +add_custom_target(clean_data + COMMAND ${CMAKE_COMMAND} -E remove_directory /tmp/vertex + COMMAND ${CMAKE_COMMAND} -E remove_directory /tmp/edge + COMMAND ${CMAKE_COMMAND} -E remove_directory /tmp/ldbc +) + +# ------------------------------------------------------------------------------ +# clean target and data +# ------------------------------------------------------------------------------ +add_custom_target(clean_all + COMMAND ${CMAKE_COMMAND} clean + COMMAND ${CMAKE_COMMAND} clean_data +) + +# ------------------------------------------------------------------------------ +# building or find third party library +# ------------------------------------------------------------------------------ +# check if arrow is installed +find_package(Arrow QUIET) +if (NOT ${Arrow_FOUND}) + message(FATAL_ERROR "apache-arrow is required, please install it and retry") +endif() +find_package(ArrowDataset QUIET) +if (NOT ${ArrowDataset_FOUND}) + message(FATAL_ERROR "apache-arrow-dataset is required, please install it and retry") +endif() +if (${Arrow_VERSION} VERSION_GREATER_EQUAL "12.0.0") + # ArrowAcero is available in Arrow 12.0.0 and later + find_package(ArrowAcero QUIET) + if (NOT ${ArrowAcero_FOUND}) + message(FATAL_ERROR "apache-arrow-acero is required, please install it and retry") + endif() +endif() +# Check if ORC is enabled. +if (NOT ${ARROW_ORC}) + message(WARNING "apache-arrow is built without ORC extension, ORC related functionalities will be disabled.") +else() + add_definitions(-DARROW_ORC) # Add macro, otherwise inconsistent in build phase on ubuntu. +endif() + +find_package(Parquet QUIET) +if (NOT ${Parquet_FOUND}) + message(FATAL_ERROR "parquet is required, please install it and retry") +endif() + +find_package(Protobuf REQUIRED) +include_directories(${PROTOBUF_INCLUDE_DIRS}) + +macro(get_target_location var target) + if(TARGET ${target}) + foreach(prop LOCATION LOCATION_NOCONFIG LOCATION_DEBUG LOCATION_RELEASE) + get_target_property(${var} ${target} ${prop}) + if(NOT ("${${var}}" STREQUAL "${var}-NOTFOUND")) + break () + endif() + endforeach() + endif() +endmacro() + +include_directories(${CMAKE_CURRENT_BINARY_DIR}/src) +include_directories(src) + +# ------------------------------------------------------------------------------ +# generate graphar library +# ------------------------------------------------------------------------------ macro(build_graphar) file(GLOB_RECURSE CORE_SRC_FILES "src/graphar/*.cc" ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/mini-yaml/yaml/*.cpp) if(GRAPHAR_BUILD_STATIC) diff --git a/pyspark/Makefile b/pyspark/Makefile index 7e709be6b..09d199032 100644 --- a/pyspark/Makefile +++ b/pyspark/Makefile @@ -17,6 +17,7 @@ .PHONY: install_test install_test: + make clean export JAVA_HOME=${JAVA_HOME_11_X64} cd ../maven-projects/spark && mvn --no-transfer-progress clean package -DskipTests -Dspotless.check.skip=true && cd ../../pyspark export PYSPARK_HADOOP_VERSION=3.3 @@ -24,6 +25,7 @@ install_test: .PHONY: test test: + make clean export JAVA_HOME=${JAVA_HOME_11_X64} export SPARK_TESTING=1 poetry run pytest --cov @@ -53,3 +55,7 @@ install_docs: .PHONY: docs docs: poetry run pdoc -t ./template --output-dir ./docs graphar_pyspark + +.PHONY: clean +clean: + rm -rf /tmp/vertex /tmp/edge /tmp/ldbc || true \ No newline at end of file From e600039cfb8b0c0e58d136d4bdfc0804613c7561 Mon Sep 17 00:00:00 2001 From: Elssky <1914127671@qq.com> Date: Thu, 17 Oct 2024 11:54:55 +0800 Subject: [PATCH 2/2] feat(CI): upload static link library as artifact --- .github/workflows/ci.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34ec752cb..6395bf320 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -177,6 +177,12 @@ jobs: ctest --output-on-failure popd + - name: Upload libgraphar.a artifact + uses: actions/upload-artifact@v3 + with: + name: ubuntu-libgraphar + path: cpp/build-static/libgraphar.a + macos: name: ${{ matrix.architecture }} macOS ${{ matrix.macos-version }} C++ runs-on: macos-${{ matrix.macos-version }} @@ -226,4 +232,10 @@ jobs: export ASAN_OPTIONS=detect_leaks=0 export ASAN_OPTIONS=detect_container_overflow=0 ctest --output-on-failure - popd \ No newline at end of file + popd + + - name: Upload libgraphar.a artifact + uses: actions/upload-artifact@v3 + with: + name: macos-libgraphar + path: cpp/build-static/libgraphar.a \ No newline at end of file