Merge branch 'ci/webide_improvements' into 'dev'
Refactor webide CI config and some general CI config See merge request ligolang/ligo!412
This commit is contained in:
commit
fddda1a0a2
@ -4,14 +4,16 @@ variables:
|
||||
build_binary_script: "./scripts/distribution/generic/build.sh"
|
||||
package_binary_script: "./scripts/distribution/generic/package.sh"
|
||||
LIGO_REGISTRY_IMAGE_BASE_NAME: "${CI_PROJECT_PATH}/${CI_PROJECT_NAME}"
|
||||
WEBIDE_IMAGE_NAME: "registry.gitlab.com/${CI_PROJECT_PATH}/ligo_webide"
|
||||
|
||||
stages:
|
||||
- test
|
||||
- ide
|
||||
- build_and_package_binaries
|
||||
- build_docker
|
||||
- build_and_deploy_docker
|
||||
- build_and_deploy_website
|
||||
- build_and_deploy
|
||||
- ide-build
|
||||
- ide-e2e-test
|
||||
- ide-deploy
|
||||
|
||||
# TODO provide sensible CI for master
|
||||
dont-merge-to-master:
|
||||
@ -32,7 +34,7 @@ dont-merge-to-master:
|
||||
- dist/package/**/*
|
||||
|
||||
.website_build: &website_build
|
||||
stage: build_and_deploy_website
|
||||
stage: build_and_deploy
|
||||
image: node:8
|
||||
dependencies:
|
||||
- build-and-package-debian-9
|
||||
@ -126,17 +128,19 @@ build-current-docker-image:
|
||||
# When a MR/PR is merged to dev
|
||||
# take the previous build and publish it to Docker Hub
|
||||
build-and-publish-latest-docker-image:
|
||||
stage: build_and_deploy_docker
|
||||
stage: build_and_deploy
|
||||
<<: *docker
|
||||
dependencies:
|
||||
- build-and-package-debian-10
|
||||
script:
|
||||
- sh scripts/build_docker_image.sh
|
||||
- sh scripts/test_cli.sh
|
||||
- docker login -u $LIGO_REGISTRY_USER -p $LIGO_REGISTRY_PASSWORD
|
||||
- echo ${LIGO_REGISTRY_PASSWORD} | docker login -u ${LIGO_REGISTRY_USER} --password-stdin
|
||||
- docker push ${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:next
|
||||
only:
|
||||
- dev
|
||||
rules:
|
||||
# Only deploy docker when from the dev branch AND on the canonical ligolang/ligo repository
|
||||
- if: '$CI_COMMIT_REF_NAME == "dev" && $CI_PROJECT_PATH == "ligolang/ligo"'
|
||||
when: always
|
||||
|
||||
# It'd be a good idea to generate those jobs dynamically,
|
||||
# based on desired targets
|
||||
@ -192,16 +196,72 @@ build-and-package-ubuntu-19-04:
|
||||
only:
|
||||
- dev
|
||||
|
||||
|
||||
trigger-webide:
|
||||
stage: ide
|
||||
trigger:
|
||||
include: tools/webide/webide-ci.yml
|
||||
|
||||
|
||||
# Pages are deployed from dev, be careful not to override 'next'
|
||||
# in case something gets merged into 'dev' while releasing.
|
||||
pages:
|
||||
<<: *website_build
|
||||
rules:
|
||||
- if: '$CI_COMMIT_REF_NAME == "dev" && $CI_PROJECT_PATH == "ligolang/ligo"'
|
||||
when: always
|
||||
|
||||
# WEBIDE jobs
|
||||
|
||||
run-webide-unit-tests:
|
||||
stage: test
|
||||
image: node:12-alpine
|
||||
script:
|
||||
- cd tools/webide/packages/server
|
||||
- npm ci
|
||||
- npm run test
|
||||
only:
|
||||
- dev
|
||||
changes:
|
||||
- tools/webide/**
|
||||
|
||||
build-publish-ide-image:
|
||||
stage: build_and_deploy
|
||||
<<: *docker
|
||||
script:
|
||||
- ls -F
|
||||
- find dist/
|
||||
- find dist/package/ -name '*ligo_*deb'
|
||||
- mv $(realpath dist/package/debian-10/*.deb) tools/webide/ligo_deb10.deb
|
||||
- cd tools/webide
|
||||
- echo "${CI_BUILD_TOKEN}" | docker login -u gitlab-ci-token --password-stdin registry.gitlab.com
|
||||
- >
|
||||
docker build
|
||||
-t "${WEBIDE_IMAGE_NAME}:${CI_COMMIT_SHORT_SHA}"
|
||||
--build-arg GIT_TAG="${CI_COMMIT_SHA}"
|
||||
--build-arg GIT_COMMIT="${CI_COMMIT_SHORT_SHA}"
|
||||
.
|
||||
- docker push "${WEBIDE_IMAGE_NAME}:${CI_COMMIT_SHORT_SHA}"
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
when: always
|
||||
- if: '$CI_COMMIT_REF_NAME == "dev"'
|
||||
when: always
|
||||
|
||||
run-webide-e2e-tests:
|
||||
stage: ide-e2e-test
|
||||
<<: *docker
|
||||
image: tmaier/docker-compose
|
||||
script:
|
||||
- cd tools/webide/packages/e2e
|
||||
- export WEBIDE_IMAGE="${WEBIDE_IMAGE_NAME}:${CI_COMMIT_SHORT_SHA}"
|
||||
- docker-compose run e2e
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
when: always
|
||||
- if: '$CI_COMMIT_REF_NAME == "dev"'
|
||||
when: always
|
||||
|
||||
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
|
||||
|
||||
|
@ -1,70 +0,0 @@
|
||||
# This Gitlab CI config is triggerd by the main ligo gitlab config file
|
||||
image: docker
|
||||
services:
|
||||
- docker:dind
|
||||
|
||||
variables:
|
||||
CONTAINER_NAME: "registry.gitlab.com/${CI_PROJECT_PATH}/ligo_webide"
|
||||
|
||||
stages:
|
||||
- unit-test
|
||||
- build
|
||||
- e2e-test
|
||||
- deploy
|
||||
|
||||
run-webide-unit-tests:
|
||||
stage: unit-test
|
||||
image: node:12-alpine
|
||||
script:
|
||||
- cd tools/webide/packages/server
|
||||
- npm ci
|
||||
- npm run test
|
||||
|
||||
build-docker-image:
|
||||
stage: build
|
||||
script:
|
||||
- cd tools/webide
|
||||
- apk add curl unzip
|
||||
# Fetch the builid artifact from the upstream debian10 build job, extract the deb
|
||||
# package file and name it so that the Dockerfile can pick it up during the
|
||||
# build process.
|
||||
- >
|
||||
curl
|
||||
--fail
|
||||
--location
|
||||
--output artifacts.zip
|
||||
"https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/jobs/artifacts/${CI_COMMIT_REF_NAME}/download?job=build-and-package-debian-10"
|
||||
- mv $(unzip -j artifacts.zip| sed -n 's/.*\('ligo_'.*\.deb\).*/\1/p') ligo_deb10.deb
|
||||
- echo "${CI_BUILD_TOKEN}" | docker login -u gitlab-ci-token --password-stdin registry.gitlab.com
|
||||
# Pull the last build to use as a cache image to shorten build times when
|
||||
# possible
|
||||
- docker pull "${CONTAINER_NAME}:latest" || true
|
||||
- >
|
||||
docker build
|
||||
--cache-from "${CONTAINER_NAME}:latest"
|
||||
-t "${CONTAINER_NAME}:${CI_COMMIT_REF_NAME}"
|
||||
-t "${CONTAINER_NAME}:${CI_COMMIT_SHORT_SHA}"
|
||||
-t "${CONTAINER_NAME}:latest"
|
||||
--build-arg GIT_TAG="${CI_COMMIT_SHA}"
|
||||
--build-arg GIT_COMMIT="${CI_COMMIT_REF_NAME}"
|
||||
.
|
||||
- docker push "${CONTAINER_NAME}:${CI_COMMIT_REF_NAME}"
|
||||
- docker push "${CONTAINER_NAME}:${CI_COMMIT_SHORT_SHA}"
|
||||
- docker push "${CONTAINER_NAME}:latest"
|
||||
|
||||
run-webide-e2e-tests:
|
||||
stage: e2e-test
|
||||
image: tmaier/docker-compose
|
||||
script:
|
||||
- cd tools/webide/packages/e2e
|
||||
- export WEBIDE_IMAGE="${CONTAINER_NAME}:${CI_COMMIT_SHORT_SHA}"
|
||||
- docker-compose run e2e
|
||||
|
||||
deploy-handoff:
|
||||
# Handoff deployment duties to private repo
|
||||
stage: deploy
|
||||
variables:
|
||||
IDE_DOCKER_IMAGE: "registry.gitlab.com/${CI_PROJECT_PATH}/ligo_webide"
|
||||
LIGO_COMMIT_REF_NAME: "${CI_COMMIT_REF_NAME}"
|
||||
trigger: ligolang/ligo-webide-deploy
|
||||
|
Loading…
Reference in New Issue
Block a user