dash/.gitlab-ci.yml
pasta 7530f3d245
Some checks failed
CI / Build Image (push) Failing after 2m9s
CI / Build Dependencies (arm-linux, arm-linux-gnueabihf) (push) Has been skipped
CI / Build Dependencies (linux64, x86_64-pc-linux-gnu) (push) Has been skipped
CI / Build (arm-linux, arm-linux, arm-linux-gnueabihf) (push) Has been skipped
CI / Build (linux64, linux64, x86_64-pc-linux-gnu) (push) Has been skipped
CI / Build (linux64_cxx20, linux64, x86_64-pc-linux-gnu) (push) Has been skipped
CI / Build (linux64_fuzz, linux64, x86_64-pc-linux-gnu) (push) Has been skipped
CI / Build (linux64_nowallet, linux64, x86_64-pc-linux-gnu) (push) Has been skipped
CI / Build (linux64_sqlite, linux64, x86_64-pc-linux-gnu) (push) Has been skipped
CI / Build (linux64_tsan, linux64, x86_64-pc-linux-gnu) (push) Has been skipped
CI / Build (linux64_ubsan, linux64, x86_64-pc-linux-gnu) (push) Has been skipped
Label Merge Conflicts / main (push) Failing after 2m49s
Check Merge Fast-Forward Only / check_merge (push) Successful in 1m51s
Guix Build / build-image (push) Failing after 6m6s
Guix Build / build (aarch64-linux-gnu) (push) Has been skipped
Guix Build / build (arm-linux-gnueabihf) (push) Has been skipped
Guix Build / build (arm64-apple-darwin) (push) Has been skipped
Guix Build / build (x86_64-apple-darwin) (push) Has been skipped
Guix Build / build (powerpc64-linux-gnu) (push) Has been skipped
Guix Build / build (x86_64-linux-gnu) (push) Has been skipped
Guix Build / build (riscv64-linux-gnu) (push) Has been skipped
Guix Build / build (x86_64-w64-mingw32) (push) Has been skipped
Merge #6490: ci: container improvements
04ce1fea52 ci: deduplicate macOS SDK setup logic (Kittywhiskers Van Gogh)
8dd0db7de9 ci: fix "LC_ALL: cannot change locale (en_US.UTF-8)" in Guix container (Kittywhiskers Van Gogh)
187fe17650 ci: don't stage packages in `/tmp`, reduce layers for `cppcheck` build (Kittywhiskers Van Gogh)
eef863554a ci: install `i386` packages only if host is `amd64`, merge layers (Kittywhiskers Van Gogh)
e7702292d1 ci: purge package manager cache after each interaction (Kittywhiskers Van Gogh)
b7099eed47 ci: remove redundant `version` attribute, avoid `lldb` personality error (Kittywhiskers Van Gogh)
64cdc42130 ci: add LLVM library path to `LD_LIBRARY_PATH` and GDB allowlist (Kittywhiskers Van Gogh)
440fd3fe21 ci: drop distro LLVM packages, move Clang install up, set defaults (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  * This pull request pulls container-specific changes from [dash#6387](https://github.com/dashpay/dash/pull/6387), [dash#6400](https://github.com/dashpay/dash/pull/6400) and [dash#6421](https://github.com/dashpay/dash/pull/6421)

  * The `HOST` check before running `setup_sdk.sh` isn't a part of the script itself as the script is written to be independent of external variables set. The caller is expected to know the conditions needed to run `setup_sdk.sh` as the script is _relatively_ agnostic to its environment.

  * The `version` attribute in the [`develop`](a8e2316d6f/contrib/containers/develop/docker-compose.yml) and [`guix`](a8e2316d6f/contrib/containers/guix/docker-compose.yml) container's `docker-compose.yml` has been dropped as the attribute has been deprecated in the compose spec ([source](65ef9f4a5d/spec.md (version-top-level-element-obsolete))).

  * Using `LD_LIBRARY_PATH` to point to LLVM's libraries are acceptable and will not interfere with executing binaries built using the distro's packaged compiler as it will eventually search default paths and find the libraries shipped with the distro ([source](https://man7.org/linux/man-pages/man8/ld.so.8.html)).

  * Currently, running LLDB will result in a "personality set failed: Operation not permitted" error ([source](https://discourse.llvm.org/t/running-lldb-in-a-container/76801)). This is caused by its attempt at disabling ASLR for debugging.

    To work around this error, the container will now operate under relaxed restrictions (`seccomp=unconfined`). As disabling ASLR is valuable when debugging and the container is meant for developers (i.e. it isn't used for CI), we have opted to relax restrictions instead of skipping ASLR disablement.

  * As of `develop` (a8e2316d6f), packages built by the container are stored in `/tmp`, which is inadvisable as it is the same directory used to store functional test runs and it's not too difficult to delete `/tmp`'s contents to save space in a long running [`develop`](a8e2316d6f/contrib/containers/develop/docker-compose.yml) container and then realize that both `shellcheck` and `cppcheck` are stored there and now you have to ditch the container you're working in and restart it.
    * To remedy this, packages are now built and stored in `/opt` in accordance with the FHS ([source](https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s13.html)). `/usr/local` was a contender but it's pre-populated, meanwhile `ls /opt` would give you a very quick picture of what's built for the container.

    * `/tmp` will not be entirely empty because [pypa/pip#10753](https://github.com/pypa/pip/issues/10753) results in residual `.pem` files leaking into `/tmp` and `pyenv` stores its build log there and keeping it around has some debug value.

  ## Breaking Changes

  None expected.

  ## Checklist:

  - [x] I have performed a self-review of my own code
  - [x] I have commented my code, particularly in hard-to-understand areas
  - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)**
  - [x] I have made corresponding changes to the documentation **(note: N/A)**
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  UdjinM6:
    ACK 04ce1fea52
  PastaPastaPasta:
    utACK 04ce1fea52

Tree-SHA512: 5442ae06cb73b9bc4eec908803548195ae8fd9150422789e5f98578ad01a303b5361f9ba42fe8faee27ac91e38328b7771e4ba42b296dfa70ecbbfc7d10436b6
2024-12-16 22:29:09 -06:00

387 lines
9.7 KiB
YAML

image: "ubuntu:jammy"
variables:
DOCKER_DRIVER: overlay2
FAST_MODE: "false" # when "true", only run linter on arm and unit/functional tests on linux64, skip everything else
workflow:
rules:
- when: always
stages:
- builder-image
- build-depends
- build
- test
builder-image:
stage: builder-image
image: docker:20.10.20
services:
- name: docker:20.10.20-dind
command: ["--tls=false"]
variables:
DOCKER_HOST: "tcp://docker:2375"
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
before_script:
- echo $CI_JOB_TOKEN | docker login -u gitlab-ci-token --password-stdin $CI_REGISTRY
script:
- cd contrib/containers/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 .
- docker push $CI_REGISTRY_IMAGE:builder-$CI_COMMIT_REF_SLUG
.build-depends-template:
stage: build-depends
rules:
- when: on_success
needs:
- builder-image
image: $CI_REGISTRY_IMAGE:builder-$CI_COMMIT_REF_SLUG
before_script:
- |
echo HOST=${HOST}
if [[ "${HOST}" == "x86_64-apple-darwin" ]]; then
./contrib/containers/guix/scripts/setup-sdk
fi
script:
- make -j$(nproc) -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:
files:
- contrib/containers/ci/Dockerfile
prefix: ${CI_JOB_NAME}
paths:
- depends/built
- depends/sdk-sources
artifacts:
name: depends-${CI_JOB_NAME}
when: on_success
paths:
- depends/$HOST
- depends/SDKs
.base-template:
image: $CI_REGISTRY_IMAGE:builder-$CI_COMMIT_REF_SLUG
rules:
- when: on_success
before_script:
- export CACHE_DIR=$CI_PROJECT_DIR/cache
- echo BUILD_TARGET=$BUILD_TARGET
- source ./ci/dash/matrix.sh
# Setup some environment variables
- |
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.
if [[ $CI_COMMIT_REF_NAME = "master" ]] || [[ $CI_COMMIT_REF_NAME = "develop" ]] || [[ $CI_COMMIT_REF_NAME =~ ^v([0-9]{1,2}\.)*x$ ]]; then
# These names are reserved for protected branches
export PULL_REQUEST="false"
else
# Everything else including experemental "feat/smth" branches must be merged via PRs, treat them as such
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)"
fi
fi
- 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
.build-template:
stage: build
extends: .base-template
variables:
CCACHE_SIZE: "400M"
script:
- ./ci/dash/build_src.sh
- ./ci/dash/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:
files:
- contrib/containers/ci/Dockerfile
prefix: ${CI_JOB_NAME}
paths:
- cache/ccache
artifacts:
name: build-${BUILD_TARGET}
when: always
paths:
- build-ci
# Exclude some less important binaries to reduce the size of the artifacts
exclude:
- build-ci/dashcore-$BUILD_TARGET/src/**/*.a
- build-ci/dashcore-$BUILD_TARGET/src/**/*.o
- build-ci/dashcore-$BUILD_TARGET/src/bench/bench_dash
- build-ci/dashcore-$BUILD_TARGET/src/bench/bench_dash.exe
- build-ci/dashcore-$BUILD_TARGET/src/qt/test/test_dash-qt
- build-ci/dashcore-$BUILD_TARGET/src/qt/test/test_dash-qt.exe
- build-ci/dashcore-$BUILD_TARGET/src/test/test_dash
- build-ci/dashcore-$BUILD_TARGET/src/test/test_dash.exe
- build-ci/dashcore-$BUILD_TARGET/src/test/fuzz/*
expire_in: 3 days
.test-template:
stage: test
extends: .base-template
variables:
INTEGRATION_TESTS_ARGS: "--extended --exclude feature_pruning,feature_dbcrash"
script:
- echo "INTEGRATION_TESTS_ARGS=${INTEGRATION_TESTS_ARGS}"
- ./ci/dash/test_integrationtests.sh $INTEGRATION_TESTS_ARGS
cache:
# Let all branches share the same cache, which is ok because get_previous_releases.py extracts release binaries in separate folders
key:
files:
# CI files where $PREVIOUS_RELEASES_TO_DOWNLOAD is defined
- ci/test/00_setup_env_native_qt5.sh
prefix: ${CI_JOB_NAME}
paths:
- releases
after_script:
- mkdir -p $CI_PROJECT_DIR/testlogs
artifacts:
name: testlogs
when: always
paths:
- testlogs
expire_in: 3 days
.skip-in-fast-mode-template:
rules:
- if: '$FAST_MODE == "true"'
when: never
- when: on_success
###
arm-linux-gnueabihf:
extends: .build-depends-template
variables:
HOST: arm-linux-gnueabihf
x86_64-w64-mingw32:
extends:
- .build-depends-template
- .skip-in-fast-mode-template
variables:
HOST: x86_64-w64-mingw32
x86_64-pc-linux-gnu_debug:
extends: .build-depends-template
variables:
HOST: x86_64-pc-linux-gnu
DEP_OPTS: "DEBUG=1"
x86_64-pc-linux-gnu_nowallet:
extends:
- .build-depends-template
- .skip-in-fast-mode-template
variables:
HOST: x86_64-pc-linux-gnu
DEP_OPTS: "NO_WALLET=1"
x86_64-pc-linux-gnu_multiprocess:
extends:
- .build-depends-template
- .skip-in-fast-mode-template
variables:
HOST: x86_64-pc-linux-gnu
DEP_OPTS: "DEBUG=1 MULTIPROCESS=1"
x86_64-apple-darwin:
extends:
- .build-depends-template
- .skip-in-fast-mode-template
variables:
HOST: x86_64-apple-darwin
###
arm-linux-build:
extends: .build-template
needs:
- arm-linux-gnueabihf
variables:
BUILD_TARGET: arm-linux
win64-build:
extends:
- .build-template
- .skip-in-fast-mode-template
needs:
- x86_64-w64-mingw32
variables:
BUILD_TARGET: win64
linux64-build:
extends: .build-template
needs:
- x86_64-pc-linux-gnu_debug
variables:
BUILD_TARGET: linux64
linux64_cxx20-build:
extends:
- .build-template
- .skip-in-fast-mode-template
needs:
- x86_64-pc-linux-gnu_debug
variables:
BUILD_TARGET: linux64_cxx20
linux64_sqlite-build:
extends:
- .build-template
- .skip-in-fast-mode-template
needs:
- x86_64-pc-linux-gnu_debug
variables:
BUILD_TARGET: linux64_sqlite
linux64_fuzz-build:
extends:
- .build-template
- .skip-in-fast-mode-template
needs:
- x86_64-pc-linux-gnu_debug
variables:
BUILD_TARGET: linux64_fuzz
#linux64_asan-build:
# extends:
# - .build-template
# - .skip-in-fast-mode-template
# needs:
# - x86_64-pc-linux-gnu_debug
# variables:
# BUILD_TARGET: linux64_asan
linux64_tsan-build:
extends:
- .build-template
- .skip-in-fast-mode-template
needs:
- x86_64-pc-linux-gnu_debug
variables:
BUILD_TARGET: linux64_tsan
linux64_ubsan-build:
extends:
- .build-template
- .skip-in-fast-mode-template
needs:
- x86_64-pc-linux-gnu_debug
variables:
BUILD_TARGET: linux64_ubsan
linux64_nowallet-build:
extends:
- .build-template
- .skip-in-fast-mode-template
needs:
- x86_64-pc-linux-gnu_nowallet
variables:
BUILD_TARGET: linux64_nowallet
linux64_multiprocess-build:
extends:
- .build-template
- .skip-in-fast-mode-template
needs:
- x86_64-pc-linux-gnu_multiprocess
variables:
BUILD_TARGET: linux64_multiprocess
#linux64_valgrind-build:
# extends:
# - .build-template
# - .skip-in-fast-mode-template
# needs:
# - x86_64-pc-linux-gnu_debug
# variables:
# BUILD_TARGET: linux64_valgrind
mac-build:
extends:
- .build-template
- .skip-in-fast-mode-template
needs:
- x86_64-apple-darwin
variables:
BUILD_TARGET: mac
###
linux64-test:
extends: .test-template
needs:
- linux64-build
variables:
BUILD_TARGET: linux64
linux64_sqlite-test:
extends:
- .test-template
- .skip-in-fast-mode-template
needs:
- linux64_sqlite-build
variables:
BUILD_TARGET: linux64_sqlite
#linux64_asan-test:
# extends:
# - .test-template
# - .skip-in-fast-mode-template
# needs:
# - linux64_asan-build
# variables:
# BUILD_TARGET: linux64_asan
linux64_tsan-test:
extends:
- .test-template
- .skip-in-fast-mode-template
needs:
- linux64_tsan-build
variables:
BUILD_TARGET: linux64_tsan
linux64_ubsan-test:
extends:
- .test-template
- .skip-in-fast-mode-template
needs:
- linux64_ubsan-build
variables:
BUILD_TARGET: linux64_ubsan
linux64_multiprocess-test:
extends:
- .test-template
- .skip-in-fast-mode-template
needs:
- linux64_multiprocess-build
variables:
BUILD_TARGET: linux64_multiprocess
#linux64_valgrind-test:
# extends:
# - .test-template
# - .skip-in-fast-mode-template
# needs:
# - linux64_valgrind-build
# variables:
# BUILD_TARGET: linux64_valgrind