diff --git a/contrib/teamcity/build-configurations.json b/contrib/teamcity/build-configurations.json --- a/contrib/teamcity/build-configurations.json +++ b/contrib/teamcity/build-configurations.json @@ -16,6 +16,13 @@ "src/seeder/test/*.log": "log/seeder", "test/tmp/*": "functional" } + }, + "gitian_builds": { + "script": "gitian.sh", + "timeout": 7200, + "artifacts": { + "gitian-results": "" + } } }, "builds": { @@ -193,6 +200,24 @@ "script": "builds/check-seeds.sh", "template": "common_unix_artifacts", "timeout": 600 + }, + "gitian-linux": { + "template": "gitian_builds", + "environment": { + "OS_NAME": "linux" + } + }, + "gitian-osx": { + "template": "gitian_builds", + "environment": { + "OS_NAME": "osx" + } + }, + "gitian-win": { + "template": "gitian_builds", + "environment": { + "OS_NAME": "win" + } } } } diff --git a/contrib/teamcity/build-configurations.py b/contrib/teamcity/build-configurations.py --- a/contrib/teamcity/build-configurations.py +++ b/contrib/teamcity/build-configurations.py @@ -88,7 +88,7 @@ templates.get(template_name, {}), build) # Make sure there is a script file associated with the build... - script = build.get("script", None) + script = self.config.get("script", None) if script is None: raise AssertionError( "No script provided for the build {}".format( diff --git a/contrib/teamcity/gitian.sh b/contrib/teamcity/gitian.sh --- a/contrib/teamcity/gitian.sh +++ b/contrib/teamcity/gitian.sh @@ -4,12 +4,12 @@ set -euxo pipefail -cd "$(dirname "$0")" +: "${TOPLEVEL:=$(git rev-parse --show-toplevel)}" +: "${BUILD_DIR:=${TOPLEVEL}/build}" +: "${THREADS:=$(nproc || sysctl -n hw.ncpu)}" -COMMIT=$(git rev-parse HEAD) +COMMIT=$(git -C "${TOPLEVEL}" rev-parse HEAD) export COMMIT -PROJECT_ROOT=$(git rev-parse --show-toplevel) -export PROJECT_ROOT export USE_LXC=1 export GITIAN_HOST_IP=10.0.3.1 export LXC_BRIDGE=lxcbr0 @@ -30,10 +30,7 @@ popd fi -## Determine the number of build threads -THREADS=$(nproc || sysctl -n hw.ncpu) - -RESULT_DIR="${PROJECT_ROOT}/gitian-results" +RESULT_DIR="${BUILD_DIR}/gitian-results" OS_DIR="${RESULT_DIR}/${OS_NAME}" mkdir -p "${OS_DIR}" @@ -43,7 +40,7 @@ } trap "move_log" ERR -./bin/gbuild -j${THREADS} -m3500 --commit bitcoin=${COMMIT} --url bitcoin="${PROJECT_ROOT}" "${PROJECT_ROOT}/contrib/gitian-descriptors/gitian-${OS_NAME}.yml" +./bin/gbuild -j${THREADS} -m3500 --commit bitcoin=${COMMIT} --url bitcoin="${TOPLEVEL}" "${TOPLEVEL}/contrib/gitian-descriptors/gitian-${OS_NAME}.yml" move_log mv result/*.yml "${OS_DIR}/"