forked from hyperledger-iroha/iroha-dco
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added arm+macos builds Signed-off-by: Artyom Bakhtin <[email protected]> * comments-based fixes Signed-off-by: Artyom Bakhtin <[email protected]> * replace lcov cobertura converter download with the link to a specific commit Signed-off-by: Artyom Bakhtin <[email protected]> * resolve Docker files conflicts Signed-off-by: Artyom Bakhtin <[email protected]> * disable ARMv8 builds by default Signed-off-by: Artyom Bakhtin <[email protected]> * add new lines where necessary Signed-off-by: Artyom Bakhtin <[email protected]>
- Loading branch information
1 parent
5efd87b
commit d3c34cc
Showing
25 changed files
with
1,283 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env groovy | ||
|
||
def doBindings() { | ||
|
||
def cmake_options = "" | ||
if (params.JavaBindings) { | ||
cmake_options += " -DSWIG_JAVA=ON " | ||
} | ||
if (params.PythonBindings) { | ||
cmake_options += " -DSWIG_PYTHON=ON " | ||
} | ||
// In case language specific options were not set, | ||
// build for every language | ||
if (!params.JavaBindings && !params.PythonBindings) { | ||
cmake_options += " -DSWIG_JAVA=ON -DSWIG_PYTHON=ON " | ||
} | ||
sh """ | ||
cmake \ | ||
-H. \ | ||
-Bbuild \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
${cmake_options} | ||
""" | ||
sh "cd build; make -j${params.PARALLELISM} irohajava irohapy" | ||
archive(includes: 'build/shared_model/bindings/') | ||
} | ||
|
||
return this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env groovy | ||
|
||
def cancelSameJobBuilds() { | ||
def jobname = env.JOB_NAME | ||
def buildnum = env.BUILD_NUMBER.toInteger() | ||
def job = Jenkins.instance.getItemByFullName(jobname) | ||
|
||
if (jobname =~ /^.*\/${job.name}$/) { | ||
for (build in job.builds) { | ||
if (!build.isBuilding()) { continue; } | ||
if (buildnum == build.getNumber().toInteger()) { continue; } | ||
build.doStop(); | ||
} | ||
} | ||
} | ||
return this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#!/usr/bin/env groovy | ||
|
||
def doDebugBuild(coverageEnabled=false) { | ||
def parallelism = env.PARALLELISM | ||
if ("arm7" in env.NODE_NAME) { | ||
parallelism = 1 | ||
} | ||
sh "docker network create ${env.IROHA_NETWORK}" | ||
|
||
docker.image('postgres:9.5').run("" | ||
+ " -e POSTGRES_USER=${env.IROHA_POSTGRES_USER}" | ||
+ " -e POSTGRES_PASSWORD=${env.IROHA_POSTGRES_PASSWORD}" | ||
+ " --name ${env.IROHA_POSTGRES_HOST}" | ||
+ " --network=${env.IROHA_NETWORK}") | ||
|
||
def platform = sh(script: 'uname -m', returnStdout: true).trim() | ||
sh "curl -L -o /tmp/${env.GIT_COMMIT}/Dockerfile --create-dirs https://raw.githubusercontent.com/hyperledger/iroha/${env.GIT_COMMIT}/docker/develop/${platform}/Dockerfile" | ||
// pull docker image in case we don't have one | ||
// speeds up consequent image builds as we simply tag them | ||
sh "docker pull ${DOCKER_BASE_IMAGE_DEVELOP}" | ||
if (env.BRANCH_NAME == 'develop') { | ||
iC = docker.build("hyperledger/iroha:${GIT_COMMIT}-${BUILD_NUMBER}", "--build-arg PARALLELISM=${parallelism} -f /tmp/${env.GIT_COMMIT}/Dockerfile /tmp/${env.GIT_COMMIT}") | ||
docker.withRegistry('https://registry.hub.docker.com', 'docker-hub-credentials') { | ||
iC.push("${platform}-develop") | ||
} | ||
} | ||
else { | ||
iC = docker.build("hyperledger/iroha-workflow:${GIT_COMMIT}-${BUILD_NUMBER}", "-f /tmp/${env.GIT_COMMIT}/Dockerfile /tmp/${env.GIT_COMMIT} --build-arg PARALLELISM=${parallelism}") | ||
} | ||
iC.inside("" | ||
+ " -e IROHA_POSTGRES_HOST=${env.IROHA_POSTGRES_HOST}" | ||
+ " -e IROHA_POSTGRES_PORT=${env.IROHA_POSTGRES_PORT}" | ||
+ " -e IROHA_POSTGRES_USER=${env.IROHA_POSTGRES_USER}" | ||
+ " -e IROHA_POSTGRES_PASSWORD=${env.IROHA_POSTGRES_PASSWORD}" | ||
+ " --network=${env.IROHA_NETWORK}" | ||
+ " -v /var/jenkins/ccache:${CCACHE_DIR}") { | ||
|
||
def scmVars = checkout scm | ||
env.IROHA_VERSION = "0x${scmVars.GIT_COMMIT}" | ||
env.IROHA_HOME = "/opt/iroha" | ||
env.IROHA_BUILD = "${env.IROHA_HOME}/build" | ||
|
||
sh """ | ||
ccache --version | ||
ccache --show-stats | ||
ccache --zero-stats | ||
ccache --max-size=5G | ||
""" | ||
sh """ | ||
cmake \ | ||
-DCOVERAGE=ON \ | ||
-DTESTING=ON \ | ||
-H. \ | ||
-Bbuild \ | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-DIROHA_VERSION=${env.IROHA_VERSION} | ||
""" | ||
sh "cmake --build build -- -j${parallelism}" | ||
sh "ccache --show-stats" | ||
sh "cmake --build build --target test" | ||
sh "cmake --build build --target cppcheck" | ||
|
||
if ( coverageEnabled ) { | ||
// Sonar | ||
if (env.CHANGE_ID != null) { | ||
sh """ | ||
sonar-scanner \ | ||
-Dsonar.github.disableInlineComments \ | ||
-Dsonar.github.repository='hyperledger/iroha' \ | ||
-Dsonar.analysis.mode=preview \ | ||
-Dsonar.login=${SONAR_TOKEN} \ | ||
-Dsonar.projectVersion=${BUILD_TAG} \ | ||
-Dsonar.github.oauth=${SORABOT_TOKEN} \ | ||
-Dsonar.github.pullRequest=${CHANGE_ID} | ||
""" | ||
} | ||
|
||
sh "lcov --capture --directory build --config-file .lcovrc --output-file build/reports/coverage_full.info" | ||
sh "lcov --remove build/reports/coverage_full.info '/usr/*' 'schema/*' --config-file .lcovrc -o build/reports/coverage_full_filtered.info" | ||
sh "python /tmp/lcov_cobertura.py build/reports/coverage_full_filtered.info -o build/reports/coverage.xml" | ||
cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/build/reports/coverage.xml', conditionalCoverageTargets: '75, 50, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '75, 50, 0', maxNumberOfBuilds: 50, methodCoverageTargets: '75, 50, 0', onlyStable: false, zoomCoverageChart: false | ||
} | ||
|
||
// TODO: replace with upload to artifactory server | ||
// develop branch only | ||
if ( env.BRANCH_NAME == "develop" ) { | ||
//archive(includes: 'build/bin/,compile_commands.json') | ||
} | ||
} | ||
} | ||
return this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env groovy | ||
|
||
def doDockerCleanup() { | ||
|
||
sh """ | ||
docker stop $IROHA_POSTGRES_HOST || true | ||
docker rm $IROHA_POSTGRES_HOST || true | ||
# Check whether the image is the last-standing man | ||
# i.e., no other tags exist for this image | ||
docker rmi \$(docker images --no-trunc --format '{{.Repository}}:{{.Tag}}\\t{{.ID}}' | grep \$(docker images --no-trunc --format '{{.ID}}' ${iC.id}) | head -n -1 | cut -f 1) || true | ||
sleep 5 | ||
docker network rm $IROHA_NETWORK || true | ||
#remove folder with iroha.deb package and Dockerfiles | ||
rm -rf /tmp/${env.GIT_COMMIT}-${BUILD_NUMBER} | ||
rm -rf /tmp/${env.GIT_COMMIT} | ||
""" | ||
} | ||
|
||
return this |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ def doDoxygen() { | |
""" | ||
} | ||
|
||
return this | ||
return this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/usr/bin/env groovy | ||
|
||
def doReleaseBuild() { | ||
def parallelism = env.PARALLELISM | ||
if ("arm7" in env.NODE_NAME) { | ||
parallelism = 1 | ||
} | ||
def platform = sh(script: 'uname -m', returnStdout: true).trim() | ||
sh "curl -L -o /tmp/${env.GIT_COMMIT}/Dockerfile --create-dirs https://raw.githubusercontent.com/hyperledger/iroha/${env.GIT_COMMIT}/docker/develop/${platform}/Dockerfile" | ||
// pull docker image for building release package of Iroha | ||
// speeds up consequent image builds as we simply tag them | ||
sh "docker pull ${DOCKER_BASE_IMAGE_DEVELOP}" | ||
iC = docker.build("hyperledger/iroha:${GIT_COMMIT}-${BUILD_NUMBER}", "--build-arg PARALLELISM=${parallelism} -f /tmp/${env.GIT_COMMIT}/Dockerfile /tmp/${env.GIT_COMMIT}") | ||
|
||
sh "mkdir /tmp/${env.GIT_COMMIT}-${BUILD_NUMBER} || true" | ||
iC.inside("" | ||
+ " -v /tmp/${GIT_COMMIT}-${BUILD_NUMBER}:/tmp/${GIT_COMMIT}" | ||
+ " -v /var/jenkins/ccache:${CCACHE_RELEASE_DIR}") { | ||
|
||
def scmVars = checkout scm | ||
env.IROHA_VERSION = "0x${scmVars.GIT_COMMIT}" | ||
env.IROHA_HOME = "/opt/iroha" | ||
env.IROHA_BUILD = "${env.IROHA_HOME}/build" | ||
|
||
sh """ | ||
ccache --version | ||
ccache --show-stats | ||
ccache --zero-stats | ||
ccache --max-size=5G | ||
""" | ||
sh """ | ||
cmake \ | ||
-H. \ | ||
-Bbuild \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DIROHA_VERSION=${env.IROHA_VERSION} \ | ||
-DPACKAGE_DEB=ON \ | ||
-DPACKAGE_TGZ=ON \ | ||
-DCOVERAGE=OFF \ | ||
-DTESTING=OFF | ||
""" | ||
sh "cmake --build build --target package -- -j${parallelism}" | ||
sh "ccache --show-stats" | ||
|
||
// copy build package to the volume | ||
sh "cp ./build/iroha-*.deb /tmp/${GIT_COMMIT}/iroha.deb" | ||
} | ||
|
||
sh "curl -L -o /tmp/${env.GIT_COMMIT}/Dockerfile --create-dirs https://raw.githubusercontent.com/hyperledger/iroha/${env.GIT_COMMIT}/docker/release/${platform}/Dockerfile" | ||
sh "curl -L -o /tmp/${env.GIT_COMMIT}/entrypoint.sh https://raw.githubusercontent.com/hyperledger/iroha/${env.GIT_COMMIT}/docker/release/${platform}/entrypoint.sh" | ||
sh "cp /tmp/${GIT_COMMIT}-${BUILD_NUMBER}/iroha.deb /tmp/${env.GIT_COMMIT}" | ||
sh "chmod +x /tmp/${env.GIT_COMMIT}/entrypoint.sh" | ||
iCRelease = docker.build("hyperledger/iroha:${GIT_COMMIT}-${BUILD_NUMBER}-release", "-f /tmp/${env.GIT_COMMIT}/Dockerfile /tmp/${env.GIT_COMMIT}") | ||
docker.withRegistry('https://registry.hub.docker.com', 'docker-hub-credentials') { | ||
if (env.BRANCH_NAME == 'develop') { | ||
iCRelease.push("${platform}-develop-latest") | ||
} | ||
else if (env.BRANCH_NAME == 'master') { | ||
iCRelease.push("${platform}-latest") | ||
} | ||
} | ||
sh "docker rmi ${iCRelease.id}" | ||
} | ||
return this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Specify coverage rate limits (in %) for classifying file entries | ||
# HI: hi_limit <= rate <= 100 graph color: green | ||
# MED: med_limit <= rate < hi_limit graph color: orange | ||
# LO: 0 <= rate < med_limit graph color: red | ||
genhtml_hi_limit = 75 | ||
genhtml_med_limit = 50 | ||
|
||
# Width of line coverage field in source code view | ||
genhtml_line_field_width = 12 | ||
|
||
# Width of branch coverage field in source code view | ||
genhtml_branch_field_width = 16 | ||
|
||
# Width of overview image (used by --frames option of genhtml) | ||
genhtml_overview_width = 80 | ||
|
||
# Resolution of overview navigation: this number specifies the maximum | ||
# difference in lines between the position a user selected from the overview | ||
# and the position the source code window is scrolled to (used by --frames | ||
# option of genhtml) | ||
genhtml_nav_resolution = 4 | ||
|
||
# Clicking a line in the overview image should show the source code view at | ||
# a position a bit further up so that the requested line is not the first | ||
# line in the window. This number specifies that offset in lines (used by | ||
# --frames option of genhtml) | ||
genhtml_nav_offset = 10 | ||
|
||
# Do not remove unused test descriptions if non-zero (same as | ||
# --keep-descriptions option of genhtml) | ||
genhtml_keep_descriptions = 0 | ||
|
||
# Do not remove prefix from directory names if non-zero (same as --no-prefix | ||
# option of genhtml) | ||
genhtml_no_prefix = 0 | ||
|
||
# Do not create source code view if non-zero (same as --no-source option of | ||
# genhtml) | ||
genhtml_no_source = 0 | ||
|
||
# Replace tabs with number of spaces in source view (same as --num-spaces | ||
# option of genhtml) | ||
genhtml_num_spaces = 4 | ||
|
||
# Highlight lines with converted-only data if non-zero (same as --highlight | ||
# option of genhtml) | ||
genhtml_highlight = 0 | ||
|
||
# Include color legend in HTML output if non-zero (same as --legend option of | ||
# genhtml) | ||
genhtml_legend = 1 | ||
|
||
# Include sorted overview pages (can be disabled by the --no-sort option of | ||
# genhtml) | ||
genhtml_sort = 1 | ||
|
||
# Include function coverage data display (can be disabled by the | ||
# --no-func-coverage option of genhtml) | ||
genhtml_function_coverage = 1 | ||
|
||
# Include branch coverage data display (can be disabled by the | ||
# --no-branch-coverage option of genhtml) | ||
genhtml_branch_coverage = 1 | ||
|
||
# Specify the character set of all generated HTML pages | ||
genhtml_charset=UTF-8 | ||
|
||
# Allow HTML markup in test case description text if non-zero | ||
genhtml_desc_html=0 | ||
|
||
# Specify if geninfo should try to automatically determine the base-directory | ||
# when collecting coverage data. | ||
geninfo_auto_base = 1 | ||
|
||
# Location of the insmod tool | ||
lcov_insmod_tool = /sbin/insmod | ||
|
||
# Location of the modprobe tool | ||
lcov_modprobe_tool = /sbin/modprobe | ||
|
||
# Location of the rmmod tool | ||
lcov_rmmod_tool = /sbin/rmmod | ||
|
||
# Location for temporary directories | ||
lcov_tmp_dir = /tmp | ||
|
||
# Show full paths during list operation if non-zero (same as --list-full-path | ||
# option of lcov) | ||
lcov_list_full_path = 0 | ||
|
||
# Specify the maximum width for list output. This value is ignored when | ||
# lcov_list_full_path is non-zero. | ||
lcov_list_width = 80 | ||
|
||
# Specify the maximum percentage of file names which may be truncated when | ||
# choosing a directory prefix in list output. This value is ignored when | ||
# lcov_list_full_path is non-zero. | ||
lcov_list_truncate_max = 20 | ||
|
||
# Specify if function coverage data should be collected and processed. | ||
lcov_function_coverage = 1 | ||
|
||
# Specify if branch coverage data should be collected and processed. | ||
lcov_branch_coverage = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,4 +125,3 @@ endif() | |
|
||
|
||
|
||
|
Oops, something went wrong.