swh:1:snp:9c27352633c4639a943e316050a7b904f57900e2
Raw File
Tip revision: 905f30333926a9009ad1c5dfff270d39c9d70c20 authored by Pietro on 06 November 2020, 12:22:56 UTC
WIP: add shellcheck to .gitlab-ci
Tip revision: 905f303
.gitlab-ci.yml
---

variables:
  ## Please update `scripts/version.sh` accordingly
  build_deps_image_version: 1adce2a7a54b71fe114c56c979beb15aec7b313f
  build_deps_image_name: registry.gitlab.com/tezos/opam-repository
  public_docker_image_name: docker.io/${CI_PROJECT_PATH}
  GIT_STRATEGY: fetch
  GIT_DEPTH: "1"
  GET_SOURCES_ATTEMPTS: "2"
  ARTIFACT_DOWNLOAD_ATTEMPTS: "2"

stages:
  - sanity
  - build
  - test
  - doc
  - packaging
  - publish
  - test_coverage
  - publish_coverage

############################################################
## Stage: sanity (fast self-checks)                       ##
############################################################

sanity:
  image: ${build_deps_image_name}:${build_deps_image_version}
  stage: sanity
  before_script:
    - . ./scripts/version.sh
  script:
    - if [ "${build_deps_image_version}" != "${opam_repository_tag}" ] ; then
        echo "Inconsistent dependencies hash between 'scripts/version.sh' and '.gitlab-ci.yml'." ;
        echo "${build_deps_image_version} != ${opam_repository_tag}" ;
        exit 1 ;
      fi
    - scripts/check_opam_test.sh
    - src/tooling/lint.sh --check-gitlab-ci-yml
    # Ensures that the local poetry.lock and pyproject.toml are synchronized 
    # with those of the base image.
    - diff tests_python/poetry.lock /home/tezos/poetry.lock
    - diff tests_python/pyproject.toml /home/tezos/pyproject.toml
  interruptible: true

############################################################
## Stage: build (only MR)                                 ##
############################################################

.build_template: &build_definition
  image: ${build_deps_image_name}:${build_deps_image_version}
  stage: build
  except:
    - master
    - zeronet
    - mainnet
    - zeronet-staging
    - mainnet-staging
    - zeronet-snapshots
    - mainnet-snapshots
    - latest-release
    - tags
  before_script:
    - . ./scripts/version.sh
    # Load the environment poetry previously created in the docker image.
    # Give access to the Python dependencies/executables
    - . $HOME/.venv/bin/activate
  interruptible: true

check_opam_deps:
  <<: *build_definition
  script:
    - ./scripts/opam-check.sh

check_opam_lint:
  <<: *build_definition
  script:
    - find . ! -path "./_opam/*" -name "*.opam" -exec opam lint {} +;

check_linting:
  <<: *build_definition
  script:
    - sudo apk add shellcheck
    - make check-linting

check_python_linting:
  <<: *build_definition
  script:
    - make check-python-linting

check_python_types:
  <<: *build_definition
  script:
    - make -C tests_python typecheck

check_precommit_hook:
  <<: *build_definition
  script:
    - ./scripts/pre_commit/pre_commit.py --test-itself

check_scripts_b58_prefix:
  # Can be changed to a python image, but using the build docker image to keep
  # in sync with the python version used for the tests
  <<: *build_definition
  before_script:
    - cd scripts/b58_prefix
    - poetry install
  script:
    - poetry run pylint b58_prefix.py --disable=missing-docstring --disable=invalid-name
    - poetry run pytest test_b58_prefix.py -v

build:
  <<: *build_definition
  script:
    - . ./scripts/version.sh
    - dune build @runtest_dune_template
    - make all build-test
    - opam clean
  cache:
    key: "$CI_COMMIT_REF_SLUG"
    paths:
      - _build
      - tezos-*
  artifacts:
    name: "build-$CI_COMMIT_REF_SLUG"
    paths:
      - tezos-*
      - src/proto_*/parameters/*.json
      - _build/default/src/lib_protocol_compiler/main_native.exe
    expire_in: 1 day
    when: on_success

############################################################
## Stage: test (only MR)                                  ##
############################################################

test-script-gen-genesis:
  image: ${build_deps_image_name}:${build_deps_image_version}
  stage: test
  except:
    - master
    - zeronet
    - mainnet
    - zeronet-staging
    - mainnet-staging
    - zeronet-snapshots
    - mainnet-snapshots
    - latest-release
    - tags
  before_script:
    - cd scripts/gen-genesis
  script:
    - dune build gen_genesis.exe
  interruptible: true

.test_template: &test_definition
  <<: *build_definition
  stage: test
  retry: 2
  # avoid pushing cache for testing stage
  cache:
    key: "$CI_COMMIT_REF_SLUG"
    policy: pull

# this section is updated using the script scripts/update_unit_test.sh
##BEGIN_UNITTEST##
unit:client:
  <<: *test_definition
  script:
    - dune build @src/bin_client/runtest

unit:base:
  <<: *test_definition
  script:
    - dune build @src/lib_base/runtest

unit:client_base:
  <<: *test_definition
  script:
    - dune build @src/lib_client_base/runtest

unit:crypto:
  <<: *test_definition
  script:
    - dune build @src/lib_crypto/runtest

unit:error_monad:
  <<: *test_definition
  script:
    - dune build @src/lib_error_monad/runtest

unit:lwt_result_stdlib:
  <<: *test_definition
  script:
    - dune build @src/lib_lwt_result_stdlib/runtest

unit:micheline:
  <<: *test_definition
  script:
    - dune build @src/lib_micheline/runtest

unit:p2p:
  <<: *test_definition
  script:
    - dune build @src/lib_p2p/runtest

unit:protocol_compiler:
  <<: *test_definition
  script:
    - dune build @src/lib_protocol_compiler/runtest

unit:protocol_environment:
  <<: *test_definition
  script:
    - dune build @src/lib_protocol_environment/runtest

unit:requester:
  <<: *test_definition
  script:
    - dune build @src/lib_requester/runtest

unit:shell:
  <<: *test_definition
  script:
    - dune build @src/lib_shell/runtest

unit:signer_backends:
  <<: *test_definition
  script:
    - dune build @src/lib_signer_backends/runtest

unit:signer_backends/unix:
  <<: *test_definition
  script:
    - dune build @src/lib_signer_backends/unix/runtest

unit:stdlib:
  <<: *test_definition
  script:
    - dune build @src/lib_stdlib/runtest

unit:stdlib_unix:
  <<: *test_definition
  script:
    - dune build @src/lib_stdlib_unix/runtest

unit:storage:
  <<: *test_definition
  script:
    - dune build @src/lib_storage/runtest

unit:src/proto_006_PsCARTHA/lib_client:
  <<: *test_definition
  script:
    - dune build @src/proto_006_PsCARTHA/lib_client/runtest

unit:src/proto_006_PsCARTHA/lib_protocol:
  <<: *test_definition
  script:
    - dune build @src/proto_006_PsCARTHA/lib_protocol/runtest

unit:src/proto_007_PsDELPH1/lib_client:
  <<: *test_definition
  script:
    - dune build @src/proto_007_PsDELPH1/lib_client/runtest

unit:src/proto_007_PsDELPH1/lib_protocol:
  <<: *test_definition
  script:
    - dune build @src/proto_007_PsDELPH1/lib_protocol/runtest

unit:src/proto_alpha/lib_client:
  <<: *test_definition
  script:
    - dune build @src/proto_alpha/lib_client/runtest

unit:src/proto_alpha/lib_protocol:
  <<: *test_definition
  script:
    - dune build @src/proto_alpha/lib_protocol/runtest

unit:src/tooling:
  <<: *test_definition
  script:
    - dune build @src/tooling/runtest

unit:ocaml-bls12-381:
  <<: *test_definition
  script:
    - dune build @vendors/ocaml-bls12-381/runtest

unit:ocaml-ledger-wallet:
  <<: *test_definition
  script:
    - dune build @vendors/ocaml-ledger-wallet/runtest

unit:ocaml-lmdb:
  <<: *test_definition
  script:
    - dune build @vendors/ocaml-lmdb/runtest

##END_UNITTEST##

unit:protocol_compiles:
  <<: *test_definition
  script:
    - dune build @runtest_compile_protocol

############################################################
## Stage: run shell integration tests                     ##
############################################################

# definition for the environment to run all integration tests
.integration_template: &integration_definition
  <<: *test_definition
  before_script:
    - make

integration:proto:sandbox:
  <<: *integration_definition
  script:
    - dune build @runtest_sandbox

integration:compiler-rejections:
  <<: *integration_definition
  script:
    - dune build @runtest_rejections

############################################################
## Stage: run OCaml integration tests                     ##
############################################################

integration:sandboxes:voting:
  <<: *integration_definition
  script:
    - ROOT_PATH=$PWD/flextesa-voting-demo-noops dune build @src/bin_sandbox/runtest_sandbox_voting_demo_noops
  artifacts:
    paths:
      - flextesa-voting-demo-noops
    expire_in: 1 day
    when: on_failure
  allow_failure: true # This test uses too much resources for GitLab's workers

integration:sandboxes:acc-baking:
  <<: *integration_definition
  script:
    - ROOT_PATH=$PWD/flextesa-acc-sdb dune build @src/bin_sandbox/runtest_sandbox_accusations_simple_double_baking
  artifacts:
    paths:
      - flextesa-acc-sdb
    expire_in: 1 day
    when: on_failure

integration:sandboxes:acc-endorsement:
  <<: *integration_definition
  script:
    - ROOT_PATH=$PWD/flextesa-acc-sde dune build @src/bin_sandbox/runtest_sandbox_accusations_simple_double_endorsing
  artifacts:
    paths:
      - flextesa-acc-sde
    expire_in: 1 day
    when: on_failure

integration:sandboxes:u-a-u:
  <<: *integration_definition
  script:
    - ROOT_PATH=$PWD/flextesa-hard-fork dune build @src/bin_sandbox/runtest_sandbox_user_activated_upgrade
  artifacts:
    paths:
      - flextesa-hard-fork
    expire_in: 1 day
    when: on_failure

integration:sandboxes:daemons-upgrade:
  <<: *integration_definition
  script:
    - ROOT_PATH=$PWD/flextesa-daemons-upgrade dune build @src/bin_sandbox/runtest_sandbox_daemons_upgrade
  artifacts:
    paths:
      - flextesa-daemons-upgrade
    expire_in: 1 day
    when: on_failure

############################################################
## Stage: run python integration tests                    ##
############################################################

# definition for the environment to run all integration tests
.integration_template: &integration_python_definition
  <<: *test_definition
  dependencies:
    - build
  before_script:
    # Load the environment poetry previously created in the docker image.
    # Give access to the Python dependencies/executables
    - . $HOME/.venv/bin/activate
    - mkdir tests_python/tmp
    - cd tests_python
  after_script:
    - tail -n +1 tmp/*
  # python scripts don't need the _build directory
  # but only the binaries in the artifacts
  cache: {}

# this section is updated using the script scripts/update_integration_test.sh
##BEGIN_INTEGRATION_PYTHON##
integration:baker_endorser:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_baker_endorser.py -s --log-dir=tmp
  stage: test

integration:basic:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_basic.py -s --log-dir=tmp
  stage: test

integration:bootstrap:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_bootstrap.py -s --log-dir=tmp
  stage: test

integration:client_without_node:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_client_without_node.py -s --log-dir=tmp
  stage: test

integration:codec:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_codec.py -s --log-dir=tmp
  stage: test

integration:contract:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_contract.py -s --log-dir=tmp
  stage: test

integration:contract_annotations:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_contract_annotations.py -s --log-dir=tmp
  stage: test

integration:contract_baker:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_contract_baker.py -s --log-dir=tmp
  stage: test

integration:contract_legacy:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_contract_legacy.py -s --log-dir=tmp
  stage: test

integration:contract_macros:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_contract_macros.py -s --log-dir=tmp
  stage: test

integration:contract_onchain_opcodes:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_contract_onchain_opcodes.py -s --log-dir=tmp
  stage: test

integration:contract_opcodes:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_contract_opcodes.py -s --log-dir=tmp
  stage: test

integration:cors:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_cors.py -s --log-dir=tmp
  stage: test

integration:double_endorsement:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_double_endorsement.py -s --log-dir=tmp
  stage: test

integration:fork:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_fork.py -s --log-dir=tmp
  stage: test

integration:injection:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_injection.py -s --log-dir=tmp
  stage: test

integration:many_bakers:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_many_bakers.py -s --log-dir=tmp
  stage: test

integration:many_nodes:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_many_nodes.py -s --log-dir=tmp
  stage: test

integration:mempool:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_mempool.py -s --log-dir=tmp
  stage: test

integration:mockup:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_mockup.py -s --log-dir=tmp
  stage: test

integration:multinode:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_multinode.py -s --log-dir=tmp
  stage: test

integration:multinode_snapshot:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_multinode_snapshot.py -s --log-dir=tmp
  stage: test

integration:multinode_storage_reconstruction:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_multinode_storage_reconstruction.py -s --log-dir=tmp
  stage: test

integration:multisig:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_multisig.py -s --log-dir=tmp
  stage: test

integration:openapi:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_openapi.py -s --log-dir=tmp
  stage: test

integration:p2p:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_p2p.py -s --log-dir=tmp
  stage: test

integration:programs:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_programs.py -s --log-dir=tmp
  stage: test

integration:proto_demo_counter:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_proto_demo_counter.py -s --log-dir=tmp
  stage: test

integration:proto_demo_noops_manual_bake:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_proto_demo_noops_manual_bake.py -s --log-dir=tmp
  stage: test

integration:rpc:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_rpc.py -s --log-dir=tmp
  stage: test

integration:tls:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_tls.py -s --log-dir=tmp
  stage: test

integration:voting:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_voting.py -s --log-dir=tmp
  stage: test

integration:voting_full:
  <<: *integration_python_definition
  script:
    - poetry run pytest tests/test_voting_full.py -s --log-dir=tmp
  stage: test

integration:examples_forge_transfer:
  <<: *integration_python_definition
  script:
    - PYTHONPATH=$PYTHONPATH:./ poetry run python examples/forge_transfer.py
  stage: test

integration:examples_example:
  <<: *integration_python_definition
  script:
    - PYTHONPATH=$PYTHONPATH:./ poetry run python examples/example.py
  stage: test

integration:examples_test_example:
  <<: *integration_python_definition
  script:
    - PYTHONPATH=./ poetry run pytest examples/test_example.py
  stage: test
##END_INTEGRATION_PYTHON##

############################################################
## Stage: conversion to Coq                               ##
############################################################

coq:lint:
  <<: *test_definition
  script:
    - coq-of-ocaml --help
  retry: 0

############################################################
## Stage: run tests written using Tezt                    ##
############################################################

# We set a global timeout of 55min (3300s) so that in case of timeout,
# we still get the artifact (CI timeouts cause artifacts to not be uploaded).
tezt:main:
  <<: *test_definition
  before_script:
    - make
  script:
    - dune exec tezt/tests/main.exe -- --color --log-buffer-size 5000 --log-file tezt.log --global-timeout 3300
  artifacts:
    paths:
      - tezt.log
    expire_in: 1 day
    when: on_failure

tezt:manual:migration:
  <<: *test_definition
  when: manual
  script:
    - export TEZOS_CLIENT_UNSAFE_DISABLE_DISCLAIMER=Y
    - block_hash=$(wget https://snaps.tulip.tools/snapshots.json -O - | jq -r .Snapshots.mainnet_rolling.Blockhash)
    - filename=$(wget https://snaps.tulip.tools/snapshots.json -O - | jq -r .Snapshots.mainnet_rolling.Filename)
    - wget https://snaps.tulip.tools/$filename
    - make
    - scripts/prepare_migration_test.sh auto mainnet_*.rolling "$block_hash"
    - dune exec ./tezt/manual_tests/main.exe -- migration --color --log-buffer-size 5000 --log-file tezt-migration.log
  artifacts:
    when: always
    paths:
      - tezt-migration.log
    expire_in: 30 days

############################################################
## Stage: run doc integration tests                       ##
############################################################

documentation:build:
  <<: *test_definition
  stage: doc
  except:
    - master
    - zeronet
    - mainnet
    - zeronet-staging
    - mainnet-staging
    - zeronet-snapshots
    - mainnet-snapshots
    - /-release$/
    - tags
  script:
    - make doc-html
  artifacts:
    paths:
      - docs
    expire_in: 1 week

documentation:linkcheck:
  image: ${build_deps_image_name}:${build_deps_image_version}
  stage: doc
  before_script:
    - . ./scripts/version.sh
  dependencies:
    - build
  rules:
    - if: '$CI_COMMIT_BRANCH == "master"'
      when: on_success
    - if: '$CI_COMMIT_BRANCH =~ /doc/'
      when: on_success
    - if: '$CI_COMMIT_BRANCH =~ /-release$/'
      when: on_success
    - changes:
        - /docs
      when: on_success
  script:
    - make doc-html-and-linkcheck
  allow_failure: true
  interruptible: true

############################################################
## Stage: building opam packages (only master and *opam*) ##
############################################################

.opam_template: &opam_definition
  image: ${build_deps_image_name}:opam--${build_deps_image_version}
  stage: packaging
  dependencies: []
  rules:
    - if: '$CI_COMMIT_BRANCH == "master"'
      when: on_success
    - if: '$CI_COMMIT_BRANCH =~ /opam/'
      when: on_success
    - if: '$CI_COMMIT_BRANCH =~ /-release$/'
      when: on_success
    - changes:
        - /**/*.opam
        - /**/dune
        - /**/dune.inc
        - /**/*.dune.inc
        - /scripts/version.sh
        - /.gitlab-ci.yml
      when: on_success
  script:
    - ./scripts/opam-pin.sh
    - opam depext --yes ${package}
    - opam install --yes ${package}
    - opam reinstall --yes --with-test ${package}
  interruptible: true

##BEGIN_OPAM##
# this section is updated using the script scripts/update_opam_test.sh

opam:bls12-381:
  <<: *opam_definition
  variables:
    package: bls12-381

opam:flextesa:
  <<: *opam_definition
  variables:
    package: flextesa

opam:ledgerwallet:
  <<: *opam_definition
  variables:
    package: ledgerwallet

opam:ledgerwallet-tezos:
  <<: *opam_definition
  variables:
    package: ledgerwallet-tezos

opam:tezos-006-PsCARTHA-test-helpers:
  <<: *opam_definition
  variables:
    package: tezos-006-PsCARTHA-test-helpers

opam:tezos-007-PsDELPH1-test-helpers:
  <<: *opam_definition
  variables:
    package: tezos-007-PsDELPH1-test-helpers

opam:tezos-accuser-006-PsCARTHA:
  <<: *opam_definition
  variables:
    package: tezos-accuser-006-PsCARTHA

opam:tezos-accuser-006-PsCARTHA-commands:
  <<: *opam_definition
  variables:
    package: tezos-accuser-006-PsCARTHA-commands

opam:tezos-accuser-007-PsDELPH1:
  <<: *opam_definition
  variables:
    package: tezos-accuser-007-PsDELPH1

opam:tezos-accuser-007-PsDELPH1-commands:
  <<: *opam_definition
  variables:
    package: tezos-accuser-007-PsDELPH1-commands

opam:tezos-accuser-alpha:
  <<: *opam_definition
  variables:
    package: tezos-accuser-alpha

opam:tezos-accuser-alpha-commands:
  <<: *opam_definition
  variables:
    package: tezos-accuser-alpha-commands

opam:tezos-alpha-test-helpers:
  <<: *opam_definition
  variables:
    package: tezos-alpha-test-helpers

opam:tezos-baker-006-PsCARTHA:
  <<: *opam_definition
  variables:
    package: tezos-baker-006-PsCARTHA

opam:tezos-baker-007-PsDELPH1:
  <<: *opam_definition
  variables:
    package: tezos-baker-007-PsDELPH1

opam:tezos-baker-alpha:
  <<: *opam_definition
  variables:
    package: tezos-baker-alpha

opam:tezos-baking-006-PsCARTHA:
  <<: *opam_definition
  variables:
    package: tezos-baking-006-PsCARTHA

opam:tezos-baking-006-PsCARTHA-commands:
  <<: *opam_definition
  variables:
    package: tezos-baking-006-PsCARTHA-commands

opam:tezos-baking-007-PsDELPH1:
  <<: *opam_definition
  variables:
    package: tezos-baking-007-PsDELPH1

opam:tezos-baking-007-PsDELPH1-commands:
  <<: *opam_definition
  variables:
    package: tezos-baking-007-PsDELPH1-commands

opam:tezos-baking-alpha:
  <<: *opam_definition
  variables:
    package: tezos-baking-alpha

opam:tezos-baking-alpha-commands:
  <<: *opam_definition
  variables:
    package: tezos-baking-alpha-commands

opam:tezos-base:
  <<: *opam_definition
  variables:
    package: tezos-base

opam:tezos-benchmark:
  <<: *opam_definition
  variables:
    package: tezos-benchmark

opam:tezos-clic:
  <<: *opam_definition
  variables:
    package: tezos-clic

opam:tezos-client:
  <<: *opam_definition
  variables:
    package: tezos-client

opam:tezos-client-000-Ps9mPmXa:
  <<: *opam_definition
  variables:
    package: tezos-client-000-Ps9mPmXa

opam:tezos-client-001-PtCJ7pwo:
  <<: *opam_definition
  variables:
    package: tezos-client-001-PtCJ7pwo

opam:tezos-client-001-PtCJ7pwo-commands:
  <<: *opam_definition
  variables:
    package: tezos-client-001-PtCJ7pwo-commands

opam:tezos-client-002-PsYLVpVv:
  <<: *opam_definition
  variables:
    package: tezos-client-002-PsYLVpVv

opam:tezos-client-002-PsYLVpVv-commands:
  <<: *opam_definition
  variables:
    package: tezos-client-002-PsYLVpVv-commands

opam:tezos-client-003-PsddFKi3:
  <<: *opam_definition
  variables:
    package: tezos-client-003-PsddFKi3

opam:tezos-client-003-PsddFKi3-commands:
  <<: *opam_definition
  variables:
    package: tezos-client-003-PsddFKi3-commands

opam:tezos-client-004-Pt24m4xi:
  <<: *opam_definition
  variables:
    package: tezos-client-004-Pt24m4xi

opam:tezos-client-004-Pt24m4xi-commands:
  <<: *opam_definition
  variables:
    package: tezos-client-004-Pt24m4xi-commands

opam:tezos-client-005-PsBabyM1:
  <<: *opam_definition
  variables:
    package: tezos-client-005-PsBabyM1

opam:tezos-client-005-PsBabyM1-commands:
  <<: *opam_definition
  variables:
    package: tezos-client-005-PsBabyM1-commands

opam:tezos-client-006-PsCARTHA:
  <<: *opam_definition
  variables:
    package: tezos-client-006-PsCARTHA

opam:tezos-client-006-PsCARTHA-commands:
  <<: *opam_definition
  variables:
    package: tezos-client-006-PsCARTHA-commands

opam:tezos-client-007-PsDELPH1:
  <<: *opam_definition
  variables:
    package: tezos-client-007-PsDELPH1

opam:tezos-client-007-PsDELPH1-commands:
  <<: *opam_definition
  variables:
    package: tezos-client-007-PsDELPH1-commands

opam:tezos-client-007-PsDELPH1-commands-registration:
  <<: *opam_definition
  variables:
    package: tezos-client-007-PsDELPH1-commands-registration

opam:tezos-client-alpha:
  <<: *opam_definition
  variables:
    package: tezos-client-alpha

opam:tezos-client-alpha-commands:
  <<: *opam_definition
  variables:
    package: tezos-client-alpha-commands

opam:tezos-client-base:
  <<: *opam_definition
  variables:
    package: tezos-client-base

opam:tezos-client-base-unix:
  <<: *opam_definition
  variables:
    package: tezos-client-base-unix

opam:tezos-client-commands:
  <<: *opam_definition
  variables:
    package: tezos-client-commands

opam:tezos-client-demo-counter:
  <<: *opam_definition
  variables:
    package: tezos-client-demo-counter

opam:tezos-client-genesis:
  <<: *opam_definition
  variables:
    package: tezos-client-genesis

opam:tezos-client-genesis-carthagenet:
  <<: *opam_definition
  variables:
    package: tezos-client-genesis-carthagenet

opam:tezos-codec:
  <<: *opam_definition
  variables:
    package: tezos-codec

opam:tezos-crypto:
  <<: *opam_definition
  variables:
    package: tezos-crypto

opam:tezos-embedded-protocol-000-Ps9mPmXa:
  <<: *opam_definition
  variables:
    package: tezos-embedded-protocol-000-Ps9mPmXa

opam:tezos-embedded-protocol-001-PtCJ7pwo:
  <<: *opam_definition
  variables:
    package: tezos-embedded-protocol-001-PtCJ7pwo

opam:tezos-embedded-protocol-002-PsYLVpVv:
  <<: *opam_definition
  variables:
    package: tezos-embedded-protocol-002-PsYLVpVv

opam:tezos-embedded-protocol-003-PsddFKi3:
  <<: *opam_definition
  variables:
    package: tezos-embedded-protocol-003-PsddFKi3

opam:tezos-embedded-protocol-004-Pt24m4xi:
  <<: *opam_definition
  variables:
    package: tezos-embedded-protocol-004-Pt24m4xi

opam:tezos-embedded-protocol-005-PsBABY5H:
  <<: *opam_definition
  variables:
    package: tezos-embedded-protocol-005-PsBABY5H

opam:tezos-embedded-protocol-005-PsBabyM1:
  <<: *opam_definition
  variables:
    package: tezos-embedded-protocol-005-PsBabyM1

opam:tezos-embedded-protocol-006-PsCARTHA:
  <<: *opam_definition
  variables:
    package: tezos-embedded-protocol-006-PsCARTHA

opam:tezos-embedded-protocol-007-PsDELPH1:
  <<: *opam_definition
  variables:
    package: tezos-embedded-protocol-007-PsDELPH1

opam:tezos-embedded-protocol-alpha:
  <<: *opam_definition
  variables:
    package: tezos-embedded-protocol-alpha

opam:tezos-embedded-protocol-demo-counter:
  <<: *opam_definition
  variables:
    package: tezos-embedded-protocol-demo-counter

opam:tezos-embedded-protocol-demo-noops:
  <<: *opam_definition
  variables:
    package: tezos-embedded-protocol-demo-noops

opam:tezos-embedded-protocol-genesis:
  <<: *opam_definition
  variables:
    package: tezos-embedded-protocol-genesis

opam:tezos-embedded-protocol-genesis-carthagenet:
  <<: *opam_definition
  variables:
    package: tezos-embedded-protocol-genesis-carthagenet

opam:tezos-endorser-006-PsCARTHA:
  <<: *opam_definition
  variables:
    package: tezos-endorser-006-PsCARTHA

opam:tezos-endorser-006-PsCARTHA-commands:
  <<: *opam_definition
  variables:
    package: tezos-endorser-006-PsCARTHA-commands

opam:tezos-endorser-007-PsDELPH1:
  <<: *opam_definition
  variables:
    package: tezos-endorser-007-PsDELPH1

opam:tezos-endorser-007-PsDELPH1-commands:
  <<: *opam_definition
  variables:
    package: tezos-endorser-007-PsDELPH1-commands

opam:tezos-endorser-alpha:
  <<: *opam_definition
  variables:
    package: tezos-endorser-alpha

opam:tezos-endorser-alpha-commands:
  <<: *opam_definition
  variables:
    package: tezos-endorser-alpha-commands

opam:tezos-error-monad:
  <<: *opam_definition
  variables:
    package: tezos-error-monad

opam:tezos-event-logging:
  <<: *opam_definition
  variables:
    package: tezos-event-logging

opam:tezos-lmdb:
  <<: *opam_definition
  variables:
    package: tezos-lmdb

opam:tezos-lwt-result-stdlib:
  <<: *opam_definition
  variables:
    package: tezos-lwt-result-stdlib

opam:tezos-mempool-006-PsCARTHA:
  <<: *opam_definition
  variables:
    package: tezos-mempool-006-PsCARTHA

opam:tezos-mempool-007-PsDELPH1:
  <<: *opam_definition
  variables:
    package: tezos-mempool-007-PsDELPH1

opam:tezos-mempool-alpha:
  <<: *opam_definition
  variables:
    package: tezos-mempool-alpha

opam:tezos-micheline:
  <<: *opam_definition
  variables:
    package: tezos-micheline

opam:tezos-mockup:
  <<: *opam_definition
  variables:
    package: tezos-mockup

opam:tezos-mockup-commands:
  <<: *opam_definition
  variables:
    package: tezos-mockup-commands

opam:tezos-mockup-registration:
  <<: *opam_definition
  variables:
    package: tezos-mockup-registration

opam:tezos-node:
  <<: *opam_definition
  variables:
    package: tezos-node

opam:tezos-p2p:
  <<: *opam_definition
  variables:
    package: tezos-p2p

opam:tezos-p2p-services:
  <<: *opam_definition
  variables:
    package: tezos-p2p-services

opam:tezos-protocol-000-Ps9mPmXa:
  <<: *opam_definition
  variables:
    package: tezos-protocol-000-Ps9mPmXa

opam:tezos-protocol-001-PtCJ7pwo:
  <<: *opam_definition
  variables:
    package: tezos-protocol-001-PtCJ7pwo

opam:tezos-protocol-002-PsYLVpVv:
  <<: *opam_definition
  variables:
    package: tezos-protocol-002-PsYLVpVv

opam:tezos-protocol-003-PsddFKi3:
  <<: *opam_definition
  variables:
    package: tezos-protocol-003-PsddFKi3

opam:tezos-protocol-004-Pt24m4xi:
  <<: *opam_definition
  variables:
    package: tezos-protocol-004-Pt24m4xi

opam:tezos-protocol-005-PsBABY5H:
  <<: *opam_definition
  variables:
    package: tezos-protocol-005-PsBABY5H

opam:tezos-protocol-005-PsBabyM1:
  <<: *opam_definition
  variables:
    package: tezos-protocol-005-PsBabyM1

opam:tezos-protocol-006-PsCARTHA:
  <<: *opam_definition
  variables:
    package: tezos-protocol-006-PsCARTHA

opam:tezos-protocol-006-PsCARTHA-parameters:
  <<: *opam_definition
  variables:
    package: tezos-protocol-006-PsCARTHA-parameters

opam:tezos-protocol-006-PsCARTHA-tests:
  <<: *opam_definition
  variables:
    package: tezos-protocol-006-PsCARTHA-tests

opam:tezos-protocol-007-PsDELPH1:
  <<: *opam_definition
  variables:
    package: tezos-protocol-007-PsDELPH1

opam:tezos-protocol-007-PsDELPH1-parameters:
  <<: *opam_definition
  variables:
    package: tezos-protocol-007-PsDELPH1-parameters

opam:tezos-protocol-007-PsDELPH1-tests:
  <<: *opam_definition
  variables:
    package: tezos-protocol-007-PsDELPH1-tests

opam:tezos-protocol-alpha:
  <<: *opam_definition
  variables:
    package: tezos-protocol-alpha

opam:tezos-protocol-alpha-parameters:
  <<: *opam_definition
  variables:
    package: tezos-protocol-alpha-parameters

opam:tezos-protocol-alpha-tests:
  <<: *opam_definition
  variables:
    package: tezos-protocol-alpha-tests

opam:tezos-protocol-compiler:
  <<: *opam_definition
  variables:
    package: tezos-protocol-compiler

opam:tezos-protocol-demo-counter:
  <<: *opam_definition
  variables:
    package: tezos-protocol-demo-counter

opam:tezos-protocol-demo-noops:
  <<: *opam_definition
  variables:
    package: tezos-protocol-demo-noops

opam:tezos-protocol-environment:
  <<: *opam_definition
  variables:
    package: tezos-protocol-environment

opam:tezos-protocol-environment-packer:
  <<: *opam_definition
  variables:
    package: tezos-protocol-environment-packer

opam:tezos-protocol-environment-sigs:
  <<: *opam_definition
  variables:
    package: tezos-protocol-environment-sigs

opam:tezos-protocol-environment-structs:
  <<: *opam_definition
  variables:
    package: tezos-protocol-environment-structs

opam:tezos-protocol-genesis:
  <<: *opam_definition
  variables:
    package: tezos-protocol-genesis

opam:tezos-protocol-genesis-carthagenet:
  <<: *opam_definition
  variables:
    package: tezos-protocol-genesis-carthagenet

opam:tezos-protocol-updater:
  <<: *opam_definition
  variables:
    package: tezos-protocol-updater

opam:tezos-requester:
  <<: *opam_definition
  variables:
    package: tezos-requester

opam:tezos-rpc:
  <<: *opam_definition
  variables:
    package: tezos-rpc

opam:tezos-rpc-http:
  <<: *opam_definition
  variables:
    package: tezos-rpc-http

opam:tezos-rpc-http-client:
  <<: *opam_definition
  variables:
    package: tezos-rpc-http-client

opam:tezos-rpc-http-client-unix:
  <<: *opam_definition
  variables:
    package: tezos-rpc-http-client-unix

opam:tezos-rpc-http-server:
  <<: *opam_definition
  variables:
    package: tezos-rpc-http-server

opam:tezos-shell:
  <<: *opam_definition
  variables:
    package: tezos-shell

opam:tezos-shell-context:
  <<: *opam_definition
  variables:
    package: tezos-shell-context

opam:tezos-shell-services:
  <<: *opam_definition
  variables:
    package: tezos-shell-services

opam:tezos-signer:
  <<: *opam_definition
  variables:
    package: tezos-signer

opam:tezos-signer-backends:
  <<: *opam_definition
  variables:
    package: tezos-signer-backends

opam:tezos-signer-services:
  <<: *opam_definition
  variables:
    package: tezos-signer-services

opam:tezos-stdlib:
  <<: *opam_definition
  variables:
    package: tezos-stdlib

opam:tezos-stdlib-unix:
  <<: *opam_definition
  variables:
    package: tezos-stdlib-unix

opam:tezos-storage:
  <<: *opam_definition
  variables:
    package: tezos-storage

opam:tezos-test-services:
  <<: *opam_definition
  variables:
    package: tezos-test-services

opam:tezos-tooling:
  <<: *opam_definition
  variables:
    package: tezos-tooling

opam:tezos-validation:
  <<: *opam_definition
  variables:
    package: tezos-validation

opam:tezos-validator:
  <<: *opam_definition
  variables:
    package: tezos-validator

opam:tezos-version:
  <<: *opam_definition
  variables:
    package: tezos-version

opam:tezos-workers:
  <<: *opam_definition
  variables:
    package: tezos-workers

##END_OPAM##



############################################################
## Stage: publish                                         ##
############################################################

publish:docker:
  image: docker:latest
  services:
    - docker:dind
  variables:
    DOCKER_DRIVER: overlay2
  stage: publish
  only:
    - master@tezos/tezos
    - tags@tezos/tezos
    - /-release$/@tezos/tezos
    - zeronet@tezos/tezos
    - mainnet@tezos/tezos
    - zeronet-staging@tezos/tezos
    - mainnet-staging@tezos/tezos
    - zeronet-snapshots@tezos/tezos
    - mainnet-snapshots@tezos/tezos
  before_script:
    - apk add git binutils
    - mkdir ~/.docker || true
    - echo "${CI_DOCKER_AUTH}" > ~/.docker/config.json
  script:
    - LAST_COMMIT_DATE_TIME=$(git log --pretty=format:"%cd" -1 --date="format:%Y%m%d%H%M%S" 2>&1)
    - ./scripts/create_docker_image.sh
        "${public_docker_image_name}"
        "${CI_COMMIT_REF_NAME}"
        "${build_deps_image_name}"
        "${build_deps_image_version}"
        "${CI_COMMIT_SHORT_SHA}"
    - docker push "${public_docker_image_name}:${CI_COMMIT_REF_NAME}"
    - docker push "${public_docker_image_name}-bare:${CI_COMMIT_REF_NAME}"
    - docker push "${public_docker_image_name}-debug:${CI_COMMIT_REF_NAME}"
    - docker tag
      "${public_docker_image_name}:${CI_COMMIT_REF_NAME}"
      "${public_docker_image_name}:${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHORT_SHA}_${LAST_COMMIT_DATE_TIME}"
    - docker tag
      "${public_docker_image_name}-bare:${CI_COMMIT_REF_NAME}"
      "${public_docker_image_name}-bare:${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHORT_SHA}_${LAST_COMMIT_DATE_TIME}"
    - docker tag
      "${public_docker_image_name}-debug:${CI_COMMIT_REF_NAME}"
      "${public_docker_image_name}-debug:${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHORT_SHA}_${LAST_COMMIT_DATE_TIME}"
    - docker push "${public_docker_image_name}:${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHORT_SHA}_${LAST_COMMIT_DATE_TIME}"
    - docker push "${public_docker_image_name}-bare:${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHORT_SHA}_${LAST_COMMIT_DATE_TIME}"
    - docker push "${public_docker_image_name}-debug:${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHORT_SHA}_${LAST_COMMIT_DATE_TIME}"
  tags:
    - safe_docker
  interruptible: false

publish:doc:
  image: ${build_deps_image_name}:${build_deps_image_version}
  stage: doc
  only:
    - master@tezos/tezos
  before_script:
    - sudo apk add --no-cache openssh-client rsync
    - echo "${CI_PK_GITLAB_DOC}" > ~/.ssh/id_ed25519
    - echo "${CI_KH}" > ~/.ssh/known_hosts
    - chmod 400 ~/.ssh/id_ed25519
  script:
    - make doc-html
    - git clone --depth 5 git@gitlab.com:${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAMESPACE}.gitlab.io gitlab.io
    - rsync --recursive --links --perms --delete --verbose
        --exclude=.doctrees --exclude={{main,alpha,zero}net,master}/index.html
        docs/_build/ gitlab.io/public/
    - cd gitlab.io
    - if [ -z "$(git status -s)" ] ; then
        echo "Nothing to commit!" ;
      else
        git add public ;
        git commit -m "Import doc of ${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:${CI_COMMIT_SHA}" ;
        git push origin master ;
      fi
  interruptible: false

# This job publishes the html report generated by the coverage job.
# It is accessible on the gitlab page associated to the project
# via URL $CI_PAGES_URL/$CI_PIPELINE_ID
#
# for instance https://nomadic-labs.gitlab.io/tezos/${CI_PIPELINE_ID}
# https://tezos.gitlab.io/tezos/${CI_PIPELINE_ID}
#
# It is run manually from the Gitlab CI interface.
#
# Note that this job is somewhat redundant. It is already possible to browse
# the html report artefact generated by the test_coverage job.
#

pages:
  when: manual
  # The cache rule ensures public (i.e. the static website) isn't erased
  # whenever we start a new pipeline
  # https://docs.gitlab.com/ee/ci/caching/
  # The pages job retrieves the old public dir from the cache, adds a new
  # report, and publishes the new public dir.
  cache:
    paths:
      - public
  stage: publish_coverage
  dependencies:
    - test_coverage
  script:
    - mkdir -p public
    - mv _coverage_report public/$CI_PIPELINE_ID
    - echo "Coverage report published at $CI_PAGES_URL/$CI_PIPELINE_ID"
  artifacts:
    paths:
      - public
    # This is the minimum time the public artifact will remain available.
    # Everytime a pages job is launched, this time period is reset
    expire_in: 7 days
  interruptible: false

############################################################
## Stage: coverage                                        ##
############################################################

# This job is manual. It can be launched from the gitlab CI interface.
# It instruments the code with bisect_ppx and runs the full test suite
# (sequentially).

test_coverage:
  image: ${build_deps_image_name}:${build_deps_image_version}
  stage: test_coverage
  when: manual
  variables:
    # We exclude from coverage old protocols and code that can't be
    # instrumented because of current limitations of bisect_ppx.
    OLD_PROTOCOLS: "src/proto_000_Ps9mPmXa src/proto_001_PtCJ7pwo src/proto_002_PsYLVpVv src/proto_003_PsddFKi3 src/proto_004_Pt24m4xi src/proto_005_PsBABY5H src/proto_005_PsBabyM1 src/proto_006_PsCARTHA"
    NOT_INSTRUMENTABLE: ""
    COVERAGE_EXCLUDE: "$OLD_PROTOCOLS $NOT_INSTRUMENTABLE"
  script:
    - scripts/instrument_dune_bisect.sh src/ --except $COVERAGE_EXCLUDE
    - make
    # Load the environment poetry previously created in the docker image.
    # Give access to the Python dependencies/executables
    - . $HOME/.venv/bin/activate
    # A failing test shouldn't prevent the generation of the report (|| true)
    - make test-coverage || true
    - make coverage-report
    - make coverage-report-summary
    # hack to capture script success in after_script script
    - touch $CI_PROJECT_DIR/__success
  after_script:
    - |
      if [ ! -f __success ]; then
        echo "Job was unable to generate the coverage report."
        echo "Check http://tezos.gitlab.io/developer/testing.html#measuring-test-coverage"
        echo "for a list of known issues."
      fi
  # This is for gitlab to extract the coverage summary and display it
  # to the user as a badge.
  coverage: '/Coverage: \d+\/\d+ \(([^%]+%)\)/'
  artifacts:
    when: always
    paths:
      - _coverage_report/
    expire_in: 15 days
back to top