From 3bdc3b740d8181cc16231bd518d772cb953bcfef Mon Sep 17 00:00:00 2001 From: cyjseagull Date: Wed, 23 Oct 2024 20:46:06 +0800 Subject: [PATCH] refactor workflow --- .github/workflows/cpp_full_node_workflow.yml | 155 +++++++++ .github/workflows/cpp_sdk_workflow.yml | 156 +++++++++ .github/workflows/cpp_toolkit_workflow.yml | 147 +++++++++ .github/workflows/cpp_workflow.yml | 304 ------------------ cpp/wedpr-protocol/grpc/CMakeLists.txt | 2 +- .../ppc-front/ppc-front/CallbackManager.cpp | 4 + 6 files changed, 463 insertions(+), 305 deletions(-) create mode 100644 .github/workflows/cpp_full_node_workflow.yml create mode 100644 .github/workflows/cpp_sdk_workflow.yml create mode 100644 .github/workflows/cpp_toolkit_workflow.yml delete mode 100644 .github/workflows/cpp_workflow.yml diff --git a/.github/workflows/cpp_full_node_workflow.yml b/.github/workflows/cpp_full_node_workflow.yml new file mode 100644 index 00000000..da66033b --- /dev/null +++ b/.github/workflows/cpp_full_node_workflow.yml @@ -0,0 +1,155 @@ +name: WeDPR-Component ci for full node +on: + push: + paths-ignore: + - "docs/**" + - "Changelog.md" + - "README.md" + pull_request: + paths-ignore: + - "docs/**" + - "Changelog.md" + - "README.md" + release: + types: [published, push] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + RUST_BACKTRACE: 1 + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + +jobs: + build: + name: build all + runs-on: ${{ matrix.os }} + continue-on-error: true + strategy: + fail-fast: false + matrix: + os: [macos-12, ubuntu-20.04] + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 5 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2022-07-28 + override: true + - name: Prepare vcpkg + if: runner.os != 'Windows' + uses: friendlyanon/setup-vcpkg@v1 + with: { committish: 51b14cd4e1230dd51c11ffeff6f7d53c61cc5297 } + - uses: actions/cache@v2 + id: deps_cache + with: + path: | + deps/ + c:/vcpkg + !c:/vcpkg/.git + !c:/vcpkg/buildtrees + !c:/vcpkg/packages + !c:/vcpkg/downloads + key: build-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + restore-keys: | + build-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + build-all-${{ matrix.os }}-${{ github.base_ref }}- + build-all-${{ matrix.os }}- + - name: Build for linux + if: runner.os == 'Linux' + run: | + sudo apt install -y lcov ccache wget libgmp-dev python3-dev + export GCC='gcc-10' + export CXX='g++-10' + bash cpp/tools/install_depends.sh -o ubuntu + mkdir -p cpp/build && cd cpp/build && cmake -DTESTS=ON -DCOVERAGE=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ + - name: Build for macOS + if: runner.os == 'macOS' + run: | + bash cpp/tools/install_depends.sh -o macos + mkdir -p cpp/build && cd cpp/build && cmake -DTESTS=ON -DCOVERAGE=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ + make -j3 + - name: Test + if: runner.os != 'Windows' + run: | + cd cpp/build && CTEST_OUTPUT_ON_FAILURE=TRUE ctest + + build_centos: + name: build_centos full node + runs-on: ${{ matrix.os }} + continue-on-error: true + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + container: + image: docker.io/centos:7 + volumes: + - /usr/local/share/vcpkg:/usr/local/share/vcpkg + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 5 + - uses: actions/cache@v3 + id: deps_cache + with: + path: | + deps/ + /usr/local/share/vcpkg/buildtrees + /usr/local/share/vcpkg/packages + /home/runner/.ccache + /Users/runner/.ccache/ + key: centos-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + restore-keys: | + centos-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + centos-notest-all-${{ matrix.os }}-${{ github.base_ref }}- + centos-notest-all-${{ matrix.os }}- + - name: Prepare centos tools + run: | + rpm -ivh https://cbs.centos.org/kojifiles/packages/centos-release-scl-rh/2/3.el7.centos/noarch/centos-release-scl-rh-2-3.el7.centos.noarch.rpm + rpm -ivh https://cbs.centos.org/kojifiles/packages/centos-release-scl/2/3.el7.centos/noarch/centos-release-scl-2-3.el7.centos.noarch.rpm + sed -i s/mirror.centos.org/mirrors.aliyun.com/g /etc/yum.repos.d/*.repo + sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo + sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo + cat /etc/yum.repos.d/*.repo + yum clean all + yum makecache + yum update -y + yum install -y epel-release centos-release-scl centos-release-scl-rh + yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm + yum install -y java-11-openjdk-devel git make gcc gcc-c++ glibc-static glibc-devel openssl cmake3 ccache devtoolset-11 llvm-toolset-7.0 rh-perl530-perl libzstd-devel zlib-devel flex bison python-devel python3-devel + yum install -y rh-perl530-perl cmake3 zlib-devel ccache lcov python-devel python3-devel + yum install -y git + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2022-07-28 + override: true + - name: Build + run: | + alias cmake='cmake3' + . /opt/rh/devtoolset-11/enable + mkdir -p cpp/build + cd cpp/build + cmake3 -DCMAKE_BUILD_TYPE=Release -DTESTS=ON -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake ../ + cmake3 --build . --parallel 3 + - name: Test + run: | + export OMP_NUM_THREADS=1 + cd build && CTEST_OUTPUT_ON_FAILURE=TRUE make test + - uses: actions/upload-artifact@v4 + with: + name: ppc-air-node-centos-x64 + path: ./cpp/build/bin/ppc-air-node + - uses: actions/upload-artifact@v4 + with: + name: ppc-pro-node-centos-x64 + path: ./cpp/build/bin/ppc-pro-node + - uses: actions/upload-artifact@v4 + with: + name: ppc-gateway-service-centos-x64 + path: ./cpp/build/bin/ppc-gateway-service + - uses: actions/upload-artifact@v4 + with: + name: libppc-crypto-sdk-jni.so + path: ./cpp/wedpr-component-sdk/bindings/java/src/main/resources/META-INF/native/libppc-crypto-sdk-jni.so diff --git a/.github/workflows/cpp_sdk_workflow.yml b/.github/workflows/cpp_sdk_workflow.yml new file mode 100644 index 00000000..38da3106 --- /dev/null +++ b/.github/workflows/cpp_sdk_workflow.yml @@ -0,0 +1,156 @@ +name: WeDPR-Component ci for cpp-sdk +on: + push: + paths-ignore: + - "docs/**" + - "Changelog.md" + - "README.md" + pull_request: + paths-ignore: + - "docs/**" + - "Changelog.md" + - "README.md" + release: + types: [published, push] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + RUST_BACKTRACE: 1 + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + +jobs: + build_sdk: + name: build sdk + runs-on: ${{ matrix.os }} + continue-on-error: true + strategy: + fail-fast: false + matrix: + os: [ubuntu-22.04, windows-2019, macos-12] + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 5 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2022-07-28 + override: true + - name: Prepare vcpkg + if: runner.os != 'Windows' + uses: friendlyanon/setup-vcpkg@v1 + with: { committish: 51b14cd4e1230dd51c11ffeff6f7d53c61cc5297 } + - uses: actions/cache@v2 + id: deps_cache + with: + path: | + deps/ + ${{ env.VCPKG_ROOT }} + ${{ env.VCPKG_ROOT }}/.git + ${{ env.VCPKG_ROOT }}/buildtrees + ${{ env.VCPKG_ROOT }}/packages + ${{ env.VCPKG_ROOT }}/downloads + key: build-sdk-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + restore-keys: | + build-sdk-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + build-sdk-${{ matrix.os }}-${{ github.base_ref }}- + build-sdk-${{ matrix.os }}- + - name: Add MSbuild to PATH + if: runner.os == 'Windows' + uses: microsoft/setup-msbuild@v1.1 + - name: Build for windows + if: runner.os == 'Windows' + run: | + mkdir -p cpp/build && cd cpp/build && cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release -DTESTS=OFF -DBUILD_SDK=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake .. + MSBuild /version + MSBuild WeDPR-Component.sln /p:Configuration=Release /p:Platform=x64 + - name: Build for linux + if: runner.os == 'Linux' + run: | + sudo apt install -y lcov ccache wget libgmp-dev python3-dev + export GCC='gcc-10' + export CXX='g++-10' + bash cpp/tools/install_depends.sh -o ubuntu + mkdir -p cpp/build && cd cpp/build && cmake -DTESTS=ON -DCOVERAGE=ON -DBUILD_SDK=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ + make -j3 + - name: Build for macos + if: runner.os == 'macOS' + run: | + brew install lcov + bash cpp/tools/install_depends.sh -o macos + mkdir -p cpp/build && cd cpp/build && cmake -DTESTS=ON -DCOVERAGE=OFF -DBUILD_SDK=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ + make -j3 + - name: Test + if: runner.os == 'macOS' + run: | + cd cpp/build && CTEST_OUTPUT_ON_FAILURE=TRUE make test + - name: Test and upload coverage + if: runner.os == 'Linux' + run: | + cd cpp/build && CTEST_OUTPUT_ON_FAILURE=TRUE make test + - uses: actions/upload-artifact@v4 + if: runner.os == 'macos' + with: + name: libppc-crypto-sdk-jni.dylib + path: ./cpp/wedpr-component-sdk/bindings/java/src/main/resources/META-INF/native/libppc-crypto-sdk-jni.dylib + - uses: actions/upload-artifact@v4 + if: runner.os == 'Windows' + with: + name: libppc-crypto-sdk-jni.dll + path: D:\a\WeDPR-Component\cpp\wedpr-component-sdk\bindings\java\src\main\resources\META-INF\native\Release\ppc-crypto-sdk-jni.dll + +build_centos_for_sdk: + name: build_centos_for_sdk + runs-on: ${{ matrix.os }} + continue-on-error: true + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + container: + image: docker.io/centos:7 + volumes: + - /usr/local/share/vcpkg:/usr/local/share/vcpkg + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 5 + - uses: actions/cache@v3 + id: deps_cache + with: + path: | + deps/ + /usr/local/share/vcpkg/buildtrees + /usr/local/share/vcpkg/packages + /home/runner/.ccache + /Users/runner/.ccache/ + key: centos-sdk-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + restore-keys: | + centos-sdk-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + centos-sdk-notest-all-${{ matrix.os }}-${{ github.base_ref }}- + centos-sdk-notest-all-${{ matrix.os }}- + - name: Prepare centos tools + run: | + rpm -ivh https://cbs.centos.org/kojifiles/packages/centos-release-scl-rh/2/3.el7.centos/noarch/centos-release-scl-rh-2-3.el7.centos.noarch.rpm + rpm -ivh https://cbs.centos.org/kojifiles/packages/centos-release-scl/2/3.el7.centos/noarch/centos-release-scl-2-3.el7.centos.noarch.rpm + sed -i s/mirror.centos.org/mirrors.aliyun.com/g /etc/yum.repos.d/*.repo + sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo + sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo + cat /etc/yum.repos.d/*.repo + yum clean all + yum makecache + yum update -y + yum install -y epel-release centos-release-scl centos-release-scl-rh + yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm + yum install -y java-11-openjdk-devel git make gcc gcc-c++ glibc-static glibc-devel openssl cmake3 ccache devtoolset-11 llvm-toolset-7.0 rh-perl530-perl libzstd-devel zlib-devel flex bison python-devel python3-devel + yum install -y rh-perl530-perl cmake3 zlib-devel ccache lcov python-devel python3-devel + yum install -y git + - name: Build + run: | + alias cmake='cmake3' + . /opt/rh/devtoolset-11/enable + mkdir -p cpp/build + cd cpp/build + cmake3 -DCMAKE_BUILD_TYPE=Release -DBUILD_SDK=ON -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake ../ + cmake3 --build . --parallel 3 \ No newline at end of file diff --git a/.github/workflows/cpp_toolkit_workflow.yml b/.github/workflows/cpp_toolkit_workflow.yml new file mode 100644 index 00000000..8c3d2e11 --- /dev/null +++ b/.github/workflows/cpp_toolkit_workflow.yml @@ -0,0 +1,147 @@ +name: WeDPR-Component ci for cpp-toolkit +on: + push: + paths-ignore: + - "docs/**" + - "Changelog.md" + - "README.md" + pull_request: + paths-ignore: + - "docs/**" + - "Changelog.md" + - "README.md" + release: + types: [published, push] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + RUST_BACKTRACE: 1 + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + +jobs: + build_wedpr_toolkit: + name: build wedpr toolkit + runs-on: ${{ matrix.os }} + continue-on-error: true + strategy: + fail-fast: false + matrix: + os: [ubuntu-22.04, windows-2019, macos-12] + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 5 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2022-07-28 + override: true + - name: Prepare vcpkg + if: runner.os != 'Windows' + uses: friendlyanon/setup-vcpkg@v1 + with: { committish: 51b14cd4e1230dd51c11ffeff6f7d53c61cc5297 } + - uses: actions/cache@v2 + id: deps_cache + with: + path: | + deps/ + ${{ env.VCPKG_ROOT }} + ${{ env.VCPKG_ROOT }}/.git + ${{ env.VCPKG_ROOT }}/buildtrees + ${{ env.VCPKG_ROOT }}/packages + ${{ env.VCPKG_ROOT }}/downloads + key: build-toolkit-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + restore-keys: | + build-toolkit-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + build-toolkit-${{ matrix.os }}-${{ github.base_ref }}- + build-toolkit-${{ matrix.os }}- + - name: Add MSbuild to PATH + if: runner.os == 'Windows' + uses: microsoft/setup-msbuild@v1.1 + - name: Build for windows + if: runner.os == 'Windows' + run: | + mkdir -p cpp/build && cd cpp/build && cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release -DTESTS=OFF -DBUILD_WEDPR_TOOLKIT=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake .. && MSBuild /version && MSBuild WeDPR-Component.sln /p:Configuration=Release /p:Platform=x64 + - name: Build for linux + if: runner.os == 'Linux' + run: | + sudo apt install -y lcov ccache wget libgmp-dev python3-dev + export GCC='gcc-10' + export CXX='g++-10' + bash cpp/tools/install_depends.sh -o ubuntu + mkdir -p cpp/build && cd cpp/build && cmake -DBUILD_WEDPR_TOOLKIT=ON -DBUILD_PYTHON=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ + make -j3 + - name: Build for macos + if: runner.os == 'macOS' + run: | + brew install lcov + bash cpp/tools/install_depends.sh -o macos + mkdir -p cpp/build && cd cpp/build && cmake -DBUILD_WEDPR_TOOLKIT=ON -DBUILD_PYTHON=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ + make -j3 + - uses: actions/upload-artifact@v4 + if: runner.os == 'macos' + with: + name: libwedpr_java_transport_jni.dylib + path: ./cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/resources/META-INF/native/libwedpr_java_transport_jni.dylib + - uses: actions/upload-artifact@v4 + if: runner.os == 'Windows' + with: + name: libwedpr_java_transport_jni.dll + path: D:\a\WeDPR-Component\cpp\wedpr-transport\sdk-wrapper\java\bindings\src\main\resources\META-INF\native\Release\libwedpr_java_transport_jni.dll + + +build_centos_for_toolkit: + name: build_centos_for_toolkit + runs-on: ${{ matrix.os }} + continue-on-error: true + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + container: + image: docker.io/centos:7 + volumes: + - /usr/local/share/vcpkg:/usr/local/share/vcpkg + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 5 + - uses: actions/cache@v3 + id: deps_cache + with: + path: | + deps/ + /usr/local/share/vcpkg/buildtrees + /usr/local/share/vcpkg/packages + /home/runner/.ccache + /Users/runner/.ccache/ + key: centos-toolkit-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + restore-keys: | + centos-toolkit-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + centos-toolkit-notest-all-${{ matrix.os }}-${{ github.base_ref }}- + centos-toolkit-notest-all-${{ matrix.os }}- + - name: Prepare centos tools + run: | + rpm -ivh https://cbs.centos.org/kojifiles/packages/centos-release-scl-rh/2/3.el7.centos/noarch/centos-release-scl-rh-2-3.el7.centos.noarch.rpm + rpm -ivh https://cbs.centos.org/kojifiles/packages/centos-release-scl/2/3.el7.centos/noarch/centos-release-scl-2-3.el7.centos.noarch.rpm + sed -i s/mirror.centos.org/mirrors.aliyun.com/g /etc/yum.repos.d/*.repo + sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo + sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo + cat /etc/yum.repos.d/*.repo + yum clean all + yum makecache + yum update -y + yum install -y epel-release centos-release-scl centos-release-scl-rh + yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm + yum install -y java-11-openjdk-devel git make gcc gcc-c++ glibc-static glibc-devel openssl cmake3 ccache devtoolset-11 llvm-toolset-7.0 rh-perl530-perl libzstd-devel zlib-devel flex bison python-devel python3-devel + yum install -y rh-perl530-perl cmake3 zlib-devel ccache lcov python-devel python3-devel + yum install -y git + - name: Build + run: | + alias cmake='cmake3' + . /opt/rh/devtoolset-11/enable + mkdir -p cpp/build + cd cpp/build + cmake3 -DCMAKE_BUILD_TYPE=Release -DBUILD_WEDPR_TOOLKIT=ON -DBUILD_PYTHON=ON -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake ../ + cmake3 --build . --parallel 3 \ No newline at end of file diff --git a/.github/workflows/cpp_workflow.yml b/.github/workflows/cpp_workflow.yml deleted file mode 100644 index 55f74b59..00000000 --- a/.github/workflows/cpp_workflow.yml +++ /dev/null @@ -1,304 +0,0 @@ -name: WeDPR-Component ci(cpp) -on: - push: - paths-ignore: - - "docs/**" - - "Changelog.md" - - "README.md" - pull_request: - paths-ignore: - - "docs/**" - - "Changelog.md" - - "README.md" - release: - types: [published, push] -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -env: - RUST_BACKTRACE: 1 - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true - -jobs: - build: - name: build all - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - os: [macos-12, ubuntu-20.04] - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 5 - - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly-2022-07-28 - override: true - - name: Prepare vcpkg - if: runner.os != 'Windows' - uses: friendlyanon/setup-vcpkg@v1 - with: { committish: 51b14cd4e1230dd51c11ffeff6f7d53c61cc5297 } - - uses: actions/cache@v2 - id: deps_cache - with: - path: | - deps/ - c:/vcpkg - !c:/vcpkg/.git - !c:/vcpkg/buildtrees - !c:/vcpkg/packages - !c:/vcpkg/downloads - key: build-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} - restore-keys: | - build-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} - build-all-${{ matrix.os }}-${{ github.base_ref }}- - build-all-${{ matrix.os }}- - - name: Build for linux - if: runner.os == 'Linux' - run: | - sudo apt install -y lcov ccache wget libgmp-dev python3-dev - export GCC='gcc-10' - export CXX='g++-10' - bash cpp/tools/install_depends.sh -o ubuntu - mkdir -p cpp/build && cd cpp/build && cmake -DTESTS=ON -DCOVERAGE=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ - - name: Build for macOS - if: runner.os == 'macOS' - run: | - bash cpp/tools/install_depends.sh -o macos - mkdir -p cpp/build && cd cpp/build && cmake -DTESTS=ON -DCOVERAGE=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ - make -j3 - - name: Test - if: runner.os != 'Windows' - run: | - cd cpp/build && CTEST_OUTPUT_ON_FAILURE=TRUE ctest - - build_sdk: - name: build sdk - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - os: [ubuntu-22.04, windows-2019, macos-12] - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 5 - - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly-2022-07-28 - override: true - - name: Prepare vcpkg - if: runner.os != 'Windows' - uses: friendlyanon/setup-vcpkg@v1 - with: { committish: 51b14cd4e1230dd51c11ffeff6f7d53c61cc5297 } - - uses: actions/cache@v2 - id: deps_cache - with: - path: | - deps/ - ${{ env.VCPKG_ROOT }} - ${{ env.VCPKG_ROOT }}/.git - ${{ env.VCPKG_ROOT }}/buildtrees - ${{ env.VCPKG_ROOT }}/packages - ${{ env.VCPKG_ROOT }}/downloads - key: build-sdk-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} - restore-keys: | - build-sdk-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} - build-sdk-${{ matrix.os }}-${{ github.base_ref }}- - build-sdk-${{ matrix.os }}- - - name: Add MSbuild to PATH - if: runner.os == 'Windows' - uses: microsoft/setup-msbuild@v1.1 - - name: Build for windows - if: runner.os == 'Windows' - run: | - mkdir -p cpp/build && cd cpp/build && cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release -DTESTS=OFF -DBUILD_SDK=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake .. - MSBuild /version - MSBuild WeDPR-Component.sln /p:Configuration=Release /p:Platform=x64 - - name: Build for linux - if: runner.os == 'Linux' - run: | - sudo apt install -y lcov ccache wget libgmp-dev python3-dev - export GCC='gcc-10' - export CXX='g++-10' - bash cpp/tools/install_depends.sh -o ubuntu - mkdir -p cpp/build && cd cpp/build && cmake -DTESTS=ON -DCOVERAGE=ON -DBUILD_SDK=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ - make -j3 - - name: Build for macos - if: runner.os == 'macOS' - run: | - brew install lcov - bash cpp/tools/install_depends.sh -o macos - mkdir -p cpp/build && cd cpp/build && cmake -DTESTS=ON -DCOVERAGE=OFF -DBUILD_SDK=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ - make -j3 - - name: Test - if: runner.os == 'macOS' - run: | - cd cpp/build && CTEST_OUTPUT_ON_FAILURE=TRUE make test - - name: Test and upload coverage - if: runner.os == 'Linux' - run: | - cd cpp/build && CTEST_OUTPUT_ON_FAILURE=TRUE make test - - uses: actions/upload-artifact@v4 - if: runner.os == 'macos' - with: - name: libppc-crypto-sdk-jni.dylib - path: ./cpp/wedpr-component-sdk/bindings/java/src/main/resources/META-INF/native/libppc-crypto-sdk-jni.dylib - - uses: actions/upload-artifact@v4 - if: runner.os == 'Windows' - with: - name: libppc-crypto-sdk-jni.dll - path: D:\a\WeDPR-Component\cpp\wedpr-component-sdk\bindings\java\src\main\resources\META-INF\native\Release\ppc-crypto-sdk-jni.dll - - build_wedpr_toolkit: - name: build wedpr toolkit - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - os: [ubuntu-22.04, windows-2019, macos-12] - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 5 - - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly-2022-07-28 - override: true - - name: Prepare vcpkg - if: runner.os != 'Windows' - uses: friendlyanon/setup-vcpkg@v1 - with: { committish: 51b14cd4e1230dd51c11ffeff6f7d53c61cc5297 } - - uses: actions/cache@v2 - id: deps_cache - with: - path: | - deps/ - ${{ env.VCPKG_ROOT }} - ${{ env.VCPKG_ROOT }}/.git - ${{ env.VCPKG_ROOT }}/buildtrees - ${{ env.VCPKG_ROOT }}/packages - ${{ env.VCPKG_ROOT }}/downloads - key: build-toolkit-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} - restore-keys: | - build-toolkit-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} - build-toolkit-${{ matrix.os }}-${{ github.base_ref }}- - build-toolkit-${{ matrix.os }}- - - name: Add MSbuild to PATH - if: runner.os == 'Windows' - uses: microsoft/setup-msbuild@v1.1 - - name: Build for windows - if: runner.os == 'Windows' - run: | - mkdir -p cpp/build && cd cpp/build && cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release -DTESTS=OFF -DBUILD_WEDPR_TOOLKIT=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake .. && MSBuild /version && MSBuild WeDPR-Component.sln /p:Configuration=Release /p:Platform=x64 - - name: Build for linux - if: runner.os == 'Linux' - run: | - sudo apt install -y lcov ccache wget libgmp-dev python3-dev - export GCC='gcc-10' - export CXX='g++-10' - bash cpp/tools/install_depends.sh -o ubuntu - mkdir -p cpp/build && cd cpp/build && cmake -DBUILD_WEDPR_TOOLKIT=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ - make -j3 - - name: Build for macos - if: runner.os == 'macOS' - run: | - brew install lcov - bash cpp/tools/install_depends.sh -o macos - mkdir -p cpp/build && cd cpp/build && cmake -DBUILD_WEDPR_TOOLKIT=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ - make -j3 - - uses: actions/upload-artifact@v4 - if: runner.os == 'macos' - with: - name: libwedpr_java_transport_jni.dylib - path: ./cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/resources/META-INF/native/libwedpr_java_transport_jni.dylib - - uses: actions/upload-artifact@v4 - if: runner.os == 'Windows' - with: - name: libwedpr_java_transport_jni.dll - path: D:\a\WeDPR-Component\cpp\wedpr-transport\sdk-wrapper\java\bindings\src\main\resources\META-INF\native\Release\libwedpr_java_transport_jni.dll - - - build_centos: - name: build_centos full node - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - container: - image: docker.io/centos:7 - volumes: - - /usr/local/share/vcpkg:/usr/local/share/vcpkg - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 5 - - uses: actions/cache@v3 - id: deps_cache - with: - path: | - deps/ - /usr/local/share/vcpkg/buildtrees - /usr/local/share/vcpkg/packages - /home/runner/.ccache - /Users/runner/.ccache/ - key: centos-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} - restore-keys: | - centos-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} - centos-notest-all-${{ matrix.os }}-${{ github.base_ref }}- - centos-notest-all-${{ matrix.os }}- - - name: Prepare centos tools - run: | - rpm -ivh https://cbs.centos.org/kojifiles/packages/centos-release-scl-rh/2/3.el7.centos/noarch/centos-release-scl-rh-2-3.el7.centos.noarch.rpm - rpm -ivh https://cbs.centos.org/kojifiles/packages/centos-release-scl/2/3.el7.centos/noarch/centos-release-scl-2-3.el7.centos.noarch.rpm - sed -i s/mirror.centos.org/mirrors.aliyun.com/g /etc/yum.repos.d/*.repo - sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo - sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo - cat /etc/yum.repos.d/*.repo - yum clean all - yum makecache - yum update -y - yum install -y epel-release centos-release-scl centos-release-scl-rh - yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm - yum install -y java-11-openjdk-devel git make gcc gcc-c++ glibc-static glibc-devel openssl cmake3 ccache devtoolset-11 llvm-toolset-7.0 rh-perl530-perl libzstd-devel zlib-devel flex bison python-devel python3-devel - yum install -y rh-perl530-perl cmake3 zlib-devel ccache lcov python-devel python3-devel - yum install -y git - - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly-2022-07-28 - override: true - - name: Build - run: | - alias cmake='cmake3' - . /opt/rh/devtoolset-11/enable - mkdir -p cpp/build - cd cpp/build - cmake3 -DCMAKE_BUILD_TYPE=Release -DTESTS=ON -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake ../ - cmake3 --build . --parallel 3 - - name: Test - run: | - export OMP_NUM_THREADS=1 - cd build && CTEST_OUTPUT_ON_FAILURE=TRUE make test - - uses: actions/upload-artifact@v4 - with: - name: ppc-air-node-centos-x64 - path: ./cpp/build/bin/ppc-air-node - - uses: actions/upload-artifact@v4 - with: - name: ppc-pro-node-centos-x64 - path: ./cpp/build/bin/ppc-pro-node - - uses: actions/upload-artifact@v4 - with: - name: ppc-gateway-service-centos-x64 - path: ./cpp/build/bin/ppc-gateway-service - - uses: actions/upload-artifact@v4 - with: - name: libppc-crypto-sdk-jni.so - path: ./cpp/wedpr-component-sdk/bindings/java/src/main/resources/META-INF/native/libppc-crypto-sdk-jni.so diff --git a/cpp/wedpr-protocol/grpc/CMakeLists.txt b/cpp/wedpr-protocol/grpc/CMakeLists.txt index 64ea4ea1..37964f8b 100644 --- a/cpp/wedpr-protocol/grpc/CMakeLists.txt +++ b/cpp/wedpr-protocol/grpc/CMakeLists.txt @@ -6,7 +6,7 @@ file(GLOB_RECURSE MESSAGES_PROTOS "${PROTO_INPUT_PATH}/Service*.proto") # create PROTO_OUTPUT_PATH file(MAKE_DIRECTORY ${PROTO_OUTPUT_PATH}) set(GRPC_CPP_PLUGIN_EXEC "grpc_cpp_plugin${PROGRAM_POSTFIX}") -find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin REQUIRED) +find_program(GRPC_CPP_PLUGIN ${GRPC_CPP_PLUGIN_EXEC} REQUIRED) find_program(PROTOC_BINARY protoc REQUIRED) foreach(proto_file ${MESSAGES_PROTOS}) diff --git a/cpp/wedpr-transport/ppc-front/ppc-front/CallbackManager.cpp b/cpp/wedpr-transport/ppc-front/ppc-front/CallbackManager.cpp index 1da25b26..e7a52fd7 100644 --- a/cpp/wedpr-transport/ppc-front/ppc-front/CallbackManager.cpp +++ b/cpp/wedpr-transport/ppc-front/ppc-front/CallbackManager.cpp @@ -176,6 +176,10 @@ void CallbackManager::onReceiveMessage(std::string const& topic, Message::Ptr ms } if (!callback) { + if (topic.empty()) + { + return; + } FRONT_LOG(TRACE) << LOG_DESC("onReceiveMessage: not find the handler, put into the buffer") << LOG_KV("topic", topic); addMsgCache(topic, msg);