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
|
|
|
|
2018-07-10 22:32:19 +05:30
|
|
|
check backend codestyle:
|
|
|
|
image: edbizarro/gitlab-ci-pipeline-php:7.2-alpine
|
|
|
|
stage: test
|
2018-07-10 22:38:43 +05:30
|
|
|
cache:
|
2018-07-11 03:30:47 +05:30
|
|
|
key: backend-vendor
|
2018-07-10 22:38:43 +05:30
|
|
|
paths:
|
|
|
|
- vendor
|
2018-07-10 22:32:19 +05:30
|
|
|
script:
|
2018-07-10 22:38:43 +05:30
|
|
|
- composer install
|
2018-07-10 22:32:19 +05:30
|
|
|
- vendor/bin/php-cs-fixer fix -v --dry-run
|
|
|
|
|
|
|
|
test backend:
|
|
|
|
image: edbizarro/gitlab-ci-pipeline-php:7.2-alpine
|
2016-08-09 12:23:05 +05:30
|
|
|
services:
|
2018-07-10 22:38:43 +05:30
|
|
|
- name: redis:4.0.10-alpine
|
|
|
|
alias: redis
|
|
|
|
- name: mariadb:10.2.11
|
|
|
|
alias: db
|
2016-12-05 21:52:24 +05:30
|
|
|
variables:
|
2018-07-10 22:38:43 +05:30
|
|
|
# App config
|
|
|
|
DB_HOST: "db"
|
|
|
|
DB_DATABASE: "ely_accounts_test"
|
|
|
|
DB_USER: "ely_accounts_tester"
|
|
|
|
DB_PASSWORD: "ely_accounts_tester_password"
|
|
|
|
REDIS_HOST: "redis"
|
|
|
|
REDIS_PORT: "6379"
|
|
|
|
# MariaDB config
|
2016-12-05 21:52:24 +05:30
|
|
|
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
|
2018-07-10 22:38:43 +05:30
|
|
|
cache:
|
2018-07-11 03:30:47 +05:30
|
|
|
key: backend-vendor
|
2018-07-10 22:38:43 +05:30
|
|
|
paths:
|
|
|
|
- vendor
|
|
|
|
before_script:
|
|
|
|
# While we not counting coverage, xdebug only slow down tests
|
|
|
|
- sudo rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
|
2016-08-09 12:23:05 +05:30
|
|
|
script:
|
2018-07-10 22:38:43 +05:30
|
|
|
- composer install
|
2019-02-23 01:49:52 +05:30
|
|
|
- php yii rbac/generate
|
|
|
|
- ./docker/php/wait-for-it.sh "${DB_HOST}:3306" -s -t 0 -- "php yii migrate/up --interactive=0"
|
|
|
|
- vendor/bin/codecept run
|
2016-08-09 12:23:05 +05:30
|
|
|
|
2018-07-10 22:32:19 +05:30
|
|
|
test frontend:
|
2017-12-13 18:35:30 +05:30
|
|
|
image: node:9.2.1-alpine
|
2016-08-09 12:23:05 +05:30
|
|
|
stage: test
|
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- frontend/node_modules
|
2017-12-13 18:35:30 +05:30
|
|
|
before_script:
|
|
|
|
# Enable SSL support for wget
|
2017-12-31 00:39:48 +05:30
|
|
|
- apk add --update openssl
|
2018-10-26 19:15:05 +05:30
|
|
|
# https://github.com/facebook/flow/issues/3649#issuecomment-414691014
|
|
|
|
- wget -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
|
|
|
|
- wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk
|
|
|
|
- apk add glibc-2.28-r0.apk
|
2016-08-09 12:23:05 +05:30
|
|
|
script:
|
|
|
|
- cd frontend
|
2017-12-13 03:43:36 +05:30
|
|
|
- yarn run build:install
|
|
|
|
- yarn run lint
|
2017-12-31 00:39:48 +05:30
|
|
|
- yarn flow
|
2017-12-13 03:43:36 +05:30
|
|
|
- yarn test
|
2016-08-09 12:23:05 +05:30
|
|
|
|
|
|
|
build:production:
|
2018-03-18 03:44:20 +05:30
|
|
|
image: docker:18.02
|
2016-08-09 12:23:05 +05:30
|
|
|
stage: build
|
2018-03-17 21:43:12 +05:30
|
|
|
variables:
|
|
|
|
GA_ID: "UA-45299905-3"
|
|
|
|
SENTRY_CDN: "https://088e7718236a4f91937a81fb319a93f6@sentry.ely.by/2"
|
2016-08-09 12:23:05 +05:30
|
|
|
before_script:
|
|
|
|
- docker login -u gitlab-ci -p $CI_BUILD_TOKEN registry.ely.by
|
2018-03-17 21:43:12 +05:30
|
|
|
- export VERSION="${CI_COMMIT_TAG:-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA:0:7}}"
|
2016-08-09 12:23:05 +05:30
|
|
|
- echo "$SSH_PRIVATE_KEY" > id_rsa
|
2018-03-17 21:43:12 +05:30
|
|
|
- |
|
|
|
|
echo "
|
|
|
|
module.exports = {
|
|
|
|
version: '$VERSION',
|
|
|
|
ga: {id: '$GA_ID'},
|
2018-03-18 05:34:46 +05:30
|
|
|
sentryCdn: '$SENTRY_CDN',
|
2018-03-17 21:43:12 +05:30
|
|
|
};
|
|
|
|
" > frontend/config/env.js
|
2018-03-18 05:09:13 +05:30
|
|
|
- sed -i"" -e "s/{{PLACE_VERSION_HERE}}/$VERSION/g" common/config/config.php
|
2016-08-09 12:23:05 +05:30
|
|
|
script:
|
|
|
|
- export IMAGE_NAME="$CONTAINER_IMAGE:latest"
|
2018-07-10 22:38:43 +05:30
|
|
|
- docker build --pull --build-arg build_env=prod -t $IMAGE_NAME .
|
2016-08-09 12:23:05 +05:30
|
|
|
only:
|
|
|
|
- develop
|
|
|
|
- tags
|
|
|
|
|
|
|
|
release:latest:
|
2018-03-18 03:44:20 +05:30
|
|
|
image: docker:18.02
|
2016-08-09 12:23:05 +05:30
|
|
|
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:
|
2018-03-18 03:44:20 +05:30
|
|
|
image: docker:18.02
|
2016-08-09 12:23:05 +05:30
|
|
|
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
|