ligo/.gitlab-ci.yml
2018-03-08 06:26:56 +01:00

610 lines
12 KiB
YAML

variables:
opam_image: ${CI_REGISTRY_IMAGE}/opam
build_deps_image: ${CI_REGISTRY_IMAGE}/build_deps
public_docker_image: docker.io/${CI_PROJECT_PATH}
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:
- ./scripts/apply_patch.sh "${CI_COMMIT_REF_NAME}"
- opam list
tags:
- gitlab-org
## Tezos
build:
<<: *build_deps_definition
stage: build
except:
- master
- alphanet
- zeronet
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
- alphanet
- zeronet
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
- /^.*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:pbkdf:
<<: *opam_definition
variables:
package: pbkdf
opam:13:ocplib-resto-cohttp:
<<: *opam_definition
variables:
package: ocplib-resto-cohttp
opam:14:irmin-leveldb:
<<: *opam_definition
variables:
package: irmin-leveldb
opam:15:tezos-stdlib-unix:
<<: *opam_definition
variables:
package: tezos-stdlib-unix
opam:16:bip39:
<<: *opam_definition
variables:
package: bip39
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-storage:
<<: *opam_definition
variables:
package: tezos-storage
opam:20:tezos-protocol-compiler:
<<: *opam_definition
variables:
package: tezos-protocol-compiler
opam:21:tezos-client-base:
<<: *opam_definition
variables:
package: tezos-client-base
opam:22:tezos-protocol-alpha:
<<: *opam_definition
variables:
package: tezos-protocol-alpha
opam:23:tezos-protocol-environment:
<<: *opam_definition
variables:
package: tezos-protocol-environment
opam:24:tezos-client-alpha:
<<: *opam_definition
variables:
package: tezos-client-alpha
opam:25:tezos-client-commands:
<<: *opam_definition
variables:
package: tezos-client-commands
opam:26:tezos-baking-alpha:
<<: *opam_definition
variables:
package: tezos-baking-alpha
opam:27:tezos-protocol-genesis:
<<: *opam_definition
variables:
package: tezos-protocol-genesis
opam:28:tezos-protocol-updater:
<<: *opam_definition
variables:
package: tezos-protocol-updater
opam:29:tezos-p2p:
<<: *opam_definition
variables:
package: tezos-p2p
opam:30:ocplib-resto-json:
<<: *opam_definition
variables:
package: ocplib-resto-json
opam:31:tezos-baking-alpha-commands:
<<: *opam_definition
variables:
package: tezos-baking-alpha-commands
opam:32:tezos-client-alpha-commands:
<<: *opam_definition
variables:
package: tezos-client-alpha-commands
opam:33:tezos-client-base-unix:
<<: *opam_definition
variables:
package: tezos-client-base-unix
opam:34:tezos-client-genesis:
<<: *opam_definition
variables:
package: tezos-client-genesis
opam:35:tezos-embedded-protocol-alpha:
<<: *opam_definition
variables:
package: tezos-embedded-protocol-alpha
opam:36:tezos-embedded-protocol-demo:
<<: *opam_definition
variables:
package: tezos-embedded-protocol-demo
opam:37:tezos-embedded-protocol-genesis:
<<: *opam_definition
variables:
package: tezos-embedded-protocol-genesis
opam:38:tezos-shell:
<<: *opam_definition
variables:
package: tezos-shell
opam:39:ocplib-ezresto:
<<: *opam_definition
variables:
package: ocplib-ezresto
opam:40:tezos-client:
<<: *opam_definition
variables:
package: tezos-client
opam:41:tezos-node:
<<: *opam_definition
variables:
package: tezos-node
opam:42:ocplib-ezresto-directory:
<<: *opam_definition
variables:
package: ocplib-ezresto-directory
opam:43:tezos-baker-alpha:
<<: *opam_definition
variables:
package: tezos-baker-alpha
opam:44:tezos-protocol-demo:
<<: *opam_definition
variables:
package: tezos-protocol-demo
opam:45:tezos-protocol-environment-shell:
<<: *opam_definition
variables:
package: tezos-protocol-environment-shell
##END_OPAM##
## Publishing (small) docker images with tezos binaries
publish:docker:minimal:
<<: *dind_definition
stage: publish
only:
- master
- alphanet
- zeronet
script:
- ./scripts/apply_patch.sh "${CI_COMMIT_REF_NAME}" ;
- ./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
- ./scripts/apply_patch.sh "${CI_COMMIT_REF_NAME}" ;
- 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
documentation:
image: ${build_deps_image}:${CI_COMMIT_SHA}
stage: test
only:
- /^.*doc.*$/
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
tags:
- gitlab-org
## Relaunching the bootstrap servers of the alphanet/zeronet
.bootstrap_template: &bootstrap_definition
image: ${opam_image}
stage: deploy
dependencies: []
before_script:
- echo "${CI_KH}" > ~/.ssh/known_hosts
- echo "${CI_PK_ALPHANET}" | tr -d "\r" > ~/.ssh/id_ed25519 ;
- echo "${CI_SSH_CONFIG}" | tr -d "\r" > ~/.ssh/config
- chmod 600 ~/.ssh/id_ed25519
- sudo apk add --no-cache openssh
allow_failure: true
tags:
- gitlab-org
deploy:bootstrap1:
<<: *bootstrap_definition
only:
- alphanet@tezos/tezos
script:
- ssh bootstrap1
deploy:bootstrap2:
<<: *bootstrap_definition
only:
- alphanet@tezos/tezos
script:
- ssh bootstrap2
deploy:bootstrap3:
<<: *bootstrap_definition
only:
- alphanet@tezos/tezos
script:
- ssh bootstrap3
deploy:bootstrap4:
<<: *bootstrap_definition
only:
- alphanet@tezos/tezos
script:
- ssh bootstrap4
deploy:bootstrap5:
<<: *bootstrap_definition
only:
- alphanet@tezos/tezos
script:
- ssh bootstrap5
deploy:bootstrap6:
<<: *bootstrap_definition
only:
- alphanet@tezos/tezos
script:
- ssh bootstrap6
deploy:zeronet1:
<<: *bootstrap_definition
only:
- zeronet@tezos/tezos
script:
- ssh zeronet1
deploy:zeronet2:
<<: *bootstrap_definition
only:
- zeronet@tezos/tezos
script:
- ssh zeronet2
deploy:zeronet3:
<<: *bootstrap_definition
only:
- zeronet@tezos/tezos
script:
- ssh zeronet3
# 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}"