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 except: - master@tezos/tezos 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 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 before_script: - find _build -type f -exec touch {} \; dependencies: - build test:opam: <<: *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:utils: <<: *test_definition script: - jbuilder build @test/utils/runtest test:shell: <<: *test_definition script: - jbuilder build @test/shell/runtest test:p2p:io-scheduler: <<: *test_definition script: - jbuilder build @test/p2p/runtest_p2p_io_scheduler test:p2p:socket: <<: *test_definition script: - jbuilder build @test/p2p/runtest_p2p_socket test:p2p:pool: <<: *test_definition script: - jbuilder build @test/p2p/runtest_p2p_pool test:proto_alpha:transaction: <<: *test_definition script: - jbuilder build @test/proto_alpha/runtest_transaction test:proto_alpha:origination: <<: *test_definition script: - jbuilder build @test/proto_alpha/runtest_origination test:proto_alpha:endorsement: <<: *test_definition script: - jbuilder build @test/proto_alpha/runtest_endorsement test:proto_alpha:vote: <<: *test_definition script: - jbuilder build @test/proto_alpha/runtest_vote test:basic.sh: <<: *test_definition script: - jbuilder build @test/runtest_basic.sh test:contracts.sh: <<: *test_definition script: - jbuilder build @test/runtest_contracts.sh test:multinode.sh: <<: *test_definition script: - jbuilder build @test/runtest_multinode.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 --deps-only ${package} - opam install --yes --with-test ${package} tags: - gitlab-org ##BEGIN_OPAM## opam:00:tezos-stdlib: <<: *opam_definition variables: package: tezos-stdlib opam:01:ocplib-resto: <<: *opam_definition variables: package: ocplib-resto opam:02:tezos-data-encoding: <<: *opam_definition variables: package: tezos-data-encoding opam:03:ocplib-resto-directory: <<: *opam_definition variables: package: ocplib-resto-directory opam:04:tezos-error-monad: <<: *opam_definition variables: package: tezos-error-monad opam:05:tezos-rpc: <<: *opam_definition variables: package: tezos-rpc opam:06:tezos-stdlib-lwt: <<: *opam_definition variables: package: tezos-stdlib-lwt opam:07:tezos-crypto: <<: *opam_definition variables: package: tezos-crypto opam:08:tezos-base: <<: *opam_definition variables: package: tezos-base opam:09:tezos-protocol-environment-sigs: <<: *opam_definition variables: package: tezos-protocol-environment-sigs opam:10:irmin-leveldb: <<: *opam_definition variables: package: irmin-leveldb opam:11:tezos-micheline: <<: *opam_definition variables: package: tezos-micheline opam:12:tezos-protocol-compiler: <<: *opam_definition variables: package: tezos-protocol-compiler opam:13:tezos-storage: <<: *opam_definition variables: package: tezos-storage opam:14:ocplib-resto-cohttp: <<: *opam_definition variables: package: ocplib-resto-cohttp opam:15:tezos-p2p: <<: *opam_definition variables: package: tezos-p2p opam:16:tezos-protocol-updater: <<: *opam_definition variables: package: tezos-protocol-updater opam:17:tezos-rpc-http: <<: *opam_definition variables: package: tezos-rpc-http opam:18:tezos-shell-services: <<: *opam_definition variables: package: tezos-shell-services opam:19:tezos-shell: <<: *opam_definition variables: package: tezos-shell opam:20:tezos-embedded-protocol-alpha: <<: *opam_definition variables: package: tezos-embedded-protocol-alpha opam:21:tezos-embedded-protocol-demo: <<: *opam_definition variables: package: tezos-embedded-protocol-demo opam:22:tezos-embedded-protocol-genesis: <<: *opam_definition variables: package: tezos-embedded-protocol-genesis opam:23:tezos-client-base: <<: *opam_definition variables: package: tezos-client-base opam:24:ocplib-resto-json: <<: *opam_definition variables: package: ocplib-resto-json opam:25:tezos-embedded-client-alpha: <<: *opam_definition variables: package: tezos-embedded-client-alpha opam:26:tezos-embedded-client-genesis: <<: *opam_definition variables: package: tezos-embedded-client-genesis opam:27:ocplib-ezresto: <<: *opam_definition variables: package: ocplib-ezresto opam:28:tezos-client: <<: *opam_definition variables: package: tezos-client opam:29:tezos-node: <<: *opam_definition variables: package: tezos-node opam:30:ocplib-ezresto-directory: <<: *opam_definition variables: package: ocplib-ezresto-directory opam:31:tezos-test: <<: *opam_definition variables: package: tezos-test opam:32:tezos-protocol-genesis: <<: *opam_definition variables: package: tezos-protocol-genesis opam:33:tezos-protocol-demo: <<: *opam_definition variables: package: tezos-protocol-demo opam:34:tezos-protocol-alpha: <<: *opam_definition variables: package: tezos-protocol-alpha ##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_deps.sh "${build_deps_image}" "${CI_COMMIT_SHA}" "${opam_image}:alpine-${alpine_version}_ocaml-${ocaml_version}" "yes" - ./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... publish: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}"