ligo/.gitlab-ci.yml

181 lines
4.2 KiB
YAML
Raw Normal View History

# TODO: remove this as submodules aren't used anymore.
variables:
2019-05-14 20:17:39 +04:00
GIT_SUBMODULE_STRATEGY: recursive
LIGO_REGISTRY_IMAGE_BASE_NAME: "${CI_PROJECT_PATH}/${CI_PROJECT_NAME}"
WEBIDE_IMAGE_NAME: "registry.gitlab.com/${CI_PROJECT_PATH}/ligo_webide"
2019-05-27 14:06:56 +04:00
stages:
- build
- push
2020-05-21 20:03:15 +04:00
- ide-deploy
2020-05-15 19:57:22 +04:00
- versioning
.docker-image:
stage: push
image: docker:19.03.5
2019-05-27 14:06:56 +04:00
services:
- docker:19.03.5-dind
2020-05-15 19:57:22 +04:00
version_scheduled_job:
stage: versioning
script:
- scripts/versioning.sh
only:
- schedules
.nix:
stage: build
tags:
- nix
before_script:
- find "$CI_PROJECT_DIR" -path "$CI_PROJECT_DIR/.git" -prune -o "(" -type d -a -not -perm -u=w ")" -exec chmod --verbose u+w {} ";"
- nix-env -f channel:nixos-unstable -iA gnutar gitMinimal
# The binary produced is useless by itself
binary:
extends: .nix
only:
- merge_requests
- dev
- /^.*-run-dev$/
script:
- nix-build nix -A ligo-bin
doc:
extends: .nix
only:
- merge_requests
- dev
- /^.*-run-dev$/
script:
- nix-build nix -A ligo-doc
- cp -Lr --no-preserve=mode,ownership,timestamps result/share/doc .
artifacts:
paths:
- doc
test:
extends: .nix
only:
- merge_requests
- dev
- /^.*-run-dev$/
script:
- nix-build nix -A ligo-coverage
- cp -Lr --no-preserve=mode,ownership,timestamps result/share/coverage .
artifacts:
paths:
- coverage
2020-05-21 20:13:11 +04:00
webide-e2e:
extends: .nix
script:
- nix-build nix -A ligo-editor.e2e
docker:
extends: .nix
only:
- merge_requests
- dev
- /^.*-run-dev$/
script:
- nix-build nix -A ligo-docker
- cp -L result ligo.tar.gz
artifacts:
paths:
- ligo.tar.gz
docker-push:
extends: .docker-image
dependencies:
- docker
needs:
- docker
rules:
# Only deploy docker when from the dev branch AND on the canonical ligolang/ligo repository
- if: '$CI_COMMIT_REF_NAME =~ /^(dev|.*-run-dev)$/ && $CI_PROJECT_PATH == "ligolang/ligo"'
when: always
script:
- echo ${LIGO_REGISTRY_PASSWORD} | docker login -u ${LIGO_REGISTRY_USER} --password-stdin
- docker load -i=./ligo.tar.gz
- export LIGO_REGISTRY_FULL_NAME=${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:$(if test "$CI_COMMIT_REF_NAME" = "dev"; then echo next; else echo next-attempt; fi)
- docker tag ligo "${LIGO_REGISTRY_FULL_NAME}"
- docker push "${LIGO_REGISTRY_FULL_NAME}"
webide-docker:
extends: .nix
only:
- merge_requests
- dev
- /^.*-run-dev$/
script:
- nix-build nix -A ligo-editor-docker
- cp -L result webide.tar.gz
artifacts:
paths:
- webide.tar.gz
webide-push:
extends: .docker-image
dependencies:
- webide-docker
needs:
- webide-docker
rules:
# Only deploy docker when from the dev branch AND on the canonical ligolang/ligo repository
- if: '$CI_COMMIT_REF_NAME =~ /^(dev|.*-run-dev)$/ && $CI_PROJECT_PATH == "ligolang/ligo"'
when: always
script:
- echo "${CI_BUILD_TOKEN}" | docker login -u gitlab-ci-token --password-stdin registry.gitlab.com
- docker load -i=./webide.tar.gz
- docker tag ligo-editor "${WEBIDE_IMAGE_NAME}:${CI_COMMIT_SHORT_SHA}"
- docker push "${WEBIDE_IMAGE_NAME}:${CI_COMMIT_SHORT_SHA}"
2020-05-21 20:03:15 +04:00
deploy-handoff:
# Handoff deployment duties to private repo
stage: ide-deploy
variables:
IDE_DOCKER_IMAGE: "registry.gitlab.com/${CI_PROJECT_PATH}/ligo_webide"
LIGO_COMMIT_REF_NAME: "${CI_COMMIT_SHORT_SHA}"
trigger: ligolang/ligo-webide-deploy
rules:
- if: '$CI_COMMIT_REF_NAME == "dev"'
when: always
static-binary:
extends: .nix
only:
- merge_requests
- dev
- /^.*-run-dev$/
script:
- nix-build nix -A ligo-static
# Check that the binary is truly static and has 0 dependencies
- test $(nix-store -q --references ./result | wc -l) -eq 0
- cp -L result/bin/ligo ligo
- chmod +rwx ligo
artifacts:
paths:
- ligo
.website:
extends: .nix
script:
- nix-build nix -A ligo-website
- cp -Lr --no-preserve=mode,ownership,timestamps result/ public
artifacts:
paths:
- public
pages:
extends: .website
rules:
- if: '$CI_COMMIT_REF_NAME == "dev" && $CI_PROJECT_PATH == "ligolang/ligo"'
when: always
pages-attempt:
extends: .website
only:
- merge_requests
- /^.*-run-dev$/