2019-10-16 11:48:46 +02:00
image : "ubuntu:bionic"
variables :
DOCKER_DRIVER : overlay2
2020-08-01 22:03:35 +02:00
FAST_MODE : "false" # when "true", only run linter on arm and unit/functional tests on linux64, skip everything else
2019-10-16 11:48:46 +02:00
2020-08-30 16:24:26 +02:00
workflow :
rules :
- when : always
2019-10-16 11:48:46 +02:00
stages :
2020-03-27 22:58:51 +01:00
- builder-image
- build-depends
2019-10-16 11:48:46 +02:00
- build
2020-03-27 22:58:51 +01:00
- test
builder-image :
stage : builder-image
image : docker:19.03.5
services :
- docker:19.03.5-dind
variables :
DOCKER_HOST : "tcp://docker:2375"
DOCKER_DRIVER : overlay2
DOCKER_TLS_CERTDIR : ""
2019-10-16 11:48:46 +02:00
before_script :
2020-03-27 22:58:51 +01:00
- echo $CI_JOB_TOKEN | docker login -u gitlab-ci-token --password-stdin $CI_REGISTRY
script :
- cd ci
- docker pull $CI_REGISTRY_IMAGE:builder-$CI_COMMIT_REF_SLUG || true
- docker pull $CI_REGISTRY_IMAGE:builder-develop || true
- docker build --cache-from $CI_REGISTRY_IMAGE:builder-$CI_COMMIT_REF_SLUG --cache-from $CI_REGISTRY_IMAGE:builder-develop -t $CI_REGISTRY_IMAGE:builder-$CI_COMMIT_REF_SLUG -f Dockerfile.builder .
- docker push $CI_REGISTRY_IMAGE:builder-$CI_COMMIT_REF_SLUG
.build-depends-template :
stage : build-depends
image : $CI_REGISTRY_IMAGE:builder-$CI_COMMIT_REF_SLUG
variables :
SDK_URL : https://bitcoincore.org/depends-sources/sdks
2021-08-25 17:10:23 +02:00
OSX_SDK : "10.14"
2020-03-27 22:58:51 +01:00
MAKEJOBS : -j4
before_script :
- echo HOST=$HOST
2019-10-16 11:48:46 +02:00
- |
2019-11-21 17:08:47 +01:00
if [ "$HOST" = "x86_64-apple-darwin16" ]; then
2020-03-27 22:58:51 +01:00
echo "Downloading MacOS SDK"
mkdir -p depends/SDKs
mkdir -p depends/sdk-sources
if [ ! -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then
curl --location --fail $SDK_URL/MacOSX${OSX_SDK}.sdk.tar.gz -o depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz
2019-10-16 11:48:46 +02:00
fi
2020-03-27 22:58:51 +01:00
tar -C depends/SDKs -xf depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz
2019-10-16 11:48:46 +02:00
fi
2020-03-27 22:58:51 +01:00
script :
- make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS
cache :
# Let all branches share the same cache, which is ok because the depends subsystem is able to handle this properly (it works with hashes of all scripts)
key : ${CI_JOB_NAME}
paths :
- $CI_PROJECT_DIR/depends/built
- $CI_PROJECT_DIR/depends/sdk-sources
artifacts :
name : depends
when : on_success
paths :
- $CI_PROJECT_DIR/depends/$HOST
- $CI_PROJECT_DIR/depends/SDKs
2019-10-16 11:48:46 +02:00
2020-03-27 22:58:51 +01:00
.base-template :
image : $CI_REGISTRY_IMAGE:builder-$CI_COMMIT_REF_SLUG
before_script :
- export CACHE_DIR=$CI_PROJECT_DIR/cache
- echo BUILD_TARGET=$BUILD_TARGET
- source ./ci/matrix.sh
2019-10-16 11:48:46 +02:00
# Setup some environment variables
2019-12-31 11:02:03 +01:00
- |
if [ "$CI_EXTERNAL_PULL_REQUEST_IID" != "" ]; then
export PULL_REQUEST="true"
else
# CI_EXTERNAL_PULL_REQUEST_IID is false every time until https://gitlab.com/gitlab-org/gitlab/issues/5667 is done
# Until then, we're using https://github.com/brndnmtthws/labhub atm to mirror Github pull requests as branches into Gitlab,
# which allows us to use Gitlab CI for Github. The following check detects such mirrored branches.
if [[ $CI_COMMIT_REF_NAME =~ ^pr-[^/]*/[^/]*/[^/]*/[^/]*$ ]]; then
export PULL_REQUEST="true"
# CI_COMMIT_BEFORE_SHA is also invalid until #5667 is implemented, so we need to figure it out by ourself
git fetch origin develop
export CI_COMMIT_BEFORE_SHA="$(git merge-base origin/develop HEAD)"
else
export PULL_REQUEST="false"
fi
fi
2019-10-16 11:48:46 +02:00
- export COMMIT_RANGE="$CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA"
- export JOB_NUMBER="$CI_JOB_ID"
- export HOST_SRC_DIR=$CI_PROJECT_DIR
- echo PULL_REQUEST=$PULL_REQUEST COMMIT_RANGE=$COMMIT_RANGE HOST_SRC_DIR=$HOST_SRC_DIR CACHE_DIR=$CACHE_DIR
- echo "Commit log:" && git log --format=fuller -1
2020-03-27 22:58:51 +01:00
.build-template :
stage : build
extends : .base-template
2019-10-16 11:48:46 +02:00
script :
- ./ci/build_src.sh
2020-03-27 22:58:51 +01:00
- ./ci/test_unittests.sh # Run unit tests in build stage to avoid creating too many parallel jobs
cache :
# Let all branches share the same cache, which is ok because ccache is able to handle it
key : ${CI_JOB_NAME}
paths :
- $CI_PROJECT_DIR/cache/ccache
artifacts :
name : binaries
when : always
paths :
- $CI_PROJECT_DIR/build-ci
expire_in : 3 days
2019-10-16 11:48:46 +02:00
2020-03-27 22:58:51 +01:00
.test-template :
stage : test
extends : .base-template
2020-07-14 15:12:54 +02:00
variables :
2020-07-17 01:44:20 +02:00
INTEGRATION_TESTS_ARGS : "--extended --exclude feature_pruning,feature_dbcrash"
2020-03-27 22:58:51 +01:00
script :
2020-07-14 15:12:54 +02:00
- echo "INTEGRATION_TESTS_ARGS=${INTEGRATION_TESTS_ARGS}"
- ./ci/test_integrationtests.sh $INTEGRATION_TESTS_ARGS
2019-10-16 11:48:46 +02:00
after_script :
- mkdir -p $CI_PROJECT_DIR/testlogs
artifacts :
2020-03-27 22:58:51 +01:00
name : testlogs
2019-10-16 11:48:46 +02:00
when : always
paths :
- $CI_PROJECT_DIR/testlogs
expire_in : 3 days
2020-08-01 22:03:35 +02:00
.skip-in-fast-mode-template :
rules :
- if : '$FAST_MODE == "true"'
when : never
- when : always
2020-03-27 22:58:51 +01:00
###
arm-linux-gnueabihf :
extends : .build-depends-template
variables :
HOST : arm-linux-gnueabihf
x86_64-w64-mingw32 :
2020-08-01 22:03:35 +02:00
extends :
- .build-depends-template
- .skip-in-fast-mode-template
2020-03-27 22:58:51 +01:00
variables :
HOST : x86_64-w64-mingw32
i686-pc-linux-gnu :
2020-08-01 22:03:35 +02:00
extends :
- .build-depends-template
- .skip-in-fast-mode-template
2020-03-27 22:58:51 +01:00
variables :
HOST : i686-pc-linux-gnu
x86_64-unknown-linux-gnu-debug :
extends : .build-depends-template
variables :
HOST : x86_64-unknown-linux-gnu
DEP_OPTS : "DEBUG=1"
2021-02-17 21:13:33 +01:00
x86_64-unknown-linux-gnu-nowallet :
2020-08-01 22:03:35 +02:00
extends :
- .build-depends-template
- .skip-in-fast-mode-template
2020-05-18 14:26:53 +02:00
variables :
HOST : x86_64-unknown-linux-gnu
DEP_OPTS : "NO_WALLET=1"
x86_64-unknown-linux-gnu-release :
2020-08-01 22:03:35 +02:00
extends :
- .build-depends-template
- .skip-in-fast-mode-template
2020-05-18 14:26:53 +02:00
variables :
HOST : x86_64-unknown-linux-gnu
DEP_OPTS : "NO_UPNP=1"
2019-11-21 17:08:47 +01:00
x86_64-apple-darwin16 :
2020-08-01 22:03:35 +02:00
extends :
- .build-depends-template
- .skip-in-fast-mode-template
2020-03-27 22:58:51 +01:00
variables :
2019-11-21 17:08:47 +01:00
HOST : x86_64-apple-darwin16
2020-03-27 22:58:51 +01:00
###
arm-linux-build :
extends : .build-template
needs :
- arm-linux-gnueabihf
variables :
BUILD_TARGET : arm-linux
win64-build :
2020-08-01 22:03:35 +02:00
extends :
- .build-template
- .skip-in-fast-mode-template
2020-03-27 22:58:51 +01:00
needs :
- x86_64-w64-mingw32
variables :
BUILD_TARGET : win64
linux32-build :
2020-08-01 22:03:35 +02:00
extends :
- .build-template
- .skip-in-fast-mode-template
2020-03-27 22:58:51 +01:00
needs :
- i686-pc-linux-gnu
variables :
BUILD_TARGET : linux32
linux64-build :
extends : .build-template
needs :
- x86_64-unknown-linux-gnu-debug
variables :
BUILD_TARGET : linux64
2021-04-28 16:44:01 +02:00
linux64_cxx17-build :
extends : .build-template
needs :
- x86_64-unknown-linux-gnu-debug
variables :
BUILD_TARGET : linux64_cxx17
2020-03-27 22:58:51 +01:00
linux64_nowallet-build :
2020-08-01 22:03:35 +02:00
extends :
- .build-template
- .skip-in-fast-mode-template
2020-03-27 22:58:51 +01:00
needs :
2021-02-17 21:13:33 +01:00
- x86_64-unknown-linux-gnu-nowallet
2020-03-27 22:58:51 +01:00
variables :
BUILD_TARGET : linux64_nowallet
linux64_release-build :
2020-08-01 22:03:35 +02:00
extends :
- .build-template
- .skip-in-fast-mode-template
2020-03-27 22:58:51 +01:00
needs :
2020-05-18 14:26:53 +02:00
- x86_64-unknown-linux-gnu-release
2020-03-27 22:58:51 +01:00
variables :
BUILD_TARGET : linux64_release
mac-build :
2020-08-01 22:03:35 +02:00
extends :
- .build-template
- .skip-in-fast-mode-template
2020-03-27 22:58:51 +01:00
needs :
2019-11-21 17:08:47 +01:00
- x86_64-apple-darwin16
2020-03-27 22:58:51 +01:00
variables :
BUILD_TARGET : mac
###
linux32-test :
2020-08-01 22:03:35 +02:00
extends :
- .test-template
- .skip-in-fast-mode-template
2020-03-27 22:58:51 +01:00
needs :
- linux32-build
variables :
BUILD_TARGET : linux32
linux64-test :
extends : .test-template
needs :
- linux64-build
variables :
BUILD_TARGET : linux64