2016-08-09 12:23:05 +05:30
|
|
|
stages:
|
|
|
|
- test
|
|
|
|
- build
|
|
|
|
- release
|
|
|
|
|
|
|
|
variables:
|
2016-12-05 21:52:24 +05:30
|
|
|
CONTAINER_IMAGE: "registry.ely.by/elyby/accounts"
|
2016-08-09 12:23:05 +05:30
|
|
|
|
|
|
|
test:backend:
|
2016-12-05 21:52:24 +05:30
|
|
|
image: docker:latest
|
2016-08-09 12:23:05 +05:30
|
|
|
services:
|
2016-12-05 21:52:24 +05:30
|
|
|
- mariadb:10.0
|
|
|
|
- redis:3.0-alpine
|
|
|
|
variables:
|
|
|
|
# mariadb config
|
|
|
|
MYSQL_RANDOM_ROOT_PASSWORD: "true"
|
|
|
|
MYSQL_DATABASE: "ely_accounts_test"
|
|
|
|
MYSQL_USER: "ely_accounts_tester"
|
|
|
|
MYSQL_PASSWORD: "ely_accounts_tester_password"
|
2016-08-09 12:23:05 +05:30
|
|
|
stage: test
|
|
|
|
before_script:
|
|
|
|
- docker login -u gitlab-ci -p $CI_BUILD_TOKEN registry.ely.by
|
|
|
|
- echo "$SSH_PRIVATE_KEY" > id_rsa
|
|
|
|
script:
|
2016-12-05 21:52:24 +05:30
|
|
|
- export TEMP_DEV_IMAGE="${CONTAINER_IMAGE}:ci-${CI_BUILD_ID}"
|
|
|
|
- docker build --pull -f Dockerfile-dev -t $TEMP_DEV_IMAGE .
|
|
|
|
- >
|
|
|
|
docker run --rm
|
|
|
|
--add-host=mariadb:`getent hosts mariadb | awk '{ print $1 ; exit }'`
|
|
|
|
--add-host=redis:`getent hosts redis | awk '{ print $1 ; exit }'`
|
|
|
|
-e YII_DEBUG="true"
|
|
|
|
-e YII_ENV="test"
|
|
|
|
-e DB_HOST="mariadb"
|
|
|
|
-e DB_DATABASE="ely_accounts_test"
|
|
|
|
-e DB_USER="ely_accounts_tester"
|
|
|
|
-e DB_PASSWORD="ely_accounts_tester_password"
|
|
|
|
-e REDIS_HOST="redis"
|
|
|
|
$TEMP_DEV_IMAGE
|
|
|
|
php vendor/bin/codecept run -c tests
|
2016-08-09 12:23:05 +05:30
|
|
|
|
|
|
|
test:frontend:
|
2017-08-08 15:10:39 +05:30
|
|
|
image: node:8.2.1
|
2016-08-09 12:23:05 +05:30
|
|
|
stage: test
|
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- frontend/node_modules
|
|
|
|
script:
|
|
|
|
- cd frontend
|
2016-12-04 18:42:36 +05:30
|
|
|
- npm i --silent > /dev/null
|
2017-04-12 00:56:58 +05:30
|
|
|
- npm run lint --silent
|
2017-08-09 03:40:58 +05:30
|
|
|
# - npm run flow --silent # disabled due to missing libelf.so.1 in docker container
|
2016-12-04 18:42:36 +05:30
|
|
|
- npm run test --silent
|
2016-08-09 12:23:05 +05:30
|
|
|
|
|
|
|
build:production:
|
|
|
|
image: docker:latest
|
|
|
|
stage: build
|
|
|
|
before_script:
|
|
|
|
- docker login -u gitlab-ci -p $CI_BUILD_TOKEN registry.ely.by
|
|
|
|
- echo "$SSH_PRIVATE_KEY" > id_rsa
|
2016-11-23 13:58:06 +05:30
|
|
|
- echo "$FRONTEND_ENV_CONFIG" > frontend/config/env.js
|
2016-08-09 12:23:05 +05:30
|
|
|
script:
|
|
|
|
- export IMAGE_NAME="$CONTAINER_IMAGE:latest"
|
|
|
|
- docker build --pull -t $IMAGE_NAME .
|
|
|
|
only:
|
|
|
|
- develop
|
|
|
|
- tags
|
|
|
|
|
|
|
|
release:latest:
|
|
|
|
image: docker:latest
|
|
|
|
stage: release
|
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: none
|
|
|
|
before_script:
|
|
|
|
- docker login -u gitlab-ci -p $CI_BUILD_TOKEN registry.ely.by
|
|
|
|
script:
|
|
|
|
- docker push $CONTAINER_IMAGE:latest
|
|
|
|
only:
|
|
|
|
- develop
|
|
|
|
- tags
|
|
|
|
|
|
|
|
release:tag:
|
|
|
|
image: docker:latest
|
|
|
|
stage: release
|
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: none
|
|
|
|
before_script:
|
|
|
|
- docker login -u gitlab-ci -p $CI_BUILD_TOKEN registry.ely.by
|
|
|
|
script:
|
|
|
|
- export IMAGE_NAME="$CONTAINER_IMAGE:$CI_BUILD_TAG"
|
|
|
|
- docker tag $CONTAINER_IMAGE:latest $IMAGE_NAME
|
|
|
|
- docker push $IMAGE_NAME
|
|
|
|
only:
|
|
|
|
- tags
|