71 lines
2.0 KiB
YAML
71 lines
2.0 KiB
YAML
include:
|
|
#- local: 'ci_templates/.cic-template.yml' #kaniko build templates
|
|
# these includes are app specific unit tests
|
|
- local: 'apps/cic-eth/.gitlab-ci.yml'
|
|
- local: 'apps/cic-ussd/.gitlab-ci.yml'
|
|
- local: 'apps/cic-notify/.gitlab-ci.yml'
|
|
- local: 'apps/cic-meta/.gitlab-ci.yml'
|
|
- local: 'apps/cic-cache/.gitlab-ci.yml'
|
|
#- local: 'apps/contract-migration/.gitlab-ci.yml'
|
|
#- local: 'apps/data-seeding/.gitlab-ci.yml'
|
|
|
|
stages:
|
|
- version
|
|
- build
|
|
- test
|
|
- deploy
|
|
|
|
image: registry.gitlab.com/grassrootseconomics/cic-internal-integration/docker-with-compose:latest
|
|
|
|
variables:
|
|
DOCKER_BUILDKIT: "1"
|
|
COMPOSE_DOCKER_CLI_BUILD: "1"
|
|
CI_DEBUG_TRACE: "true"
|
|
SEMVERBOT_VERSION: "0.2.0"
|
|
|
|
#before_script:
|
|
# - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
|
|
|
version:
|
|
image: python:3.7-stretch
|
|
stage: version
|
|
script:
|
|
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
|
|
- ssh-keyscan gitlab.com >> ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts
|
|
- eval $(ssh-agent -s)
|
|
- ssh-add <(echo "$SSH_PRIVATE_KEY")
|
|
- curl -o sbot -L https://github.com/restechnica/semverbot/releases/download/v$SEMVERBOT_VERSION/sbot-linux-amd64
|
|
- chmod +x sbot
|
|
- git remote set-url origin git@gitlab.com:grassrootseconomics/cic-internal-integration.git
|
|
- export TAG=$(./sbot predict version -m auto)
|
|
- |
|
|
if [[ -z $TAG ]]
|
|
then
|
|
echo "tag could not be set $@"
|
|
exit 1
|
|
fi
|
|
- echo $TAG > version
|
|
- git tag -a v$TAG -m "ci tagged"
|
|
- git push origin v$TAG
|
|
artifacts:
|
|
paths:
|
|
- version
|
|
rules:
|
|
- if: $CI_COMMIT_REF_PROTECTED == "true"
|
|
when: always
|
|
|
|
# runs on protected branches and pushes to repo
|
|
build-push:
|
|
stage: build
|
|
tags:
|
|
- integration
|
|
#script:
|
|
# - TAG=$CI_Cbefore_script:
|
|
before_script:
|
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
|
script:
|
|
- TAG=$(cat ./version) ./scripts/build-push.sh
|
|
rules:
|
|
- if: $CI_COMMIT_REF_PROTECTED == "true"
|
|
when: always
|