Skip to content

Commit

Permalink
repo-sync-2024-03-01T14:35:05+0800 (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongtianq authored Mar 1, 2024
1 parent 947b680 commit 47d96c2
Show file tree
Hide file tree
Showing 119 changed files with 6,756 additions and 128 deletions.
84 changes: 84 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Copyright 2023 Ant Group Co., Ltd.
#
# 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.

common --experimental_repo_remote_exec
common --experimental_cc_shared_library

build --incompatible_new_actions_api=false
build --copt=-fdiagnostics-color=always
build --enable_platform_specific_config
build --force_pic

coverage --copt -fPIC

build --cxxopt=-std=c++17
build --host_cxxopt=-std=c++17

test --keep_going
test --test_output=errors
test --test_timeout=1800

# platform specific config
# Bazel will automatic pick platform config since we have enable_platform_specific_config set
build:macos --copt="-Xpreprocessor -fopenmp"
build:macos --copt=-Wno-unused-command-line-argument
build:macos --features=-supports_dynamic_linker
build:macos --cxxopt -Wno-deprecated-enum-enum-conversion
build:macos --cxxopt -Wno-deprecated-anon-enum-enum-conversion
build:macos --macos_minimum_os=11.0
build:macos --host_macos_minimum_os=11.0

# static link libstdc++ & libgcc on Linux
build:linux --copt=-fopenmp
build:linux --action_env=BAZEL_LINKOPTS=-static-libstdc++:-static-libgcc
build:linux --action_env=BAZEL_LINKLIBS=-l%:libstdc++.a:-l%:libgcc.a

build:asan --strip=never
build:asan --copt -fno-sanitize-recover=all
build:asan --copt -fsanitize=address
build:asan --copt -Og
build:asan --copt -g
build:asan --copt -fno-omit-frame-pointer
build:asan --linkopt -fsanitize=address
build:asan --linkopt -static-libasan

build:ubsan --strip=never
build:ubsan --copt -fno-sanitize-recover=all
build:ubsan --copt -fsanitize=undefined
build:ubsan --copt -Og
build:ubsan --copt -g
build:ubsan --copt -fno-omit-frame-pointer
build:ubsan --linkopt -fsanitize=undefined
build:ubsan --linkopt -static-libubsan

build:macos-asan --features=asan
build:macos-ubsan --features=ubsan

test:asan --strip=never
test:asan --copt -fno-sanitize-recover=all
test:asan --copt -fsanitize=address
test:asan --copt -O0
test:asan --copt -g
test:asan --copt -fno-omit-frame-pointer
test:asan --linkopt -fsanitize=address
test:asan --linkopt -static-libasan

test:ubsan --strip=never
test:ubsan --copt -fno-sanitize-recover=all
test:ubsan --copt -fsanitize=undefined
test:ubsan --copt -O0
test:ubsan --copt -g
test:ubsan --copt -fno-omit-frame-pointer
test:ubsan --linkopt -fsanitize=undefined
test:ubsan --linkopt -static-libubsan
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.2.1
130 changes: 130 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Copyright 2024 Ant Group Co., Ltd.
#
# 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.

# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1

setup: true

parameters:
GHA_Actor:
type: string
default: ""
GHA_Action:
type: string
default: ""
GHA_Event:
type: string
default: ""
GHA_Meta:
type: string
default: ""
GHA_Mode:
type: string
default: ""
GHA_Version:
type: string
default: ""

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
linux_ut:
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
docker:
- image: secretflow/trustedflow-dev-ubuntu22.04:latest
resource_class: 2xlarge+
shell: /bin/bash --login -eo pipefail
# Add steps to the job
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
steps:
- checkout
- run:
name: "build and test"
command: |
set -ex
mkdir -p ~/.ssh && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
bazel --output_base=target build //trustedflow/...
bazel --output_base=target test //trustedflow/...
bazel --output_base=target test //trustedflow/... --features=asan
docker_image_publish:
docker:
- image: cimg/deploy:2023.06.1
steps:
- checkout
- setup_remote_docker
- run:
name: Build and Push Docker image
command: |
MODE=<< pipeline.parameters.GHA_Mode >>
COMMON_VERSION=<< pipeline.parameters.GHA_Version >>
OCCLUM_VERSION=occlum29.05-<< pipeline.parameters.GHA_Version >>
# login docker
docker login -u secretflow -p ${DOCKER_DEPLOY_TOKEN}
case "$MODE" in
common)
echo "build and publish in common mode, version: ${COMMON_VERSION}"
pushd docker
docker build -f trustedflow-dev-ubuntu22.04.Dockerfile -t secretflow/trustedflow-dev-ubuntu22.04:${COMMON_VERSION} .
docker tag secretflow/trustedflow-dev-ubuntu22.04:${COMMON_VERSION} secretflow/trustedflow-dev-ubuntu22.04:latest
docker push secretflow/trustedflow-dev-ubuntu22.04:${COMMON_VERSION}
docker push secretflow/trustedflow-dev-ubuntu22.04:latest
docker build -f trustedflow-release-ubuntu22.04.Dockerfile -t secretflow/trustedflow-release-ubuntu22.04:${COMMON_VERSION} .
docker tag secretflow/trustedflow-release-ubuntu22.04:${COMMON_VERSION} secretflow/trustedflow-release-ubuntu22.04:latest
docker push secretflow/trustedflow-release-ubuntu22.04:${COMMON_VERSION}
docker push secretflow/trustedflow-release-ubuntu22.04:latest
popd
;;
occlum)
echo "build and publish in occlum mode, version: ${OCCLUM_VERSION}"
pushd docker
docker build -f trustedflow-dev-occlum-ubuntu20.04.Dockerfile -t secretflow/trustedflow-dev-occlum-ubuntu20.04:${OCCLUM_VERSION} .
docker tag secretflow/trustedflow-dev-occlum-ubuntu20.04:${OCCLUM_VERSION} secretflow/trustedflow-dev-occlum-ubuntu20.04:latest
docker push secretflow/trustedflow-dev-occlum-ubuntu20.04:${OCCLUM_VERSION}
docker push secretflow/trustedflow-dev-occlum-ubuntu20.04:latest
docker build -f trustedflow-release-occlum-ubuntu20.04.Dockerfile -t secretflow/trustedflow-release-occlum-ubuntu20.04:${OCCLUM_VERSION} .
docker tag secretflow/trustedflow-release-occlum-ubuntu20.04:${OCCLUM_VERSION} secretflow/trustedflow-release-occlum-ubuntu20.04:latest
docker push secretflow/trustedflow-release-occlum-ubuntu20.04:${OCCLUM_VERSION}
docker push secretflow/trustedflow-release-occlum-ubuntu20.04:latest
popd
;;
*)
echo "Mode err, should be common or occlum, but got $MODE"
exit 1
;;
esac
# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
ut-workflow:
when:
not: << pipeline.parameters.GHA_Action >>
jobs:
- linux_ut
docker-image-publish-workflow:
when:
and:
- equal: ["docker_image_publish", << pipeline.parameters.GHA_Action >>]
- exits: << pipeline.parameters.GHA_Mode >>
- exits: << pipeline.parameters.GHA_Version >>
jobs:
- docker_image_publish
15 changes: 15 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Use the Google style in this project.
BasedOnStyle: Google

IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*\.pb\.h"$'
Priority: 5
- Regex: '^"trustedflow.*'
Priority: 4
- Regex: '^".*'
Priority: 3
70 changes: 70 additions & 0 deletions .clang-tiny
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Checks: "abseil-cleanup-ctad,
abseil-faster-strsplit-delimiter,
abseil-duration-*,
abseil-no-namespace,
abseil-redundant-strcat-calls,
abseil-str-cat-append,
abseil-string-find-startswith,
abseil-upgrade-duration-conversions
bugprone-*,
-bugprone-easily-swappable-parameters,
google-build-using-namespace,
google-explicit-constructor,
google-global-names-in-headers,
google-readability-casting,
google-runtime-int,
google-runtime-operator,
misc-unused-using-decls,
modernize-*,
-modernize-use-trailing-return-type,
-modernize-use-nodiscard,
performance-*,
readability-*,
-readability-else-after-return,
-readability-identifier-length,
-readability-magic-numbers,
-readability-named-parameter"

CheckOptions:
- key: bugprone-argument-comment.StrictMode
value: 1

- key: bugprone-dangling-handle.HandleClasses
value: "std::basic_string_view;std::experimental::basic_string_view;absl::string_view"

- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: 1

# Ignore GoogleTest function macros.
- key: readability-identifier-naming.FunctionIgnoredRegexp
value: "(TEST|TEST_F|TEST_P|INSTANTIATE_TEST_SUITE_P|MOCK_METHOD|TYPED_TEST)"

- key: readability-identifier-naming.ClassCase
value: "CamelCase"

- key: readability-identifier-naming.EnumCase
value: "CamelCase"

- key: readability-identifier-naming.EnumConstantCase
value: "CamelCase"

- key: readability-identifier-naming.ParameterCase
value: "lower_case"

- key: readability-identifier-naming.PrivateMemberCase
value: "lower_case"

- key: readability-identifier-naming.PrivateMemberSuffix
value: "_"

- key: readability-identifier-naming.StructCase
value: "CamelCase"

- key: readability-identifier-naming.TypeAliasCase
value: "CamelCase"

- key: readability-identifier-naming.UnionCase
value: "CamelCase"

- key: readability-identifier-naming.FunctionCase
value: "CamelBack"
51 changes: 51 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,53 @@
# devtools
.idea/
*.plist
clion/
*.swp
tags
sftp-config.json
build_cmakelist.py
.akconfig
.cloudide/
*.code-workspace
vipclient-*
*.pb.h
*.pb.cc
compile_commands.json
.clangd
Pipfile
.vscode

# python-package
/dist
*.egg-info
__pycache__
build
_build

# bazel
bazel-*

# cmake related
abseil-cpp
bld
bld.install
CMakeCache.txt
cmake_install.cmake
CTestTestfile.cmake

# mixed
.DS_Store
.ipynb_checkpoints
trace.*log

dump/

# clangd cache
.cache
external

*metadata.txt

target
_build
.venv
21 changes: 21 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Ant Group Co., Ltd.
#
# 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.

package(default_visibility = ["//visibility:public"])

cc_library(
name = "hygon_csv_header",
hdrs = ["@hygon_csv_header//file:csv/attestation/attestation.h"],
strip_include_prefix = "file",
)
Loading

0 comments on commit 47d96c2

Please sign in to comment.