Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Release

See merge request in3/c/in3-core!230
  • Loading branch information
simon-jentzsch committed May 12, 2020
2 parents d0adeb2 + 3f7d791 commit 50c67e9
Show file tree
Hide file tree
Showing 332 changed files with 26,447 additions and 2,759 deletions.
21 changes: 20 additions & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,32 @@ plugins:
enabled: true
fixme:
enabled: true
checks:
argument-count:
config:
threshold: 7
file-lines:
config:
threshold: 400
method-complexity:
config:
threshold: 25
method-lines:
config:
threshold: 70
return-statements:
config:
threshold: 10
method-count:
config:
threshold: 40
exclude_patterns:
- config/
- db/
- dist/
- features/
- "**/node_modules/"
- script/
- scripts/
- "**/spec/"
- "**/test/"
- "**/tests/"
Expand Down
26 changes: 20 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
###########################################################
# General CI rules:
# * Create one CI.yml file per language/purpose
# * Include said CI.yml file below
# * We use rules in this CI, which means you cannot use only/except
# * The workflow rules define when the CI gets triggered, job rules are used to define when jobs get triggered
# * Do not commit any keys/ethereum addresses/private keys/etc directly, use environment variables or other methods
# * Thank you for reading this far! Get yourself a chocolate as a treat.
###########################################################

variables:
COMMIT_IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
RELEASE_IMAGE_TAG: $CI_REGISTRY_IMAGE:latest

# Done to fix this bug: https://gitlab.com/gitlab-org/gitlab/issues/30111#note_275012413
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
when: never
- when: always

# defines all the stages in the CI, this includes all stages defined inside the included yml files
stages:
- build
- bindings
Expand All @@ -15,8 +33,9 @@ stages:
- deploy
- release

# all the CI files to include and run, they are imported before the CI is started
include:
- template: Code-Quality.gitlab-ci.yml
- local: "code-quality.gitlab-ci.yml"
- local: "/c/ci.yml"
- local: "/c/ci-analyse.yml"
- local: "/c/ci-deploy.yml"
Expand All @@ -25,8 +44,3 @@ include:
- local: "/python/ci.yml"
- local: "/dotnet/ci.yml"
- local: "/rust/ci.yml"
##### local_docker_deploy_and_vulnerability_analysis #####

##### analyse #####

##### deploy #####
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@
"program": "${workspaceFolder}/build/test/test_ethapi",
"cwd": "${workspaceFolder}/build"
},
{
"type": "lldb",
"request": "launch",
"name": "run tx example",
"program": "${workspaceFolder}/c/examples/send_transaction",
"cwd": "${workspaceFolder}/c/examples"
},
{
"type": "lldb",
"request": "launch",
"name": "run sign test",
"program": "${workspaceFolder}/build/test/test_sign",
"cwd": "${workspaceFolder}/build"
},
{
"type": "lldb",
"request": "launch",
Expand Down
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ option(WASM_EMBED "embedds the wasm as base64-encoded into the js-file" ON)
option(WASM_EMMALLOC "use ther smaller EMSCRIPTEN Malloc, which reduces the size about 10k, but may be a bit slower" ON)
option(WASM_SYNC "intiaializes the WASM synchronisly, which allows to require and use it the same function, but this will not be supported by chrome (4k limit)" OFF)
option(CODE_COVERAGE "Builds targets with code coverage instrumentation. (Requires GCC or Clang)" OFF)
option(GCC_ANALYZER "GCC10 static code analyses" OFF)
option(PAY_ETH "support for direct Eth-Payment" OFF)
option(USE_SCRYPT "integrate scrypt into the build in order to allow decrypt_key for scrypt encoded keys." ON)
option(USE_CURL "if true the curl transport will be built (with a dependency to libcurl)" ON)
option(DEV_NO_INTRN_PTR "(*dev option*) if true the client will NOT include a void pointer (named internal) for use by devs)" ON)
option(LEDGER_NANO "include support for nano ledger" OFF)

if (USE_PRECOMPUTED_EC)
ADD_DEFINITIONS(-DUSE_PRECOMPUTED_CP=1)
Expand Down Expand Up @@ -119,6 +121,13 @@ if(IPFS)
set(IN3_VERIFIER ${IN3_VERIFIER} ipfs)
endif()

if(LEDGER_NANO AND ( NOT (WIN32 OR MSVC OR MSYS OR MINGW )))
add_definitions(-DLEDGER_NANO)
set(HIDAPI true)
else()
set(HIDAPI false)
endif()

if(COLOR AND NOT (MSVC OR MSYS OR MINGW))
ADD_DEFINITIONS(-DLOG_USE_COLOR)
endif()
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RUN cd /in3/ && rm -rf build;
RUN cd /in3/ && mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=MINSIZEREL -DIN3_SERVER=true -DUSE_CURL=false .. && make in3


FROM alpine:latest
FROM alpine:edge
COPY --from=build /in3/build/bin/in3 /bin/in3
EXPOSE 8545
ENTRYPOINT ["/bin/in3"]
Expand Down
26 changes: 23 additions & 3 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,33 @@
# with this program. If not, see <https://www.gnu.org/licenses/>.
###############################################################################


include("${PROJECT_SOURCE_DIR}/c/compiler.cmake")

# build modules
add_subdirectory(src/third-party)


if (GCC_ANALYZER)
add_compile_options(-fanalyzer -Werror)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fanalyzer -Werror")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fanalyzer -Werror")
endif()

add_subdirectory(src/core)
add_subdirectory(src/transport)
add_subdirectory(src/verifier)

if( LEDGER_NANO AND HIDAPI )
add_subdirectory(src/signer/ledger-nano/signer)
endif()

add_subdirectory(src/pay)
add_subdirectory(src/api)
IF (ETH_FULL)
add_subdirectory(src/cmd)
endif()
add_subdirectory(docs)

link_directories(${CMAKE_BINARY_DIR}/lib/)


# create the library
Expand Down Expand Up @@ -104,13 +116,21 @@ if (IN3_LIB)
if (USE_SCRYPT)
set(IN3_LIBS ${IN3_LIBS} $<TARGET_OBJECTS:scrypt_o>)
endif()



# create the libraries
add_library(in3_bundle STATIC ${IN3_LIBS} )
add_library(in3_lib SHARED ${IN3_LIBS} )
set_target_properties(in3_bundle PROPERTIES OUTPUT_NAME "in3")
set_target_properties(in3_lib PROPERTIES OUTPUT_NAME "in3")
target_link_libraries(in3_lib ${IN3_TRANSPORT})

if( LEDGER_NANO AND HIDAPI )
target_link_libraries(in3_lib ${IN3_TRANSPORT} ledger_signer)
else()
target_link_libraries(in3_lib ${IN3_TRANSPORT} )
endif()


# install
INSTALL(TARGETS in3_bundle
Expand Down
50 changes: 41 additions & 9 deletions c/ci-analyse.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
.only_full:
rules:
- changes:
- c/**/*
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+.[0-9]+.[0-9]+-(alpha|beta|rc)\.[0-9]+$/'
- if: '$CI_COMMIT_REF_NAME == "master"'
- if: '$CI_COMMIT_REF_NAME == "develop"'

coverage:
stage: analysis
image: silkeh/clang:dev
coverage: '/TOTAL.*\s+(\d+.\d+\%)\s*$/'
extends: .only_full
needs: []
tags:
- short-jobs
Expand All @@ -18,23 +27,25 @@ coverage:

clangcheck:
stage: analysis
image: docker.slock.it/build-images/cmake:clang10
image: docker.slock.it/build-images/cmake:clang11
needs: []
extends: .only_full
allow_failure: false
tags:
- short-jobs
script:
- mkdir _build
- cd _build
- scan-build-10 cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=DEBUG -DIN3_SERVER=true ..
- scan-build-10 --status-bugs --exclude ../c/src/third-party --force-analyze-debug-code -o ../report make
- scan-build-11 cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=DEBUG -DIN3_SERVER=true ..
- scan-build-11 --status-bugs --exclude ../c/src/third-party --force-analyze-debug-code -o ../report make
artifacts:
paths:
- report

cppcheck:
stage: analysis
image: docker.slock.it/build-images/cmake:gcc-x86-static-analysis
extends: .only_full
allow_failure: true
needs: []
tags:
Expand All @@ -46,9 +57,24 @@ cppcheck:
- cd ..
- cppcheck --project=_build/compile_commands.json -i/builds/in3/c/in3-core/c/test/unity -i/builds/in3/c/in3-core/c/src/third-party

gcc10check:
stage: analysis
image: docker.slock.it/build-images/cmake:gcc10
extends: .only_full
allow_failure: true
needs: []
tags:
- short-jobs
script:
- mkdir _build
- cd _build
- cmake -DGCC_ANALYZER=true ..
- make

valgrind:
stage: analysis
image: docker.slock.it/build-images/cmake:valgrind
extends: .only_full
# allow_failure: true
needs: []
tags:
Expand All @@ -64,10 +90,10 @@ valgrind:
- for f in test/test*; do valgrind $VALGRIND_OPTS $(pwd)/$f; done

code_quality:
only:
- /^v[0-9]+.[0-9]+.[0-9]+(\-RC[0-9]+)?$/
except:
- branches
rules:
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+.[0-9]+.[0-9]+(\-RC[0-9]+)?$/'
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_COMMIT_BRANCH == "develop"'
stage: analysis
needs: []
tags:
Expand All @@ -83,11 +109,11 @@ code_quality:
format:
stage: analysis
needs: []
image: docker.slock.it/build-images/cmake:clang10
image: docker.slock.it/build-images/cmake:clang11
tags:
- short-jobs
script:
- find c/src/core/ c/src/cmd/ c/src/api/ c/src/verifier/ c/src/transport/ java \( -name "*.c" -o -name "*.h" -o -name "*.java" \) | xargs clang-format-10 -i
- find c/src/core/ c/src/cmd/ c/src/api/ c/src/verifier/ c/src/transport/ java \( -name "*.c" -o -name "*.h" -o -name "*.java" \) | xargs clang-format-11 -i
- git diff --patch --exit-code

cpd:
Expand All @@ -102,7 +128,13 @@ cpd:
- cpd --minimum-tokens 150 --language python --files python

vulnerabilities:
rules:
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+.[0-9]+.[0-9]+(\-RC[0-9]+)?$/'
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_COMMIT_BRANCH == "develop"'
stage: analysis
extends: .only_full
allow_failure: true
needs:
- docker
tags:
Expand Down
Loading

0 comments on commit 50c67e9

Please sign in to comment.