variables: opam_image: ${CI_REGISTRY_IMAGE}/opam build_deps_image: ${CI_REGISTRY_IMAGE}/build_deps public_docker_image: docker.io/tezos/tezos stages: - prepare - build_deps - build - test - opam - publish - deploy - cleanup ## Template for `docker_in_docker` jobs .dind_template: &dind_definition image: docker:latest variables: DOCKER_DRIVER: overlay2 services: - docker:dind before_script: - docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}" - apk add --no-cache curl jq - . ./scripts/version.sh tags: - safe_docker prepare:opam: <<: *dind_definition stage: prepare only: - schedules script: - ./scripts/ci/create_docker_image.opam.sh "${opam_image}" - docker push "${opam_image}:alpine-${alpine_version}_ocaml-${ocaml_version}" - docker tag "${opam_image}:alpine-${alpine_version}_ocaml-${ocaml_version}" "${opam_image}:latest" - docker push "${opam_image}:latest" ## Tezos build dependencies build_deps: <<: *dind_definition stage: build_deps script: ## Building dependencies... - ./scripts/ci/create_docker_image.build_deps.sh "${build_deps_image}" "${CI_COMMIT_SHA}" "${opam_image}:alpine-${alpine_version}_ocaml-${ocaml_version}" "yes" .build_deps_template: &build_deps_definition image: ${build_deps_image}:${CI_COMMIT_SHA} before_script: - if [ "${CI_PROJECT_PATH}" = "tezos/tezos" ] ; then ./scripts/apply_patch.sh "${CI_COMMIT_REF_NAME}" ; fi - opam list tags: - gitlab-org ## Tezos build: <<: *build_deps_definition stage: build except: - master@tezos/tezos script: - make all - make build-test artifacts: paths: - _build expire_in: 1 day ## Basic tests (run on merge requests) .test_template: &test_definition <<: *build_deps_definition stage: test except: - master@tezos/tezos dependencies: - build test:opam_packaging: <<: *test_definition script: - ./scripts/check_opam_test.sh "$CI_PROJECT_DIR/$CI_CONFIG_PATH" test:ocp-indent: <<: *test_definition script: - jbuilder build @runtest_indent test:stdlib: <<: *test_definition script: - jbuilder build @src/lib_stdlib/runtest test:stdlib_unix: <<: *test_definition script: - jbuilder build @src/lib_stdlib_unix/runtest test:data_encoding: <<: *test_definition script: - jbuilder build @src/lib_data_encoding/runtest test:storage: <<: *test_definition script: - jbuilder build @src/lib_storage/runtest test:crypto: <<: *test_definition script: - jbuilder build @src/lib_crypto/runtest test:shell: <<: *test_definition script: - jbuilder build @src/lib_shell/runtest test:p2p:io-scheduler: <<: *test_definition script: - jbuilder build @src/lib_p2p/runtest_p2p_io_scheduler test:p2p:socket: <<: *test_definition script: - jbuilder build @src/lib_p2p/runtest_p2p_socket test:p2p:pool: <<: *test_definition script: - jbuilder build @src/lib_p2p/runtest_p2p_pool test:proto_alpha: <<: *test_definition script: - jbuilder build @src/proto_alpha/lib_protocol/runtest test:client_alpha:transaction: <<: *test_definition script: - jbuilder build @src/proto_alpha/lib_baking/runtest_transaction test:client_alpha:origination: <<: *test_definition script: - jbuilder build @src/proto_alpha/lib_baking/runtest_origination test:client_alpha:endorsement: <<: *test_definition script: - jbuilder build @src/proto_alpha/lib_baking/runtest_endorsement test:client_alpha:vote: <<: *test_definition script: - jbuilder build @src/proto_alpha/lib_baking/runtest_vote test:basic.sh: <<: *test_definition script: - jbuilder build @src/bin_client/runtest_basic.sh test:contracts.sh: <<: *test_definition script: - jbuilder build @src/bin_client/runtest_contracts.sh test:multinode.sh: <<: *test_definition script: - jbuilder build @src/bin_client/runtest_multinode.sh test:inject.sh: <<: *test_definition script: - jbuilder build @src/bin_client/runtest_injection.sh test:proto:sandbox: <<: *test_definition script: - jbuilder build @runtest_sandbox ## Basic tests through opam packaged (run on master only) .opam_template: &opam_definition image: ${opam_image} stage: opam dependencies: [] only: - master@tezos/tezos - /^.*opam.*$/ script: - ./scripts/opam-pin.sh - opam depext --yes ${package} - opam install --yes ${package} - opam reinstall --yes --with-test ${package} tags: - gitlab-org ##BEGIN_OPAM## opam:00:tezos-stdlib: <<: *opam_definition variables: package: tezos-stdlib opam:01:tezos-data-encoding: <<: *opam_definition variables: package: tezos-data-encoding opam:02:ocplib-resto: <<: *opam_definition variables: package: ocplib-resto opam:03:blake2: <<: *opam_definition variables: package: blake2 opam:04:tweetnacl: <<: *opam_definition variables: package: tweetnacl opam:05:tezos-error-monad: <<: *opam_definition variables: package: tezos-error-monad opam:06:ocplib-resto-directory: <<: *opam_definition variables: package: ocplib-resto-directory opam:07:tezos-crypto: <<: *opam_definition variables: package: tezos-crypto opam:08:tezos-micheline: <<: *opam_definition variables: package: tezos-micheline opam:09:tezos-protocol-environment-sigs: <<: *opam_definition variables: package: tezos-protocol-environment-sigs opam:10:tezos-rpc: <<: *opam_definition variables: package: tezos-rpc opam:11:tezos-base: <<: *opam_definition variables: package: tezos-base opam:12:ocplib-resto-cohttp: <<: *opam_definition variables: package: ocplib-resto-cohttp opam:13:irmin-leveldb: <<: *opam_definition variables: package: irmin-leveldb opam:14:tezos-stdlib-unix: <<: *opam_definition variables: package: tezos-stdlib-unix opam:15:bip39: <<: *opam_definition variables: package: bip39 opam:16:tezos-rpc-http: <<: *opam_definition variables: package: tezos-rpc-http opam:17:tezos-shell-services: <<: *opam_definition variables: package: tezos-shell-services opam:18:tezos-storage: <<: *opam_definition variables: package: tezos-storage opam:19:tezos-protocol-compiler: <<: *opam_definition variables: package: tezos-protocol-compiler opam:20:tezos-client-base: <<: *opam_definition variables: package: tezos-client-base opam:21:tezos-protocol-alpha: <<: *opam_definition variables: package: tezos-protocol-alpha opam:22:tezos-protocol-environment-client: <<: *opam_definition variables: package: tezos-protocol-environment-client opam:23:tezos-client-alpha: <<: *opam_definition variables: package: tezos-client-alpha opam:24:tezos-client-commands: <<: *opam_definition variables: package: tezos-client-commands opam:25:tezos-baking-alpha: <<: *opam_definition variables: package: tezos-baking-alpha opam:26:tezos-protocol-genesis: <<: *opam_definition variables: package: tezos-protocol-genesis opam:27:tezos-protocol-updater: <<: *opam_definition variables: package: tezos-protocol-updater opam:28:tezos-p2p: <<: *opam_definition variables: package: tezos-p2p opam:29:ocplib-resto-json: <<: *opam_definition variables: package: ocplib-resto-json opam:30:tezos-baking-alpha-commands: <<: *opam_definition variables: package: tezos-baking-alpha-commands opam:31:tezos-client-alpha-commands: <<: *opam_definition variables: package: tezos-client-alpha-commands opam:32:tezos-client-base-unix: <<: *opam_definition variables: package: tezos-client-base-unix opam:33:tezos-client-genesis: <<: *opam_definition variables: package: tezos-client-genesis opam:34:tezos-embedded-protocol-alpha: <<: *opam_definition variables: package: tezos-embedded-protocol-alpha opam:35:tezos-embedded-protocol-demo: <<: *opam_definition variables: package: tezos-embedded-protocol-demo opam:36:tezos-embedded-protocol-genesis: <<: *opam_definition variables: package: tezos-embedded-protocol-genesis opam:37:tezos-shell: <<: *opam_definition variables: package: tezos-shell opam:38:ocplib-ezresto: <<: *opam_definition variables: package: ocplib-ezresto opam:39:tezos-client: <<: *opam_definition variables: package: tezos-client opam:40:tezos-node: <<: *opam_definition variables: package: tezos-node opam:41:ocplib-ezresto-directory: <<: *opam_definition variables: package: ocplib-ezresto-directory opam:42:tezos-baker-alpha: <<: *opam_definition variables: package: tezos-baker-alpha opam:43:tezos-protocol-demo: <<: *opam_definition variables: package: tezos-protocol-demo ##END_OPAM## ## Publishing (small) docker images with tezos binaries publish:docker:minimal: <<: *dind_definition stage: publish only: - master@tezos/tezos - alphanet@tezos/tezos - zeronet@tezos/tezos script: - if [ "${CI_PROJECT_PATH}" = "tezos/tezos" ] ; then ./scripts/apply_patch.sh "${CI_COMMIT_REF_NAME}" ; fi - ./scripts/ci/create_docker_image.build.sh "tezos_build" "${CI_COMMIT_REF_NAME}" "${build_deps_image}:${CI_COMMIT_SHA}" - ./scripts/ci/create_docker_image.minimal.sh "${public_docker_image}" "${CI_COMMIT_REF_NAME}" "tezos_build:${CI_COMMIT_REF_NAME}" - mkdir ~/.docker || true - echo "${CI_DOCKER_AUTH}" > ~/.docker/config.json ; - docker push "${public_docker_image}:${CI_COMMIT_REF_NAME}" ## Publish to github... publish:github: image: ${opam_image} stage: publish dependencies: [] only: - master@tezos/tezos - alphanet@tezos/tezos script: - echo "${CI_KH}" > ~/.ssh/known_hosts - echo "${CI_PK_GITHUB}" > ~/.ssh/id_rsa - chmod 400 ~/.ssh/id_rsa - rm -fr .git/refs/original - if [ "${CI_PROJECT_PATH}" = "tezos/tezos" ] ; then ./scripts/apply_patch.sh "${CI_COMMIT_REF_NAME}" ; fi - sudo apk add --no-cache openssh - git push git@github.com:tezos/tezos.git -f HEAD:${CI_COMMIT_REF_NAME} tags: - gitlab-org ## Publish docs to gitlab... pages: image: ${build_deps_image}:${CI_COMMIT_SHA} stage: publish only: - master@tezos/tezos artifacts: paths: - public script: - sudo apk add --no-cache py3-sphinx py3-sphinx_rtd_theme - sudo ln -s /usr/bin/sphinx-build-3 /usr/bin/sphinx-build - opam install --yes odoc - make doc-html && sudo mv docs/_build "${CI_PROJECT_DIR}"/public tags: - gitlab-org ## Relaunching the bootstrap servers of the alphanet.zeronet .bootstrap_template: &bootstrap_definition image: ${opam_image} stage: deploy dependencies: [] only: - alphanet@tezos/tezos - zeronet@tezos/tezos before_script: - echo "${CI_KH}" > ~/.ssh/known_hosts - if [ "${CI_COMMIT_REF_NAME}" = "alphanet" ]; then echo "${CI_PK_ALPHANET}" | tr -d "\r" > ~/.ssh/id_ed25519 ; else echo "${CI_PK_ZERONET}" | tr -d "\r" > ~/.ssh/id_ed25519 ; fi - echo "${CI_SSH_CONFIG}" | tr -d "\r" > ~/.ssh/config - chmod 600 ~/.ssh/id_ed25519 allow_failure: true tags: - gitlab-org deploy:bootstrap1: <<: *bootstrap_definition script: - ssh bootstrap1 deploy:bootstrap2: <<: *bootstrap_definition script: - ssh bootstrap2 deploy:bootstrap3: <<: *bootstrap_definition script: - ssh bootstrap3 deploy:bootstrap4: <<: *bootstrap_definition script: - ssh bootstrap4 deploy:bootstrap5: <<: *bootstrap_definition script: - ssh bootstrap5 deploy:bootstrap6: <<: *bootstrap_definition script: - ssh bootstrap6 # cleanup: # <<: *dind_definition # stage: cleanup # dependencies: [] # script: # - ./scripts/ci/docker_registry_delete.sh # "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" # "${build_deps_image}" "${CI_COMMIT_SHA}"