Skip to content

Commit

Permalink
fix ci && upload artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
cyjseagull committed Aug 22, 2024
1 parent e5b27b7 commit be80442
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 13 deletions.
94 changes: 91 additions & 3 deletions .github/workflows/cpp_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ 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:
Expand Down Expand Up @@ -112,7 +115,7 @@ jobs:
- name: Build for windows
if: runner.os == 'Windows'
run: |
mkdir -p build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DTESTS=OFF -DBUILD_SDK=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake ../
mkdir -p cpp/build && cd cpp/build && cmake -DCMAKE_BUILD_TYPE=Release -DTESTS=OFF -DBUILD_SDK=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake ../
cmake --build . --parallel 3
- name: Build for linux
if: runner.os == 'Linux'
Expand All @@ -132,5 +135,90 @@ jobs:
- name: Test
if: runner.os != 'Windows'
run: |
cd cpp/build && CTEST_OUTPUT_ON_FAILURE=TRUE ctest
make cov
cd cpp/build && CTEST_OUTPUT_ON_FAILURE=TRUE make test
make cov
- uses: actions/upload-artifact@v2
if: runner.os == 'macos'
with:
name: libppc-crypto-sdk-jni.dylib
path: ./cpp/ppc-crypto-c-sdk/bindings/java/src/main/resources/META-INF/native/libppc-crypto-sdk-jni.dylib
- uses: actions/upload-artifact@v2
if: runner.os == 'Windows'
with:
name: libppc-crypto-sdk-jni.dylib
path: D:\a\WeDPR-Component\cpp\ppc-crypto-c-sdk\bindings\java\src\main\resources\META-INF\native\Release\ppc-crypto-sdk-jni.dll

build_centos:
name: build_centos full node
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
container: docker.io/centos:7
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 5
- uses: actions/cache@v2
id: deps_cache
with:
path: |
/home/runner/.ccache
/Users/runner/.ccache/
deps/
key: centos-notest-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
restore-keys: |
centos-notest-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
centos-notest-${{ matrix.os }}-${{ github.base_ref }}-
centos-notest-${{ matrix.os }}-
- name: Prepare centos tools
run: |
sed -i s/mirror.centos.org/vault.centos.org/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
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 devtoolset-10 devtoolset-11 llvm-toolset-7 rh-perl530-perl cmake3 zlib-devel ccache lcov python-devel python3-devel
yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
yum install -y git
- name: Prepare vcpkg
if: runner.os != 'Windows'
uses: friendlyanon/setup-vcpkg@v1
with: { committish: 7e3dcf74e37034eea358934a90a11d618520e139 }
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-07-28
override: true
- name: Build
run: |
alias cmake='cmake3'
. /opt/rh/devtoolset-10/enable
. /opt/rh/rh-perl530/enable
export LIBCLANG_PATH=/opt/rh/llvm-toolset-7/root/lib64/
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
. /opt/rh/llvm-toolset-7/enable
mkdir -p cpp/build
cd cpp/build
cmake3 -DCMAKE_BUILD_TYPE=Release -DTESTS=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/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@v2
with:
name: ppc-air-node-centos-x64
path: ./cpp/build/bin/ppc-air-node
- uses: actions/upload-artifact@v2
with:
name: ppc-pro-node-centos-x64
path: ./cpp/build/bin/ppc-pro-node
- uses: actions/upload-artifact@v2
with:
name: ppc-gateway-service-centos-x64
path: ./cpp/build/bin/ppc-gateway-service
- uses: actions/upload-artifact@v2
with:
name: libppc-crypto-sdk-jni.so
path: ./cpp/ppc-crypto-c-sdk/bindings/java/src/main/resources/META-INF/native/libppc-crypto-sdk-jni.so
31 changes: 31 additions & 0 deletions cpp/cmake/Coverage.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# ------------------------------------------------------------------------------
# Copyright (C) 2021 FISCO BCOS.
# SPDX-License-Identifier: Apache-2.0
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ------------------------------------------------------------------------------
# File: Coverage.cmake
# Function: Define coverage related functions
# ------------------------------------------------------------------------------
# REMOVE_FILE_PATTERN eg.:
function(config_coverage TARGET REMOVE_FILE_PATTERN)
find_program(LCOV_TOOL lcov)
message(STATUS "lcov tool: ${LCOV_TOOL}")
if (LCOV_TOOL)
add_custom_target(${TARGET}
COMMAND ${LCOV_TOOL} -o ${CMAKE_BINARY_DIR}/coverage.info.in -c -d ${CMAKE_BINARY_DIR}/
COMMAND ${LCOV_TOOL} -r ${CMAKE_BINARY_DIR}/coverage.info.in ${REMOVE_FILE_PATTERN} -o ${CMAKE_BINARY_DIR}/coverage.info
COMMAND genhtml -q -o ${CMAKE_BINARY_DIR}/CodeCoverage ${CMAKE_BINARY_DIR}/coverage.info)
else ()
message(FATAL_ERROR "Can't find lcov tool. Please install lcov")
endif()
endfunction()
12 changes: 5 additions & 7 deletions cpp/cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ endif()
##### the full-dependencies end #####

##### the sdk-dependencies #####
if(BUILD_SDK)
# find JNI
set(JAVA_AWT_LIBRARY NotNeeded)
set(JAVA_JVM_LIBRARY NotNeeded)
find_package(JNI REQUIRED)
include_directories(${JNI_INCLUDE_DIRS})
endif()
# find JNI
set(JAVA_AWT_LIBRARY NotNeeded)
set(JAVA_JVM_LIBRARY NotNeeded)
find_package(JNI REQUIRED)
include_directories(${JNI_INCLUDE_DIRS})
##### the sdk-dependencies end#####
3 changes: 2 additions & 1 deletion cpp/cmake/Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ macro(configure_project)
# cpp_features
if(ENABLE_CPU_FEATURES)
list(APPEND VCPKG_MANIFEST_FEATURES "cpufeatures")
message("##### append cpp_features: ${VCPKG_MANIFEST_FEATURES}")
endif()
####### options settings ######
print_config("WeDPR-Component")
Expand All @@ -154,6 +153,8 @@ macro(print_config NAME)
message("-- CMake Cmake version and location ${CMAKE_VERSION} (${CMAKE_COMMAND})")
message("-- Compiler C++ compiler version ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
message("-- CMAKE_BUILD_TYPE Build type ${CMAKE_BUILD_TYPE}")
message("-- VCPKG_MANIFEST_FEATURES VCPKG manifest features ${VCPKG_MANIFEST_FEATURES}")
message("-- CMAKE_TOOLCHAIN_FILE Cmake toolchain file ${CMAKE_TOOLCHAIN_FILE}")
message("-- TARGET_PLATFORM Target platform ${CMAKE_SYSTEM_NAME} ${ARCHITECTURE}")
message("-- BUILD_STATIC Build static ${BUILD_STATIC}")
message("-- COVERAGE Build code coverage ${COVERAGE}")
Expand Down
3 changes: 1 addition & 2 deletions cpp/ppc-crypto-c-sdk/bindings/java/src/main/c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ target_link_libraries(${PPC_CRYPTO_SDK_JNI_STATIC_TARGET} PUBLIC ${PPC_CRYPTO_C_
SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../resources/META-INF/native/)

message(STATUS "CMAKE_INSTALL_INCLUDEDIR => ${CMAKE_INSTALL_INCLUDEDIR}")
message(STATUS "CMAKE_CURRENT_SOURCE_DIR => ${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "LIB_DIR_PATH => ${CMAKE_CURRENT_SOURCE_DIR}/../resources/META-INF/native/")
message(STATUS "CMAKE_CURRENT_SOURCE_DIR => ${CMAKE_CURRENT_SOURCE_DIR}")

0 comments on commit be80442

Please sign in to comment.