From 645a217da50b91da18290b00f6b2a459ed6e6148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Sat, 20 Apr 2019 00:31:49 +0200 Subject: [PATCH] CI 1 --- .gitlab-ci.yml | 649 ++----------------------------------------------- 1 file changed, 20 insertions(+), 629 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b2a3f27c4..3fba54ea9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,635 +1,26 @@ -variables: - ## Please update `scripts/version.sh` accordingly - build_deps_image_version: 9f0956e21f4dcd2803d83072903872eba196bef8 - build_deps_image_name: registry.gitlab.com/tezos/opam-repository - public_docker_image_name: docker.io/${CI_PROJECT_PATH} +before_script: + - apt-get update -qq + - apt-get -y -qq install libhidapi-dev libcap-dev bubblewrap + - wget https://github.com/ocaml/opam/releases/download/2.0.1/opam-2.0.1-x86_64-linux -O opam-2.0.1-x86_64-linux + - cp opam-2.0.1-x86_64-linux /usr/local/bin/opam + - chmod +x /usr/local/bin/opam + - export PATH="/usr/local/bin${PATH:+:}${PATH:-}" + - echo "$PATH" + - printf '' | opam init + - eval $(opam config env) + - opam repository add tezos-opam-repository https://gitlab.com/gabriel.alfour/tezos-opam-repository.git + - eval $(opam config env) + - opam --version + - printf '' | ocaml -stages: - - doc - - build - - test - - packaging - - publish - - -############################################################ -## Stage: build (only MR) ## -############################################################ - -.build_template: &build_definition - image: ${build_deps_image_name}:${build_deps_image_version} - stage: build - except: - - master - - alphanet - - zeronet - - mainnet - - alphanet-staging - - zeronet-staging - - mainnet-staging - before_script: - - opam list - - . ./scripts/version.sh - tags: - - gitlab-org - -check_opam_deps: - <<: *build_definition +default-job: script: - - if [ "${build_deps_image_version}" != "${opam_repository_tag}" ] ; then - echo "Inconsistent dependencies hash between 'scripts/version.sh' and '.gitlab-ci.yml'." ; - exit 1 ; - fi - - ./scripts/opam-check.sh - - ./scripts/check_opam_test.sh - -check_indentation: - <<: *build_definition - script: - - dune build @runtest_indent - -build: - <<: *build_definition - script: - - dune build @runtest_dune_template - - make all + - opam install -y --working-dir . + - dune build && dune build -p ligo && dune build @ligo-test artifacts: paths: - - _build - expire_in: 1 day + - src/ligo/bin/cli.ml - - -############################################################ -## Stage: test (only MR) ## -############################################################ - -.test_template: &test_definition - <<: *build_definition - stage: test - dependencies: - - build - -test:stdlib: - <<: *test_definition +install-from-repo-job: script: - - dune build @src/lib_stdlib/runtest - -test:stdlib_unix: - <<: *test_definition - script: - - dune build @src/lib_stdlib_unix/runtest - -test:data_encoding: - <<: *test_definition - script: - - dune build @src/lib_data_encoding/runtest - -test:storage: - <<: *test_definition - script: - - dune build @src/lib_storage/runtest - -test:crypto: - <<: *test_definition - script: - - dune build @src/lib_crypto/runtest - -test:shell: - <<: *test_definition - script: - - dune build @src/lib_shell/runtest - -test:p2p:io-scheduler: - <<: *test_definition - script: - - dune build @src/lib_p2p/runtest_p2p_io_scheduler_ipv4 - -test:p2p:socket: - <<: *test_definition - script: - - dune build @src/lib_p2p/runtest_p2p_socket_ipv4 - -test:p2p:pool: - <<: *test_definition - script: - - dune build @src/lib_p2p/runtest_p2p_pool_ipv4 - -test:proto_alpha:lib_protocol: - <<: *test_definition - script: - - dune build @src/proto_alpha/lib_protocol/runtest - -test:proto_alpha:lib_client: - <<: *test_definition - script: - - dune build @src/proto_alpha/lib_client/test/runtest - -test:p2p:peerset: - <<: *test_definition - script: - - dune build @src/lib_p2p/runtest_p2p_peerset - -test:p2p:ipv6set: - <<: *test_definition - script: - - dune build @src/lib_p2p/runtest_p2p_ipv6set - -test:p2p:banned_peers: - <<: *test_definition - script: - - dune build @src/lib_p2p/runtest_p2p_banned_peers - -test:client_alpha:vote: - <<: *test_definition - script: - - dune build @src/proto_alpha/lib_delegate/runtest_vote - -test:basic.sh: - <<: *test_definition - script: - - dune build @src/bin_client/runtest_basic.sh - -test:contracts.sh: - <<: *test_definition - script: - - dune build @src/bin_client/runtest_contracts.sh - -test:contracts_opcode.sh: - <<: *test_definition - script: - - dune build @src/bin_client/runtest_contracts_opcode.sh - -test:contracts_macros.sh: - <<: *test_definition - script: - - dune build @src/bin_client/runtest_contracts_macros.sh - -test:contracts_mini_scenarios.sh: - <<: *test_definition - script: - - dune build @src/bin_client/runtest_contracts_mini_scenarios.sh - -test:multinode.sh: - <<: *test_definition - script: - - dune build @src/bin_client/runtest_multinode.sh - -test:inject.sh: - <<: *test_definition - script: - - dune build @src/bin_client/runtest_injection.sh - -test:voting.sh: - <<: *test_definition - script: - - dune build @src/bin_client/runtest_voting.sh - -test:proto:sandbox: - <<: *test_definition - script: - - dune build @runtest_sandbox - -test:documentation: - <<: *test_definition - script: - - sudo apk add --no-cache py3-sphinx py3-sphinx_rtd_theme - - sudo pip3 uninstall 'idna' --yes ## Fix up dependencies in alpine:3.8 - - sudo pip3 install 'idna<2.7' - - sudo ln -s /usr/bin/sphinx-build-3 /usr/bin/sphinx-build - - make doc-html - -test:linkcheck: - <<: *test_definition - script: - - sudo apk add --no-cache py3-sphinx py3-sphinx_rtd_theme - - sudo pip3 uninstall 'idna' --yes ## Fix up dependencies in alpine:3.8 - - sudo pip3 install 'idna<2.7' - - sudo ln -s /usr/bin/sphinx-build-3 /usr/bin/sphinx-build - - make doc-html-and-linkcheck - allow_failure: true - -test:validation: - <<: *test_definition - script: - - dune build @src/lib_validation/runtest - -test:micheline: - <<: *test_definition - script: - - dune build @src/lib_micheline/runtest - -############################################################ -## 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: [] - only: - - master - - /^.*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:ocplib-json-typed: - <<: *opam_definition - variables: - package: ocplib-json-typed - -opam:01:ocplib-json-typed-bson: - <<: *opam_definition - variables: - package: ocplib-json-typed-bson - -opam:02:tezos-stdlib: - <<: *opam_definition - variables: - package: tezos-stdlib - -opam:03:tezos-data-encoding: - <<: *opam_definition - variables: - package: tezos-data-encoding - -opam:04:ocplib-resto: - <<: *opam_definition - variables: - package: ocplib-resto - -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:blake2: - <<: *opam_definition - variables: - package: blake2 - -opam:08:hacl: - <<: *opam_definition - variables: - package: hacl - -opam:09:secp256k1: - <<: *opam_definition - variables: - package: secp256k1 - -opam:10:tezos-clic: - <<: *opam_definition - variables: - package: tezos-clic - -opam:11:tezos-rpc: - <<: *opam_definition - variables: - package: tezos-rpc - -opam:12:uecc: - <<: *opam_definition - variables: - package: uecc - -opam:13:tezos-crypto: - <<: *opam_definition - variables: - package: tezos-crypto - -opam:14:tezos-micheline: - <<: *opam_definition - variables: - package: tezos-micheline - -opam:15:lmdb: - <<: *opam_definition - variables: - package: lmdb - -opam:16:pbkdf: - <<: *opam_definition - variables: - package: pbkdf - -opam:17:ocplib-resto-cohttp: - <<: *opam_definition - variables: - package: ocplib-resto-cohttp - -opam:18:tezos-base: - <<: *opam_definition - variables: - package: tezos-base - -opam:19:irmin-lmdb: - <<: *opam_definition - variables: - package: irmin-lmdb - -opam:20:bip39: - <<: *opam_definition - variables: - package: bip39 - -opam:21:tezos-rpc-http: - <<: *opam_definition - variables: - package: tezos-rpc-http - -opam:22:tezos-shell-services: - <<: *opam_definition - variables: - package: tezos-shell-services - -opam:23:tezos-stdlib-unix: - <<: *opam_definition - variables: - package: tezos-stdlib-unix - -opam:24:tezos-storage: - <<: *opam_definition - variables: - package: tezos-storage - -opam:25:tezos-protocol-environment-sigs: - <<: *opam_definition - variables: - package: tezos-protocol-environment-sigs - -opam:26:ledgerwallet: - <<: *opam_definition - variables: - package: ledgerwallet - -opam:27:tezos-client-base: - <<: *opam_definition - variables: - package: tezos-client-base - -opam:28:tezos-protocol-compiler: - <<: *opam_definition - variables: - package: tezos-protocol-compiler - -opam:29:ledgerwallet-tezos: - <<: *opam_definition - variables: - package: ledgerwallet-tezos - -opam:30:tezos-signer-services: - <<: *opam_definition - variables: - package: tezos-signer-services - -opam:31:tezos-protocol-alpha: - <<: *opam_definition - variables: - package: tezos-protocol-alpha - -opam:32:tezos-protocol-environment: - <<: *opam_definition - variables: - package: tezos-protocol-environment - -opam:33:tezos-signer-backends: - <<: *opam_definition - variables: - package: tezos-signer-backends - -opam:34:tezos-client-alpha: - <<: *opam_definition - variables: - package: tezos-client-alpha - -opam:35:tezos-client-commands: - <<: *opam_definition - variables: - package: tezos-client-commands - -opam:36:tezos-protocol-environment-shell: - <<: *opam_definition - variables: - package: tezos-protocol-environment-shell - -opam:37:tezos-baking-alpha: - <<: *opam_definition - variables: - package: tezos-baking-alpha - -opam:38:tezos-protocol-genesis: - <<: *opam_definition - variables: - package: tezos-protocol-genesis - -opam:39:ocplib-resto-json: - <<: *opam_definition - variables: - package: ocplib-resto-json - -opam:40:tezos-protocol-updater: - <<: *opam_definition - variables: - package: tezos-protocol-updater - -opam:41:tezos-p2p: - <<: *opam_definition - variables: - package: tezos-p2p - -opam:42:tezos-baking-alpha-commands: - <<: *opam_definition - variables: - package: tezos-baking-alpha-commands - -opam:43:tezos-client-alpha-commands: - <<: *opam_definition - variables: - package: tezos-client-alpha-commands - -opam:44:tezos-client-base-unix: - <<: *opam_definition - variables: - package: tezos-client-base-unix - -opam:45:tezos-client-genesis: - <<: *opam_definition - variables: - package: tezos-client-genesis - -opam:46:ocplib-ezresto: - <<: *opam_definition - variables: - package: ocplib-ezresto - -opam:47:tezos-embedded-protocol-alpha: - <<: *opam_definition - variables: - package: tezos-embedded-protocol-alpha - -opam:48:tezos-shell: - <<: *opam_definition - variables: - package: tezos-shell - -opam:49:tezos-embedded-protocol-demo: - <<: *opam_definition - variables: - package: tezos-embedded-protocol-demo - -opam:50:tezos-embedded-protocol-genesis: - <<: *opam_definition - variables: - package: tezos-embedded-protocol-genesis - -opam:51:tezos-endorser-alpha-commands: - <<: *opam_definition - variables: - package: tezos-endorser-alpha-commands - -opam:52:tezos-client: - <<: *opam_definition - variables: - package: tezos-client - -opam:53:ocplib-ezresto-directory: - <<: *opam_definition - variables: - package: ocplib-ezresto-directory - -opam:54:tezos-validation: - <<: *opam_definition - variables: - package: tezos-validation - -opam:55:tezos-accuser-alpha: - <<: *opam_definition - variables: - package: tezos-accuser-alpha - -opam:56:tezos-endorser-alpha: - <<: *opam_definition - variables: - package: tezos-endorser-alpha - -opam:57:tezos-accuser-alpha-commands: - <<: *opam_definition - variables: - package: tezos-accuser-alpha-commands - -opam:58:tezos-baker-alpha: - <<: *opam_definition - variables: - package: tezos-baker-alpha - -opam:59:tezos-protocol-demo: - <<: *opam_definition - variables: - package: tezos-protocol-demo - -opam:60:tezos-signer: - <<: *opam_definition - variables: - package: tezos-signer - -opam:61:tezos-node: - <<: *opam_definition - variables: - package: tezos-node - -opam:62:ocplib-json-typed-browser: - <<: *opam_definition - variables: - package: ocplib-json-typed-browser - -opam:63:tezos-baker-alpha-commands: - <<: *opam_definition - variables: - package: tezos-baker-alpha-commands - -opam:63:tezos-client-demo: - <<: *opam_definition - variables: - package: tezos-client-demo - -##END_OPAM## - - - -############################################################ -## Stage: publish ## -############################################################ - -publish:docker: - image: docker:latest - services: - - docker:dind - variables: - DOCKER_DRIVER: overlay2 - stage: publish - only: - - master - - alphanet - - zeronet - - mainnet - - alphanet-staging - - zeronet-staging - - mainnet-staging - before_script: - - apk add git - - 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}" - - docker push "${public_docker_image_name}:${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 push "${public_docker_image_name}:${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHORT_SHA}_${LAST_COMMIT_DATE_TIME}" - tags: - - safe_docker - -publish:doc: - image: ${build_deps_image_name}:${build_deps_image_version} - stage: doc - only: - - master - - alphanet - - zeronet - - mainnet - before_script: - - sudo apk add --no-cache py3-sphinx py3-sphinx_rtd_theme openssh-client rsync - - sudo pip3 uninstall 'idna' --yes ## Fix up dependencies in alpine:3.8 - - sudo pip3 install 'idna<2.7' - - sudo ln -s /usr/bin/sphinx-build-3 /usr/bin/sphinx-build - - 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 git@gitlab.com:${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAMESPACE}.gitlab.io gitlab.io - - rsync --recursive --links --perms --delete --verbose - --exclude=.doctrees - docs/_build/ gitlab.io/public/"${CI_COMMIT_REF_NAME}" - - cd gitlab.io - - if [ -z "$(git status -s)" ] ; then - echo "Nothing to commit!" ; - else - git add public/"${CI_COMMIT_REF_NAME}" ; - git commit -m "Import doc for ${CI_COMMIT_REF_NAME} (${CI_COMMIT_SHA})" ; - git push origin master ; - fi - tags: - - gitlab-org + - opam install ligo