modify gitlab-ci.yml

This commit is contained in:
Too
2018-06-22 14:23:54 +08:00
parent beda8e28bd
commit 5cecd7e9da
+38 -15
View File
@@ -1,17 +1,40 @@
before_script:
- bash .gitlab-ci.sh
stages:
- testing
- staging
image: registry.gitlab.com/ciefworldwidesdnbhd/exchange:tag
services:
- mysql:5.7
variables:
MYSQL_DATABASE: default
MYSQL_USER: default
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: root
unitTesting:
stage: testing
image: php:7.0.13
services:
- mysql:5.7
MYSQL_DATABASE: homestead
MYSQL_ROOT_PASSWORD: secret
DB_HOST: mysql
DB_USERNAME: root
stages:
- test
- deploy
unit_test:
stage: test
script:
- vendor/bin/phpunit --coverage-text --colors=never --configuration phpunit.xml
- cp .env.example .env
- composer install
- php artisan key:generate
- php artisan migrate
- vendor/bin/phpunit
deploy_production:
stage: deploy
script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- ~/.composer/vendor/bin/envoy run deploy
environment:
name: production
url: http://192.168.1.1
when: manual
only:
- master