Skip to content

Instantly share code, notes, and snippets.

@kolyadin
Created June 19, 2018 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kolyadin/906e47b54fc5f88713aee337ff0aa694 to your computer and use it in GitHub Desktop.
Save kolyadin/906e47b54fc5f88713aee337ff0aa694 to your computer and use it in GitHub Desktop.
bla
stages:
- build
- test
- deploy
- performance
variables:
MYSQL_DATABASE: database
MYSQL_ROOT_PASSWORD: database_password
COMPOSER_CACHE_DIR: /cache/php-composer
NPM_CONFIG_CACHE: /cache/node-npm
BUNDLE_PATH: /cache/ruby-gems
YARN_CACHE_FOLDER: /cache/node-yarn
DEV_ABSOLUTE_URL: https://toyota-brand-hub.demo.isobar.ru/
STAG_ABSOLUTE_URL: https://stag.pushthelimit.ru/
PROD_ABSOLUTE_URL: https://pushthelimit.ru/
before_script:
- rm -f /usr/local/etc/php/conf.d/xdebug.ini
- echo 'date.timezone=Europe/Moscow' >> /usr/local/etc/php/conf.d/extra.ini
- echo 'memory_limit = 1G' >> /usr/local/etc/php/conf.d/extra.ini
build_backend:
stage: build
image: kolyadin/php:71
script:
- composer install --profile --prefer-dist -n
- bin/security-checker security:check
cache: {}
build_frontend:
stage: build
image: node:6.9
before_script: []
script:
- npm i -g yarn
- yarn add global gulp
- yarn
- yarn run dist
cache:
key: ${CI_PROJECT_PATH_SLUG}
paths:
- node_modules/
- web/bundles/frontend/
##
# PHP 7.1 + mysql 5.7
##
test_admin:
stage: test
image: kolyadin/php:71
services:
- mysql:5.7
script: &test_script
- composer install --profile --prefer-dist -n
- bin/setup-test.sh
- bin/phpunit -c app/phpunit.xml --testsuite=Admin --tap
cache: {}
##
# PHP 7.1 + mysql 5.7
##
test_website:
stage: test
image: kolyadin/php:71
services:
- mysql:5.7
script: &test_script
- composer install --profile --prefer-dist -n
- bin/setup-test.sh
- bin/phpunit -c app/phpunit.xml --testsuite=Website --tap
cache: {}
##
# Deploy
##
.deploy: &deploy
stage: deploy
image: ruby:2.4
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$DEPLOY_SERVER_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
script:
- bundle install
tags:
- deploy
deploy_dev:
<<: *deploy
script:
- bundle exec cap dev deploy
only:
- dev
deploy_stag:
<<: *deploy
script:
- bundle exec cap stag deploy
only:
- stag
deploy_prod:
<<: *deploy
script:
- bundle exec cap prod deploy
only:
- master
##
# Performance
##
.pagespeed: &pagespeed
stage: performance
image: kolyadin/google-pagespeed:latest
before_script: []
variables:
GIT_STRATEGY: none
cache: {}
allow_failure: true
tags:
- performance
pagespeed_dev:
<<: *pagespeed
script:
- psi --strategy desktop $DEV_ABSOLUTE_URL
- psi --strategy mobile $DEV_ABSOLUTE_URL
only:
- dev
pagespeed_stag:
<<: *pagespeed
script:
- psi --strategy desktop $STAG_ABSOLUTE_URL
- psi --strategy mobile $STAG_ABSOLUTE_URL
only:
- stag
pagespeed_prod:
<<: *pagespeed
script:
- psi --strategy desktop $PROD_ABSOLUTE_URL
- psi --strategy mobile $PROD_ABSOLUTE_URL
only:
- master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment