mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
f3e380659a
* GCC-7 and glibc-2.27 compat code * Statically link libstdc++ for GCC based builds Makes sure binaries which are built on a newer build host still work on older distros. * Use python3 when installing MacOS native tools * Move actual build logic out of Travis and upgrade to gcc-7 Travis will now simply call a few scripts which do the actual work. These scripts will first create a "builder image" which contains the necessary environment for the actual build. Then scripts are called inside this builder image to do the build. This should make us more independant from Travis and also allows us to do local CI testing. The build matrix is also moved out of .travis.yml and instead moved into ci/matrix.sh. This script is sourced with only "BUILD_TARGET" being set so that it internally can figure out which other environment variables need to be set. This commit also upgrades the used GCC version to 7. This is due to the use of ubuntu:bionic as base image for the builder image. * Add Jenkinsfiles for regular CI and nightly gitian builds * Automatically download OSX SDK in gitian-build.sh * Remove bogus "export MAKEJOBS=-j5" * Forward cache/src dirs into builder container Fixes caching issues on Travis. * fix * Fail build immediately when building depends took too long
124 lines
4.3 KiB
Plaintext
124 lines
4.3 KiB
Plaintext
def targets = [
|
|
'linux',
|
|
'win',
|
|
'osx',
|
|
]
|
|
|
|
def osslTarUrl = 'http://downloads.sourceforge.net/project/osslsigncode/osslsigncode/osslsigncode-1.7.1.tar.gz'
|
|
def osslPatchUrl = 'https://bitcoincore.org/cfields/osslsigncode-Backports-to-1.7.1.patch'
|
|
def SDK_URL='https://bitcoincore.org/depends-sources/sdks'
|
|
def OSX_SDK='10.11'
|
|
def proc = 4
|
|
def mem = 2000
|
|
|
|
def repositoryUrl = "https://github.com/dashpay/dash.git"
|
|
def commit = "develop"
|
|
|
|
def tasks = [:]
|
|
for(int i = 0; i < targets.size(); i++) {
|
|
def target = targets[i]
|
|
|
|
tasks["${target}"] = {
|
|
node {
|
|
deleteDir() // cleanup workspace
|
|
|
|
def pwd = sh(returnStdout: true, script: 'pwd').trim()
|
|
def dockerGid = sh(returnStdout: true, script: "stat -c '%g' /var/run/docker.sock").trim()
|
|
def BRANCH_NAME = sh(returnStdout: true, script: 'echo $BRANCH_NAME').trim()
|
|
def hasCache = false
|
|
|
|
def gitianDescriptor
|
|
|
|
stage("${target}/prepare") {
|
|
dir('dash') {
|
|
checkout scm
|
|
gitianDescriptor = readYaml file: "contrib/gitian-descriptors/gitian-${target}.yml"
|
|
}
|
|
dir('gitian-builder') {
|
|
git url: 'https://github.com/dashpay/gitian-builder.git'
|
|
}
|
|
sh "mkdir -p dashcore-binaries"
|
|
if (target == "osx") {
|
|
dir('gitian-builder') {
|
|
sh 'mkdir -p inputs'
|
|
sh "curl --location --fail $SDK_URL/MacOSX${OSX_SDK}.sdk.tar.gz -o inputs/MacOSX${OSX_SDK}.sdk.tar.gz"
|
|
}
|
|
}
|
|
|
|
// restore cache
|
|
try {
|
|
copyArtifacts(projectName: "dashpay-dash-gitian-nightly/${BRANCH_NAME}", optional: true, selector: lastSuccessful(), filter: "cache-${gitianDescriptor.name}.tar.gz")
|
|
} catch (Exception e) {
|
|
}
|
|
if (fileExists("cache-${gitianDescriptor.name}.tar.gz")) {
|
|
hasCache = true
|
|
echo "Using cache from dashpay-dash-gitian-nightly/${BRANCH_NAME}"
|
|
} else {
|
|
try {
|
|
copyArtifacts(projectName: 'dashpay-dash-gitian-nightly/develop', optional: true, selector: lastSuccessful(), filter: "cache-${gitianDescriptor.name}.tar.gz");
|
|
} catch (Exception e) {
|
|
}
|
|
if (fileExists("cache-${gitianDescriptor.name}.tar.gz")) {
|
|
hasCache = true
|
|
echo "Using cache from dashpay-dash-gitian-nightly/develop"
|
|
}
|
|
}
|
|
}
|
|
|
|
def gitianImage
|
|
stage("${target}/builder-image") {
|
|
dir('dash') {
|
|
gitianImage = docker.build("dash-gitian:${env.BUILD_ID}", 'ci -f ci/Dockerfile.gitian-builder')
|
|
}
|
|
}
|
|
|
|
gitianImage.inside("--group-add ${dockerGid} -t -v \"/var/run/docker.sock:/var/run/docker.sock\"") {
|
|
sh "mkdir -p gitian-builder/cache"
|
|
if (hasCache) {
|
|
sh "cd gitian-builder/cache && tar xzfv ../../cache-${gitianDescriptor.name}.tar.gz"
|
|
}
|
|
|
|
stage("${target}/download") {
|
|
dir('gitian-builder') {
|
|
sh "mkdir -p inputs"
|
|
sh "cd inputs && curl -R -O ${osslPatchUrl}"
|
|
sh "cd inputs && curl -R -O ${osslTarUrl}"
|
|
sh "make -C ../dash/depends download SOURCES_PATH=`pwd`/cache/common"
|
|
}
|
|
}
|
|
stage("${target}/base-vm") {
|
|
dir('gitian-builder') {
|
|
sh "./bin/make-base-vm --suite trusty --arch amd64 --docker"
|
|
}
|
|
}
|
|
|
|
stage("${target}/gbuild") {
|
|
dir('gitian-builder') {
|
|
// make sure an old version is not running
|
|
sh "docker rm -fv gitian-target || true"
|
|
|
|
try {
|
|
sh """
|
|
tail -F var/install.log &
|
|
tail -F var/build.log &
|
|
USE_DOCKER=1 ./bin/gbuild -j ${proc} -m ${mem} --commit dash=${commit} --url dash=${repositoryUrl} ../dash/contrib/gitian-descriptors/gitian-${target}.yml
|
|
"""
|
|
} finally {
|
|
// make sure it doesn't run forever
|
|
sh "docker rm -fv gitian-target || true"
|
|
}
|
|
sh "mv build/out/dashcore-* ../dashcore-binaries/"
|
|
sh "mv build/out/src/dashcore-* ../dashcore-binaries/"
|
|
}
|
|
archiveArtifacts artifacts: 'dashcore-binaries/*', fingerprint: true
|
|
}
|
|
|
|
sh "cd gitian-builder/cache && tar czfv ../../cache-${gitianDescriptor.name}.tar.gz common ${gitianDescriptor.name}"
|
|
archiveArtifacts artifacts: "cache-${gitianDescriptor.name}.tar.gz", fingerprint: true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
parallel tasks
|