fix gitlabci

This commit is contained in:
Jack Goh
2018-08-01 17:10:55 +08:00
parent 8bb44ae394
commit 0f0b62f462
3 changed files with 29 additions and 24 deletions
+6 -13
View File
@@ -1,24 +1,17 @@
APP_ENV=testing
APP_ENV=test
APP_DEBUG=true
APP_KEY=base64:Owaz/+O4RzKLOptjD28yfP1KeTiqsPOVgOPjP8/ZWIE=
APP_KEY=w7VQXeA7U31DCdh1U39lpRz0iD7i0oCI
APP_URL=http://localhost
CACHE_DRIVER=array
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret
CACHE_DRIVER=file
SESSION_DRIVER=file
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=sync
MAIL_DRIVER=log
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
JWT_TTL=60
JWT_REFRESH_TTL=21600
JWT_BLACKLIST_GRACE_PERIOD=30
JWT_SECRET=FwYx3SPFxjpEDxAwcaSIV6eExQiMtGWx
+5 -8
View File
@@ -9,26 +9,23 @@ apt-get update -yqq
apt-get install git libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev -yqq
# Compile PHP, include these extensions.
docker-php-ext-install mbstring pdo_mysql curl json intl gd xml zip bz2 opcache
docker-php-ext-install mbstring mcrypt pdo_mysql curl json intl gd xml zip bz2 opcache
# Install Composer and project dependencies.
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
composer install
curl -sS https://getcomposer.org/installer | php
php composer.phar install
# Copy over testing configuration.
cp .env.testing .env
# Install xdebug
#pecl install xdebug && docker-php-ext-enable xdebug
pecl install xdebug && docker-php-ext-enable xdebug
# Generate an application key. Re-cache.
php artisan key:generate
php artisan jwt:secret
php artisan config:cache
php artisan config:clear
# php artisan optimize // remove after laravel 5.6
php artisan optimize
# Run database migrations with seeder
php artisan migrate:refresh --seed
+18 -3
View File
@@ -1,16 +1,16 @@
before_script:
- bash .gitlab-ci.sh
stages:
- testing
- staging
variables:
DB_HOST: mysql
DB_PORT: 3306
MYSQL_DATABASE: default
MYSQL_USER: default
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: root
unitTesting:
stage: testing
image: php:7.2.6
@@ -18,3 +18,18 @@ unitTesting:
- mysql:5.7
script:
- vendor/bin/phpunit --coverage-text --colors=never --configuration phpunit.xml
staging:
stage: staging
before_script:
- mkdir -p ~/.ssh
- echo -e "$DEV_SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- sudo mv ~/.ssh/known_hosts ~/.ssh/known_hosts_backup
- chmod 600 ~/.ssh/id_rsa
- '[[ ! -e /.dockerenv ]] && exit 0'
script:
- ssh jack@$DEMO_SERVER "git pull origin master && cd docker && docker-compose exec workspace composer install && docker-compose exec workspace php artisan migrate"
environment:
name: staging
url: https://demo.12eat.cheap
when: manual