From d998d4917135b09c12c27ca3cb9f214ad40d23a9 Mon Sep 17 00:00:00 2001 From: Too Date: Fri, 22 Jun 2018 14:47:55 +0800 Subject: [PATCH] modify db variable --- .gitlab-ci.yml | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 940f9e0f..d5d9541a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,17 +1,41 @@ -before_script: - - bash .gitlab-ci.sh -stages: - - testing - - staging +image: registry.gitlab.com/ciefworldwidesdnbhd/exchange:latest + +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 + DB_HOST: mysql + +stages: + - test + - deploy + +unit_test: + stage: test script: - - vendor/bin/phpunit --coverage-text --colors=never --configuration phpunit.xml \ No newline at end of file + - 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 \ No newline at end of file