Skip to content

Instantly share code, notes, and snippets.

@roman204
Last active October 22, 2017 08:02
Show Gist options
  • Save roman204/8ddfd857be0482b4269cd899e04bb34e to your computer and use it in GitHub Desktop.
Save roman204/8ddfd857be0482b4269cd899e04bb34e to your computer and use it in GitHub Desktop.
magento2 gitlab-CI config
image: copex/ci
before_script:
# Install ssh-agent if not already installed, it is required by Docker.
- which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
- ssh-add <(echo "$SSH_PRIVATE_KEY")
# For Docker builds disable host key checking. Be aware that by adding that
# you are suspectible to man-in-the-middle attacks.
# WARNING: Use this only with the Docker executor, if you use it with shell
# you will overwrite your user's SSH config.
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
# install git
- which git || ( apt-get update -y && apt-get install git -y )
# set php to version 7.0
- rm /etc/alternatives/php
- ln -s /usr/bin/php7.0 /etc/alternatives/php
stages:
- test
- deploy
test:
stage: test
only:
- master
script:
- php composer.phar install
- php -d memory_limit=-1 ./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist
deploy:
stage: deploy
only:
- master
script:
- REVISION=$CI_COMMIT_SHA cap production deploy --trace
environment: production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment