diff --git a/.gitlab-ci.sh b/.gitlab-ci.sh index 3f4e5854..bc968b9b 100644 --- a/.gitlab-ci.sh +++ b/.gitlab-ci.sh @@ -16,7 +16,7 @@ curl -sS https://getcomposer.org/installer | php php composer.phar install # Copy over testing configuration. -cp .env.testing .env +cp .env-example .env # Install xdebug pecl install xdebug && docker-php-ext-enable xdebug diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 89aab85a..940f9e0f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,40 +1,17 @@ -image: registry.gitlab.com/ciefworldwidesdnbhd/exchange:latest - -services: - - mysql:5.7 - -variables: - MYSQL_DATABASE: homestead - MYSQL_ROOT_PASSWORD: secret - DB_HOST: mysql - DB_USERNAME: root - +before_script: + - bash .gitlab-ci.sh stages: - - test - - deploy - -unit_test: - stage: test + - testing + - staging +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 script: - - 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 + - vendor/bin/phpunit --coverage-text --colors=never --configuration phpunit.xml \ No newline at end of file