Skip to content

Commit

Permalink
add changelog and ci (#3)
Browse files Browse the repository at this point in the history
* add changelog

* add workflow

* use vcpkg as submodule

* fix ut
  • Loading branch information
cyjseagull authored Aug 21, 2024
1 parent d95e5f3 commit b21a3fe
Show file tree
Hide file tree
Showing 19 changed files with 450 additions and 298 deletions.
17 changes: 17 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 120
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
75 changes: 75 additions & 0 deletions .github/workflows/cpp_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
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


jobs:
build:
name: build
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-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
restore-keys: |
build-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
build-${{ matrix.os }}-${{ github.base_ref }}-
build-${{ 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 ../
make -j3
- 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
make cov
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "cpp/vcpkg"]
path = cpp/vcpkg
url = https://github.com/microsoft/vcpkg
21 changes: 21 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### 1.0.0-rc1
(2024-08-21)

**新增**

#### 隐私计算组件

- **PSI**: 实现多种类型隐私求交集算法,包括CM2020, RA2018, ECDH-PSI, ECDH-Multi-PSI等
- **MPC**: 安全多方计算相关组件
- **MPCSQL**: 基于安全多方计算协议,支持联合分析查询任务
- **PIR**: 匿踪查询组件

#### 隐私计算互联互通

- ECDH PSI算法与隐语互联互通

#### 隐私建模组件

- 2+方的多方联合XGB组件(训练 + 离线预测)
- 2+方多方特征工程组件(特征分箱,WOE/IV计算等)
- 预处理组件
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
# WeDPR-Component
# WeDPR

![](https://wedpr-lab.readthedocs.io/zh_CN/latest/_static/images/wedpr_logo.png)


[![CodeFactor](https://www.codefactor.io/repository/github/webankblockchain/wedpr-component/badge?s=a4c3fb6ffd39e7618378fe13b6bd06c5846cc103)](https://www.codefactor.io/repository/github/webankblockchain/wedpr-component)
[![contributors](https://img.shields.io/github/contributors/WeBankBlockchain/WeDPR)](https://github.com/WeBankBlockchain/WeDPR-Component/graphs/contributors)
[![GitHub activity](https://img.shields.io/github/commit-activity/m/WeBankBlockchain/WeDPR-Component)](https://github.com/WeBankBlockchain/WeDPR-Component/pulse)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)

微众银行多方大数据隐私计算平台[WeDPR](https://github.com/WeBankBlockchain/WeDPR)核心组件库,包括:

- 丰富的隐私计算算法组件,支持隐私求交集、匿踪查询、多方联合分析(隐私SQL)、数据预处理、隐私建模和预测等能力,以满足多样化的业务场景
- 统一网关:稳定的跨机构网络通信组件,支持基于Rip协议的路由转发协议


## 技术文档

- [文档](https://wedpr-lab.readthedocs.io/zh-cn/latest/)
- [代码](https://github.com/WeBankBlockchain/WeDPR-Component)


## License

WeDPR-Component的开源协议为Apache License 2.0, 详情参见[LICENSE](LICENSE)
2 changes: 1 addition & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ include(BuildInfoGenerator)

find_package(OpenSSL REQUIRED)
include(InstallBcosUtilities)
find_package(Boost COMPONENTS unit_test_framework)
if(BUILD_SDK)
##### the sdk-dependencies #####
# find JNI
Expand Down Expand Up @@ -89,7 +90,6 @@ if(NOT BUILD_SDK AND NOT BUILD_UDF)
##### the full-dependencies #####
find_package(TBB REQUIRED)
find_package(jsoncpp REQUIRED)
find_package(Boost REQUIRED unit_test_framework)

find_package(${BCOS_BOOSTSSL_TARGET} REQUIRED)
# tcmalloc
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmake/InstallBcosUtilities.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
find_package(Boost COMPONENTS log filesystem chrono thread serialization iostreams system)
find_package(Boost COMPONENTS log filesystem chrono thread serialization iostreams system )
find_package(ZLIB REQUIRED)
find_package(bcos-utilities REQUIRED)
4 changes: 4 additions & 0 deletions cpp/cmake/Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ elseif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
endif ()
endif ()

if(ENABLE_SSE)
list(APPEND VCPKG_MANIFEST_FEATURES "sse")
endif()

set(ENABLE_CPU_FEATURES OFF)
# only ENABLE_CPU_FEATURES for aarch64 and x86
if ("${ARCHITECTURE}" MATCHES "aarch64")
Expand Down
3 changes: 2 additions & 1 deletion cpp/ppc-crypto-core/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ find_package(OpenSSL REQUIRED)
message(STATUS "OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}")
message(STATUS "OPENSSL_LIBRARIES: ${OPENSSL_LIBRARIES}")

target_link_libraries(${CRYPTO_CORE_TARGET} PUBLIC ${BCOS_UTILITIES_TARGET} OpenSSL::Crypto ${CPU_FEATURES_LIB})
find_package(unofficial-sodium REQUIRED)
target_link_libraries(${CRYPTO_CORE_TARGET} PUBLIC unofficial-sodium::sodium ${BCOS_UTILITIES_TARGET} OpenSSL::Crypto ${CPU_FEATURES_LIB})
104 changes: 52 additions & 52 deletions cpp/ppc-gateway/test/unittests/MockCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,66 +21,66 @@
#include "ppc-framework/storage/CacheStorage.h"
#include <unordered_map>

namespace ppc::mock
{
class MockCache : public storage::CacheStorage
{
namespace ppc::mock {
class MockCache : public storage::CacheStorage {
public:
using Ptr = std::shared_ptr<MockCache>;
MockCache() = default;
~MockCache() override {}
using Ptr = std::shared_ptr<MockCache>;
MockCache() = default;
~MockCache() override {}

/// Note: all these interfaces throws exception when error happened
/**
* @brief: check whether the key exists
* @param _key: key
* @return whether the key exists
*/
bool exists(const std::string& _key) override { return m_kv.find(_key) != m_kv.end(); }

/**
* @brief: set key value
* @param _expirationTime: timeout of key, seconds
*/
void setValue(const std::string& _key, const std::string& _value,
int32_t _expirationSeconds = -1) override
{
m_kv.emplace(_key, _value);
}
/// Note: all these interfaces throws exception when error happened
/**
* @brief: check whether the key exists
* @param _key: key
* @return whether the key exists
*/
bool exists(const std::string &_key) override {
return m_kv.find(_key) != m_kv.end();
}

/**
* @brief: set key value
* @param _expirationTime: timeout of key, seconds
*/
void setValue(const std::string &_key, const std::string &_value,
int32_t _expirationSeconds = -1) override {
m_kv.emplace(_key, _value);
}

/**
* @brief: get value by key
* @param _key: key
* @return value
*/
Optional<std::string> getValue(const std::string& _key) override
{
auto it = m_kv.find(_key);
if (it == m_kv.end())
{
return std::nullopt;
}

return it->second;
/**
* @brief: get value by key
* @param _key: key
* @return value
*/
std::optional<std::string> getValue(const std::string &_key) override {
auto it = m_kv.find(_key);
if (it == m_kv.end()) {
return std::nullopt;
}

/**
* @brief: set a timeout on key
* @param _expirationTime: timeout of key, ms
* @return whether setting is successful
*/
bool expireKey(const std::string& _key, uint32_t _expirationTime) override { return true; }
return it->second;
}

/**
* @brief: set a timeout on key
* @param _expirationTime: timeout of key, ms
* @return whether setting is successful
*/
bool expireKey(const std::string &_key, uint32_t _expirationTime) override {
return true;
}

/**
* @brief: delete key
* @param _key: key
* @return the number of key deleted
*/
uint64_t deleteKey(const std::string& _key) override { return m_kv.erase(_key); }
/**
* @brief: delete key
* @param _key: key
* @return the number of key deleted
*/
uint64_t deleteKey(const std::string &_key) override {
return m_kv.erase(_key);
}

private:
std::unordered_map<std::string, Optional<std::string>> m_kv;
std::unordered_map<std::string, std::optional<std::string>> m_kv;
};

} // namespace ppc::mock
} // namespace ppc::mock
10 changes: 5 additions & 5 deletions cpp/ppc-mpc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
project(ppc-mpc VERSION ${VERSION})
add_subdirectory(src)

if (TESTS)
enable_testing()
set(CTEST_OUTPUT_ON_FAILURE TRUE)
add_subdirectory(tests)
endif()
#if (TESTS)
# enable_testing()
# set(CTEST_OUTPUT_ON_FAILURE TRUE)
# add_subdirectory(tests)
#endif()

2 changes: 1 addition & 1 deletion cpp/ppc-pir/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ target_include_directories(${TEST_BINARY_NAME} PRIVATE .)

# target_link_libraries(${TEST_BINARY_NAME} ${PIR_TARGET} ${RPC_TARGET} ${CRYPTO_TARGET} ${BOOST_UNIT_TEST})
target_link_libraries(${TEST_BINARY_NAME} PUBLIC ${IO_TARGET} ${FRONT_TARGET} ${BCOS_UTILITIES_TARGET} ${TARS_PROTOCOL_TARGET} ${PIR_TARGET} ${RPC_TARGET} ${CRYPTO_TARGET} ${PROTOCOL_TARGET} ${BOOST_UNIT_TEST})
add_test(NAME test-ays WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${TEST_BINARY_NAME})
add_test(NAME test-psi WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${TEST_BINARY_NAME})
Loading

0 comments on commit b21a3fe

Please sign in to comment.