cache mr build and test

This commit is contained in:
Blair Vanderlugt 2021-08-19 10:25:58 -04:00
parent abaf97d7b8
commit d4837226b6
2 changed files with 39 additions and 61 deletions

View File

@ -1,11 +1,11 @@
#include: include:
# - local: 'ci_templates/.cic-template.yml' # - local: 'ci_templates/.cic-template.yml'
# - local: 'apps/contract-migration/.gitlab-ci.yml' # - local: 'apps/contract-migration/.gitlab-ci.yml'
# - local: 'apps/cic-eth/.gitlab-ci.yml' # - local: 'apps/cic-eth/.gitlab-ci.yml'
# - local: 'apps/cic-ussd/.gitlab-ci.yml' # - local: 'apps/cic-ussd/.gitlab-ci.yml'
# - local: 'apps/cic-notify/.gitlab-ci.yml' # - local: 'apps/cic-notify/.gitlab-ci.yml'
# - local: 'apps/cic-meta/.gitlab-ci.yml' # - local: 'apps/cic-meta/.gitlab-ci.yml'
# - local: 'apps/cic-cache/.gitlab-ci.yml' - local: 'apps/cic-cache/.gitlab-ci.yml'
# - local: 'apps/data-seeding/.gitlab-ci.yml' # - local: 'apps/data-seeding/.gitlab-ci.yml'
image: registry.gitlab.com/grassrootseconomics/cic-internal-integration/docker-with-compose:latest image: registry.gitlab.com/grassrootseconomics/cic-internal-integration/docker-with-compose:latest
@ -22,6 +22,22 @@ stages:
variables: variables:
DOCKER_BUILDKIT: "1" DOCKER_BUILDKIT: "1"
COMPOSE_DOCKER_CLI_BUILD: "1" COMPOSE_DOCKER_CLI_BUILD: "1"
MR_IMAGE_TAG: $CI_REGISTRY_IMAGE/$APP_NAME:mr-$CI_COMMIT_SHORT_SHA
build-merge-request:
tags:
- integration
variables:
CI_DEBUG_TRACE: "true"
stage:
build
script:
- TAG=$MR_IMAGE_TAG FRONTEND_ENV=staging sh ./scripts/build-push.sh
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- apps/cic-cache/**/*
when: always
build-staging: build-staging:
tags: tags:
@ -33,7 +49,7 @@ build-staging:
script: script:
- TAG=stag FRONTEND_ENV=staging sh ./scripts/build-push.sh - TAG=stag FRONTEND_ENV=staging sh ./scripts/build-push.sh
only: only:
- bvander/integration-tests-on-docker - staging
deploy-staging: deploy-staging:
tags: tags:
@ -50,27 +66,8 @@ deploy-staging:
name: staging name: staging
url: https://stag.grassrootseconomics.net url: https://stag.grassrootseconomics.net
only: only:
- bvander/integration-tests-on-docker - staging
#tests:
# stage: test
# script:
# - sh ./scripts/test.sh
# tags:
# - build
# - test
#
#build-stag:
# stage: build
# script:
# - TAG=stag FRONTEND_ENV=staging sh ./scripts/build-push.sh
# only:
# - master
# tags:
# - build
# - test
#
#build-prod: #build-prod:
# stage: build # stage: build
# script: # script:
@ -81,24 +78,6 @@ deploy-staging:
# - build # - build
# - test # - test
# #
#deploy-stag:
# stage: deploy
# script:
# - >
# DOMAIN=stag.demo1.com
# TRAEFIK_TAG=stag.demo1.com
# STACK_NAME=stag-demo1-com
# TAG=stag
# sh ./scripts/deploy.sh
# environment:
# name: staging
# url: https://stag.demo1.com
# only:
# - master
# tags:
# - swarm
# - stag
#
#deploy-prod: #deploy-prod:
# stage: deploy # stage: deploy
# script: # script:

View File

@ -1,18 +1,17 @@
.cic_cache_variables: .cic_cache_variables:
variables: variables:
APP_NAME: cic-cache APP_NAME: cic-cache
DOCKERFILE_PATH: docker/Dockerfile_ci
CONTEXT: apps/$APP_NAME CONTEXT: apps/$APP_NAME
build-mr-cic-cache: #build-mr-cic-cache:
extends: # extends:
- .py_build_merge_request # - .py_build_merge_request
- .cic_cache_variables # - .cic_cache_variables
rules: # rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # - if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes: # changes:
- apps/cic-cache/**/* # - apps/cic-cache/**/*
when: always # when: always
test-mr-cic-cache: test-mr-cic-cache:
stage: test stage: test
@ -32,21 +31,21 @@ test-mr-cic-cache:
--extra-index-url https://gitlab.com/api/v4/projects/27624814/packages/pypi/simple --extra-index-url https://gitlab.com/api/v4/projects/27624814/packages/pypi/simple
-r test_requirements.txt -r test_requirements.txt
- export PYTHONPATH=. && pytest -x --cov=cic_cache --cov-fail-under=90 --cov-report term-missing tests - export PYTHONPATH=. && pytest -x --cov=cic_cache --cov-fail-under=90 --cov-report term-missing tests
needs: ["build-mr-cic-cache"] needs: ["build-merge-request"]
rules: rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes: changes:
- apps/$APP_NAME/**/* - apps/$APP_NAME/**/*
when: always when: always
build-push-cic-cache: #build-push-cic-cache:
extends: # extends:
- .py_build_push # - .py_build_push
- .cic_cache_variables # - .cic_cache_variables
rules: # rules:
- if: $CI_COMMIT_BRANCH == "master" # - if: $CI_COMMIT_BRANCH == "master"
changes: # changes:
- apps/cic-cache/**/* # - apps/cic-cache/**/*
when: always # when: always