.gitlab-ci.yml 20.9 KB
Newer Older
1 2 3 4
# Copyright (c) 2020-2021 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

5 6 7 8 9 10 11 12 13 14 15 16
# Top-level general rules determine when this pipeline is run:
# - only on merge requests, new tags and changes to master
# - NOT on any branch except master
# - will run detached merge request pipelines for any merge request,
#   targeting any branch

workflow:
    rules:
        - if: $CI_MERGE_REQUEST_ID
        - if: $CI_COMMIT_TAG
        - if: $CI_COMMIT_BRANCH == "master"

17 18 19 20
include:
    - template: Code-Quality.gitlab-ci.yml

code_quality:
21 22
    rules:
        - when: on_success
23 24 25
    artifacts:
        paths: [gl-code-quality-report.json]

Dagur's avatar
Dagur committed
26 27 28
image: bitcoincashnode/buildenv:debian

stages:
29
    - static_checks
Dagur's avatar
Dagur committed
30
    - build_depends
Dagur's avatar
Dagur committed
31 32 33
    - build
    - build_tests
    - test
Dagur's avatar
Dagur committed
34
    - deployment
Dagur's avatar
Dagur committed
35 36 37 38

variables:
    # Don't allow tests to hang
    TRAVIS: 1
39
    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
Dagur's avatar
Dagur committed
40

Dagur's avatar
Dagur committed
41 42 43
cache: &global_cache_settings
    paths:
        - ccache/
44 45 46 47 48 49 50 51 52 53 54
        - .cache/pip

## Static checking stages:

# - Two jobs:
#   - One only for master (lint everything)
#   - One for non-master branches incl. merge requests
# - These jobs are set not to fail, but to produce artifacts & reports

static-checks-master:
    stage: static_checks
55 56
    rules:
        - if: $CI_COMMIT_BRANCH == "master"
57
    allow_failure: true
58
    variables:
59 60
        GIT_STRATEGY: clone
        GIT_LFS_SKIP_SMUDGE: 1
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
    script:
        - pip3 install -r .static-checks-python-requirements.txt
        - git clone https://github.com/ekho/checkstyle2junit.git --branch master --single-branch --depth=1 build-aux/checkstyle2junit
        - echo "running static checks for CI_COMMIT_REF_NAME $CI_COMMIT_REF_NAME"
        - arc lint --outfile $CI_PROJECT_DIR/arc_lint-checkstyle.xml --output xml --everything && true; arc_lint_exit_code=$?
        - if [ $arc_lint_exit_code -ne 0 ]; then echo "arc lint command returned non-zero - please inspect the linting report / artifacts"; fi;
        - php build-aux/checkstyle2junit/checkstyle2junit.php $CI_PROJECT_DIR/arc_lint-checkstyle.xml | xmlstarlet fo > $CI_PROJECT_DIR/arc_lint-junit.xml && true; convert_exit_code=$?
        - if [ $convert_exit_code -ne 0 ]; then echo "Error while attempting to convert Checkstyle XML to JUnit XML. Please inspect the linting report / artifacts"; fi;
    artifacts:
        paths:
            - $CI_PROJECT_DIR/arc_lint-checkstyle.xml
            - $CI_PROJECT_DIR/arc_lint-junit.xml
        expire_in: 30 days
        reports:
            junit: $CI_PROJECT_DIR/arc_lint-junit.xml
    cache:
        <<: *global_cache_settings
        key: static_checks_cache
        paths:
            - .cache/pip

static-checks-branch:
    stage: static_checks
84 85
    rules:
        - if: $CI_COMMIT_BRANCH != "master"
86
    allow_failure: true
87
    variables:
88 89
        GIT_STRATEGY: clone
        GIT_LFS_SKIP_SMUDGE: 1
90 91
    script:
        - export GIT_DIR=$CI_PROJECT_DIR/.git
92 93
        # Last merge commit is used as reference for branch starts.
        # MR's should not have merges within them.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
        - export MR_START=`git show :/^Merge --format=format:%H`
        - pip3 install -r .static-checks-python-requirements.txt
        - git clone https://github.com/ekho/checkstyle2junit.git --branch master --single-branch --depth=1 build-aux/checkstyle2junit
        - echo "running static checks for CI_COMMIT_REF_NAME $CI_COMMIT_REF_NAME from $MR_START"
        - arc lint --outfile $CI_PROJECT_DIR/arc_lint-checkstyle.xml --output xml --rev $MR_START^ && true; arc_lint_exit_code=$?
        - if [ $arc_lint_exit_code -ne 0 ]; then echo "arc lint command returned non-zero - please inspect the linting report / artifacts"; fi;
        - php build-aux/checkstyle2junit/checkstyle2junit.php $CI_PROJECT_DIR/arc_lint-checkstyle.xml | xmlstarlet fo > $CI_PROJECT_DIR/arc_lint-junit.xml && true; convert_exit_code=$?
        - if [ $convert_exit_code -ne 0 ]; then echo "Error while attempting to convert Checkstyle XML to JUnit XML. Please inspect the linting report / artifacts"; fi;
    artifacts:
        paths:
            - $CI_PROJECT_DIR/arc_lint-checkstyle.xml
            - $CI_PROJECT_DIR/arc_lint-junit.xml
        expire_in: 30 days
        reports:
            junit: $CI_PROJECT_DIR/arc_lint-junit.xml
    cache:
        <<: *global_cache_settings
        key: static_checks_cache
        paths:
            - .cache/pip
Dagur's avatar
Dagur committed
114

Dagur's avatar
Dagur committed
115 116 117 118 119 120
static-run-linters:
    stage: static_checks
    needs: []
    cache: {}
    script:
        - mkdir build
121 122
        - (cd build; cmake -GNinja ..)
        - (cd build; ninja check-lint)
Dagur's avatar
Dagur committed
123 124
    artifacts:
        paths:
Dagur's avatar
Dagur committed
125
            - build/test/lint
Dagur's avatar
Dagur committed
126

127 128
# Common setup for jobs building binaries using cmake + ninja
.build_common:
Dagur's avatar
Dagur committed
129
    before_script:
130
        - mkdir -p build
Dagur's avatar
Dagur committed
131 132 133 134 135
        - mkdir -p ccache
        - export CCACHE_BASEDIR=${PWD}
        - export CCACHE_DIR=${PWD}/ccache
        - export CCACHE_COMPILERCHECK=content
        - ccache --zero-stats || true
Dagur's avatar
Dagur committed
136

137 138
        # Limit ccache to 3 GB (from default 5 GB).
        # 'ninja all check bench_bitcoin' produces ~2.1GB cache (Jan 2021)
139 140 141 142 143 144 145
        - ccache -M 3G
    after_script:
        # after_script somehow loses CCACHE environent variables.
        - export CCACHE_BASEDIR=${PWD}
        - export CCACHE_DIR=${PWD}/ccache
        - ccache --show-stats

Dagur's avatar
Dagur committed
146
.cache-debian:
147
    extends: .build_common
Dagur's avatar
Dagur committed
148 149 150
    cache:
        <<: *global_cache_settings
        key: debian_cache
Dagur's avatar
Dagur committed
151

Dagur's avatar
Dagur committed
152
.cache-debian-clang:
153
    extends: .build_common
Dagur's avatar
Dagur committed
154 155 156 157
    cache:
        <<: *global_cache_settings
        key: debian_cache_clang

Dagur's avatar
Dagur committed
158
.cache-debian-makefiles:
159
    extends: .build_common
Dagur's avatar
Dagur committed
160 161 162 163
    cache:
        <<: *global_cache_settings
        key: debian_cache_makefiles

Dagur's avatar
Dagur committed
164
.cache-win:
165
    extends: .build_common
Dagur's avatar
Dagur committed
166 167 168 169 170 171 172 173 174 175
    cache:
        <<: *global_cache_settings
        key: win_cache
        paths:
            - ccache/
            - depends/sources
            - depends/built
            - depends/x86_64-w64-mingw32

.cache-arm:
176
    extends: .build_common
Dagur's avatar
Dagur committed
177 178 179 180 181 182 183 184 185
    cache:
        <<: *global_cache_settings
        key: arm_cache
        paths:
            - ccache/
            - depends/sources
            - depends/built
            - depends/arm-linux-gnueabihf

Dagur's avatar
Dagur committed
186
.cache-aarch64:
187
    extends: .build_common
Dagur's avatar
Dagur committed
188 189 190 191 192 193 194 195 196
    cache:
        <<: *global_cache_settings
        key: aarch64_cache
        paths:
            - ccache/
            - depends/sources
            - depends/built
            - depends/aarch64-linux-gnu

Dagur's avatar
Dagur committed
197
.cache-osx:
198
    extends: .build_common
Dagur's avatar
Dagur committed
199 200 201 202 203 204 205 206
    cache:
        <<: *global_cache_settings
        key: osx_cache
        paths:
            - ccache/
            - depends/sources
            - depends/built
            - depends/x86_64-apple-darwin14
Dagur's avatar
Dagur committed
207

Dagur's avatar
Dagur committed
208 209 210 211 212 213 214

.debian-clang-env:
    extends: .cache-debian-clang
    variables:
        CC: clang-8
        CXX: clang++-8

Dagur's avatar
Dagur committed
215 216 217
## Debian native build

build-debian:
Dagur's avatar
Dagur committed
218
    stage: build
Dagur's avatar
Dagur committed
219 220
    extends: .cache-debian
    needs: []
Dagur's avatar
Dagur committed
221
    script:
222
        - (cd build; cmake -GNinja .. -DENABLE_MAN=OFF -DDOC_ONLINE=ON)
223
        - (cd build; ninja)
Dagur's avatar
Dagur committed
224 225 226 227 228

    artifacts:
        paths:
            - build

Dagur's avatar
Dagur committed
229
build-debian-tests:
Dagur's avatar
Dagur committed
230
    stage: build_tests
Dagur's avatar
Dagur committed
231 232
    extends: .cache-debian
    needs: ["build-debian"]
Dagur's avatar
Dagur committed
233
    script:
Dagur's avatar
Dagur committed
234 235 236
        - (cd build; ninja -t restat)
        - (cd build; ninja test_bitcoin)

Dagur's avatar
Dagur committed
237 238
    artifacts:
        paths:
Dagur's avatar
Dagur committed
239 240
            - ./build/src/test/test_bitcoin
            - ./build/src/lib*
Dagur's avatar
Dagur committed
241
    dependencies:
Dagur's avatar
Dagur committed
242
        - build-debian
Dagur's avatar
Dagur committed
243

Dagur's avatar
Dagur committed
244
test-debian-unittests:
Dagur's avatar
Dagur committed
245 246
    stage: test
    cache: {}
Dagur's avatar
Dagur committed
247
    needs: ["build-debian-tests"]
Dagur's avatar
Dagur committed
248
    script:
Mark Lundeberg's avatar
Mark Lundeberg committed
249
        - ./build/src/test/test_bitcoin --logger=HRF:JUNIT,message,junit_unit_tests.xml
Dagur's avatar
Dagur committed
250
    dependencies:
Dagur's avatar
Dagur committed
251
        - build-debian-tests
Mark Lundeberg's avatar
Mark Lundeberg committed
252 253 254
    artifacts:
        reports:
            junit: junit_unit_tests.xml
Dagur's avatar
Dagur committed
255

256 257 258 259 260 261
test-debian-benchmarks:
    stage: test
    extends: .cache-debian
    needs: ["build-debian"]
    script:
        - (cd build; ninja -t restat)
262
        - (cd build; ninja bitcoin-bench; src/bench/bench_bitcoin -evals=1)
263 264 265
    dependencies:
        - build-debian

Dagur's avatar
Dagur committed
266
test-debian-utils:
Dagur's avatar
Dagur committed
267
    stage: test
Dagur's avatar
Dagur committed
268 269 270 271 272 273 274 275 276 277 278 279 280 281
    extends: .cache-debian
    needs: ["build-debian"]
    script:
        - (cd build; ninja -t restat)
        - (cd build; ninja check-bitcoin-qt
              check-bitcoin-seeder
              check-bitcoin-util
              check-devtools
              check-leveldb
              check-rpcauth
              check-secp256k1
              check-univalue)
    dependencies:
        - build-debian
Dagur's avatar
Dagur committed
282

Dagur's avatar
Dagur committed
283 284 285 286
test-debian-functional:
    stage: test
    extends: .cache-debian
    needs: ["build-debian"]
Dagur's avatar
Dagur committed
287 288 289
    rules:
        # These tests are included in the extended run
        - if: $CI_COMMIT_BRANCH != "master"
Dagur's avatar
Dagur committed
290
    script:
Dagur's avatar
Dagur committed
291 292
        - (cd build; ninja -t restat)
        - (cd build; ninja check-functional)
Dagur's avatar
Dagur committed
293
    dependencies:
Dagur's avatar
Dagur committed
294
        - build-debian
Dagur's avatar
Dagur committed
295
    artifacts:
Mark Lundeberg's avatar
Mark Lundeberg committed
296
        when: on_failure
Dagur's avatar
Dagur committed
297 298 299
        paths:
            - build/test/tmp
        expire_in: 30 days
Mark Lundeberg's avatar
Mark Lundeberg committed
300 301
        reports:
            junit: build/test/tmp/*/junit_results.xml
Dagur's avatar
Dagur committed
302

Dagur's avatar
Dagur committed
303
test-debian-functional-extended:
Dagur's avatar
Dagur committed
304 305 306
    stage: test
    extends: .cache-debian
    needs: ["build-debian"]
Dagur's avatar
Dagur committed
307 308
    variables:
        TEST_RUNNER_EXTRA: --coverage
309 310
    rules:
        - if: $CI_COMMIT_BRANCH == "master"
Dagur's avatar
Dagur committed
311 312
    script:
        - (cd build; ninja -t restat)
Dagur's avatar
Dagur committed
313
        - (cd build; ninja check-functional-extended)
Dagur's avatar
Dagur committed
314 315 316 317 318 319 320 321 322 323
    dependencies:
        - build-debian
    artifacts:
        when: on_failure
        paths:
            - build/test/tmp
        expire_in: 30 days
        reports:
            junit: build/test/tmp/*/junit_results.xml

Dagur's avatar
Dagur committed
324 325 326 327
deploy-debian:
    stage: deployment
    extends: .cache-debian
    needs: ["build-debian"]
Dagur's avatar
Dagur committed
328
    script:
Dagur's avatar
Dagur committed
329 330
        - (cd build; ninja -t restat)
        - (cd build; ninja package)
Dagur's avatar
Dagur committed
331
    dependencies:
Dagur's avatar
Dagur committed
332
        - build-debian
Dagur's avatar
Dagur committed
333

Dagur's avatar
Dagur committed
334 335 336 337 338 339 340
## Debian native build without wallet

build-debian-nowallet:
    stage: build
    extends: .cache-debian
    needs: []
    script:
341
        - (cd build; cmake -GNinja .. -DENABLE_MAN=OFF -DBUILD_BITCOIN_WALLET=OFF)
342
        - (cd build; ninja)
Dagur's avatar
Dagur committed
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367

    artifacts:
        paths:
            - build

build-debian-nowallet-tests:
    stage: build_tests
    extends: .cache-debian
    needs: ["build-debian-nowallet"]
    script:
        - (cd build; ninja -t restat)
        - (cd build; ninja test_bitcoin)

    artifacts:
        paths:
            - ./build/src/test/test_bitcoin
            - ./build/src/lib*
    dependencies:
        - build-debian-nowallet

test-debian-nowallet-unittests:
    stage: test
    cache: {}
    needs: ["build-debian-nowallet-tests"]
    script:
Mark Lundeberg's avatar
Mark Lundeberg committed
368
        - ./build/src/test/test_bitcoin --logger=HRF:JUNIT,message,junit_unit_tests.xml
Dagur's avatar
Dagur committed
369 370
    dependencies:
        - build-debian-nowallet-tests
Mark Lundeberg's avatar
Mark Lundeberg committed
371 372 373
    artifacts:
        reports:
            junit: junit_unit_tests.xml
Dagur's avatar
Dagur committed
374

375 376 377 378
test-debian-nowallet-functional:
    stage: test
    extends: .cache-debian
    needs: ["build-debian-nowallet"]
Dagur's avatar
Dagur committed
379 380 381
    rules:
        # These tests are included in the extended run
        - if: $CI_COMMIT_BRANCH != "master"
382 383 384 385 386 387 388 389 390 391 392 393 394
    script:
        - (cd build; ninja -t restat)
        - (cd build; ninja check-functional)
    dependencies:
        - build-debian-nowallet
    artifacts:
        when: on_failure
        paths:
            - build/test/tmp
        expire_in: 30 days
        reports:
            junit: build/test/tmp/*/junit_results.xml

Dagur's avatar
Dagur committed
395
test-debian-nowallet-functional-extended:
396 397 398
    stage: test
    extends: .cache-debian
    needs: ["build-debian-nowallet"]
Dagur's avatar
Dagur committed
399 400
    variables:
        TEST_RUNNER_EXTRA: --coverage
401 402
    rules:
        - if: $CI_COMMIT_BRANCH == "master"
403 404 405 406 407 408 409 410 411 412 413 414 415
    script:
        - (cd build; ninja -t restat)
        - (cd build; ninja check-functional-longeronly)
    dependencies:
        - build-debian-nowallet
    artifacts:
        when: on_failure
        paths:
            - build/test/tmp
        expire_in: 30 days
        reports:
            junit: build/test/tmp/*/junit_results.xml

Dagur's avatar
Dagur committed
416 417 418 419 420 421
## Debian native with clang compiler
build-debian-clang:
    stage: build
    extends: .debian-clang-env
    needs: []
    script:
422
        - (cd build; cmake -GNinja .. -DENABLE_MAN=OFF)
423
        - (cd build; ninja)
Dagur's avatar
Dagur committed
424 425 426 427 428

    artifacts:
        paths:
            - build

Dagur's avatar
Dagur committed
429 430 431 432 433 434
## Debian native with unix makefiles.
build-debian-makefiles:
    stage: build
    extends: .cache-debian-makefiles
    needs: []
    script:
435
        - (cd build; cmake -G"Unix Makefiles" .. -DENABLE_MAN=OFF)
436
        - (cd build; make -j`nproc`)
Dagur's avatar
Dagur committed
437

Dagur's avatar
Dagur committed
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488
build-debian-tests-clang:
    stage: build_tests
    extends: .debian-clang-env
    needs: ["build-debian-clang"]
    script:
        - (cd build; ninja -t restat)
        - (cd build; ninja test_bitcoin)

    artifacts:
        paths:
            - ./build/src/test/test_bitcoin
            - ./build/src/lib*
    dependencies:
        - build-debian-clang

test-debian-unittests-clang:
    stage: test
    cache: {}
    needs: ["build-debian-tests-clang"]
    script:
        - ./build/src/test/test_bitcoin --logger=HRF:JUNIT,message,junit_unit_tests.xml
    dependencies:
        - build-debian-tests-clang
    artifacts:
        reports:
            junit: junit_unit_tests.xml

test-debian-utils-clang:
    stage: test
    extends: .debian-clang-env
    needs: ["build-debian-clang"]
    script:
        - (cd build; ninja -t restat)
        - (cd build; ninja check-bitcoin-qt
              check-bitcoin-seeder
              check-bitcoin-util
              check-devtools
              check-leveldb
              check-rpcauth
              check-secp256k1
              check-univalue)
    dependencies:
        - build-debian-clang


test-debian-benchmarks-clang:
    stage: test
    extends: .debian-clang-env
    needs: ["build-debian-clang"]
    script:
        - (cd build; ninja -t restat)
489
        - (cd build; ninja bitcoin-bench; src/bench/bench_bitcoin -evals=1)
Dagur's avatar
Dagur committed
490 491
    dependencies:
        - build-debian-clang
Dagur's avatar
Dagur committed
492

Dagur's avatar
Dagur committed
493 494 495
## Debian native Debug build

.cache-debian-debug:
496 497 498 499
    extends: .build_common
    cache:
        <<: *global_cache_settings
        key: debian_debug_cache
Dagur's avatar
Dagur committed
500 501

build-debian-debug:
502 503 504 505
    stage: build
    extends: .cache-debian-debug
    needs: []
    script:
506
        - (cd build; cmake -GNinja .. -DENABLE_MAN=OFF -DCMAKE_BUILD_TYPE=Debug)
507 508 509 510 511
        - (cd build; ninja)

    artifacts:
        paths:
            - build
Dagur's avatar
Dagur committed
512 513

build-debian-debug-tests:
514 515 516 517 518 519 520 521 522 523 524 525
    stage: build_tests
    extends: .cache-debian-debug
    needs: ["build-debian-debug"]
    dependencies:
        - build-debian-debug
    script:
        - (cd build; ninja -t restat)
        - (cd build; ninja test_bitcoin)
    artifacts:
        paths:
            - ./build/src/test/test_bitcoin
            - ./build/src/lib*
Dagur's avatar
Dagur committed
526 527

test-debian-debug-unittests:
528 529 530 531 532 533 534 535 536 537 538
    stage: test
    cache: {}
    needs: ["build-debian-debug-tests"]
    dependencies:
        - build-debian-debug-tests
    script:
        - ./build/src/test/test_bitcoin
            --logger=HRF:JUNIT,message,junit_unit_tests.xml
    artifacts:
        reports:
            junit: junit_unit_tests.xml
Dagur's avatar
Dagur committed
539 540 541 542

## Debian native Debug build with clang

.cache-debian-debug-clang:
543
    extends: .build_common
Dagur's avatar
Dagur committed
544 545
    cache:
        <<: *global_cache_settings
546
        key: debian_debug_clang_cache
Dagur's avatar
Dagur committed
547 548 549 550 551 552 553 554 555 556 557 558

.debian-debug-clang-env:
    extends: .cache-debian-debug-clang
    variables:
        CC: clang-8
        CXX: clang++-8

build-debian-debug-clang:
    stage: build
    extends: .debian-debug-clang-env
    needs: []
    script:
559
        - (cd build; cmake -GNinja .. -DENABLE_MAN=OFF -DCMAKE_BUILD_TYPE=Debug)
560
        - (cd build; ninja)
Dagur's avatar
Dagur committed
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593

    artifacts:
        paths:
            - build

build-debian-debug-clang-tests:
    stage: build_tests
    extends: .debian-debug-clang-env
    needs: ["build-debian-debug-clang"]
    dependencies:
        - build-debian-debug-clang
    script:
        - (cd build; ninja -t restat)
        - (cd build; ninja test_bitcoin)

    artifacts:
        paths:
            - ./build/src/test/test_bitcoin
            - ./build/src/lib*

test-debian-debug-clang-unittests:
    stage: test
    cache: {}
    needs: ["build-debian-debug-clang-tests"]
    dependencies:
        - build-debian-debug-clang-tests
    script:
        - ./build/src/test/test_bitcoin
          --logger=HRF:JUNIT,message,junit_unit_tests.xml
    artifacts:
        reports:
            junit: junit_unit_tests.xml

Dagur's avatar
Dagur committed
594 595 596 597 598
## Windows build

build-win-64-depends:
    stage: build_depends
    extends: .cache-win
Dagur's avatar
Dagur committed
599
    needs: []
Dagur's avatar
Dagur committed
600 601 602 603 604 605 606 607 608 609 610
    script:
        - (cd depends; make build-win64 HOST=x86_64-w64-mingw32 NO_QT=1 JOBS=`nproc`)
    artifacts:
        paths:
            - depends/x86_64-w64-mingw32

build-win-64:
    stage: build
    extends: .cache-win
    needs: ["build-win-64-depends"]
    script:
611
        - cd build
612 613
        - cmake -GNinja .. -DENABLE_MAN=OFF
                           -DBUILD_BITCOIN_QT=OFF
Dagur's avatar
Dagur committed
614 615 616 617 618 619 620 621 622 623 624
                           -DBUILD_BITCOIN_SEEDER=OFF
                           -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/Win64.cmake
        - ninja
    dependencies:
        - build-win-64-depends

## ARM build

build-arm-depends:
    stage: build_depends
    extends: .cache-arm
Dagur's avatar
Dagur committed
625
    needs: []
Dagur's avatar
Dagur committed
626 627 628 629 630 631 632 633 634 635 636 637
    script:
        - (cd depends; make build-linux-arm
            HOST=aarch64-linux-gnu NO_QT=1 JOBS=`nproc`)
    artifacts:
        paths:
            - depends/arm-linux-gnueabihf

build-arm:
    stage: build
    extends: .cache-arm
    needs: ["build-arm-depends"]
    script:
638
        - cd build
639 640
        - cmake -GNinja .. -DENABLE_MAN=OFF
                           -DBUILD_BITCOIN_QT=OFF
Dagur's avatar
Dagur committed
641 642 643 644 645 646 647
                           -DBUILD_BITCOIN_SEEDER=OFF
                           -DENABLE_GLIBC_BACK_COMPAT=ON
                           -DENABLE_STATIC_LIBSTDCXX=ON
                           -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/LinuxARM.cmake
        - ninja
    dependencies:
        - build-arm-depends
Dagur's avatar
Dagur committed
648

Dagur's avatar
Dagur committed
649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666
## AArch64 build

build-aarch64-depends:
    stage: build_depends
    extends: .cache-aarch64
    needs: []
    script:
        - (cd depends; make build-linux-aarch64 -j `nproc`)
    artifacts:
        paths:
            - depends/aarch64-linux-gnu

build-aarch64:
    stage: build
    extends: .cache-aarch64
    needs: ["build-aarch64-depends"]
    script:
        - cd build
667 668
        # The following tests are excluded:
        # - bchn-rpc-getblocktemplate-sigops - OOM issues for aarch64 (see #211)
669 670
        - cmake -GNinja .. -DENABLE_MAN=OFF
                           -DBUILD_BITCOIN_ZMQ=OFF
Dagur's avatar
Dagur committed
671 672
                           -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/LinuxAArch64.cmake
                           -DCMAKE_CROSSCOMPILING_EMULATOR=$(command -v qemu-aarch64-static)
673
                           -DEXCLUDE_FUNCTIONAL_TESTS=bchn-rpc-getblocktemplate-sigops
Dagur's avatar
Dagur committed
674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717
        - ninja
    dependencies:
        - build-aarch64-depends
    artifacts:
        paths:
            - build

build-aarch64-tests:
    stage: build_tests
    extends: .cache-aarch64
    needs: ["build-aarch64"]
    script:
        - (cd build; ninja -t restat)
        - (cd build; ninja test_bitcoin)

    artifacts:
        paths:
            - ./build/src/test/test_bitcoin
            - ./build/src/lib*
    dependencies:
        - build-aarch64

test-aarch64-unittests:
    stage: test
    cache: {}
    needs: ["build-aarch64-tests"]
    variables:
        QEMU_LD_PREFIX: /usr/aarch64-linux-gnu
    script:
        - $(command -v qemu-aarch64-static) ./build/src/test/test_bitcoin --logger=HRF:JUNIT,message,junit_unit_tests.xml
    dependencies:
        - build-aarch64-tests
    artifacts:
        reports:
            junit: junit_unit_tests.xml

test-aarch64-functional:
    stage: test
    extends: .cache-aarch64
    needs: ["build-aarch64"]
    variables:
        QEMU_LD_PREFIX: /usr/aarch64-linux-gnu
    script:
        - (cd build; ninja -t restat)
718 719 720 721
        - export NON_TESTS="example_test|test_runner|combine_logs|create_cache"
        - export LONG_TESTS="abc-p2p-compactblocks|abc-p2p-fullblocktest|feature_block|feature_dbcrash|feature_pruning|mining_getblocktemplate_longpoll|p2p_timeouts|wallet_backup"
        - export EXCLUDED_TESTS="getblocktemplate_errors|getblocktemplate-timing"
        - (cd build; test/functional/test_runner.py `ls -1 ../test/functional/*.py | xargs -n 1 basename | egrep -v "($NON_TESTS|$LONG_TESTS|$EXCLUDED_TESTS)"`)
Dagur's avatar
Dagur committed
722 723 724 725 726 727 728 729 730 731 732
    dependencies:
        - build-aarch64
    artifacts:
        when: on_failure
        paths:
            - build/test/tmp
        expire_in: 30 days
        reports:
            junit: build/test/tmp/*/junit_results.xml

## Fuzzers
Dagur's avatar
Dagur committed
733 734 735 736 737 738 739 740 741 742
fuzz-libfuzzer:
    stage: test
    extends: .debian-clang-env
    needs: []
    rules:
        - if: $CI_COMMIT_BRANCH == "master"
    script:
        - git clone --branch master --single-branch --depth=1 https://gitlab.com/bitcoin-cash-node/bchn-sw/qa-assets
        - mkdir buildFuzzer
        - cd buildFuzzer
743
        - cmake -GNinja .. -DENABLE_MAN=OFF -DCCACHE=OFF -DENABLE_SANITIZERS="fuzzer;address"
Dagur's avatar
Dagur committed
744 745 746
        - ninja bitcoin-fuzzers link-fuzz-test_runner.py
        - ./test/fuzz/test_runner.py -l DEBUG ../qa-assets/fuzz_seed_corpus/

Dagur's avatar
Dagur committed
747 748 749
## Deploy documentation
pages:
    stage: deployment
750
    extends: .cache-debian
751
    needs: ["build-debian"]
Dagur's avatar
Dagur committed
752 753 754 755 756
    cache:
        key: docs
        paths:
            - .cache/pip
    before_script:
757 758
        - pip3 install mkdocs mkdocs-material
    script:
759 760 761 762 763
        - (cd build; ninja -t restat)
        - (cd build; ninja doc-html)
        - mv build/doc/html public
    dependencies:
        - build-debian
Dagur's avatar
Dagur committed
764 765 766
    artifacts:
        paths:
            - public
767 768
    rules:
        - if: $CI_COMMIT_BRANCH == "master"