add database test

This commit is contained in:
Martin Kiragu
2023-03-02 09:20:02 +03:00
parent 99e90ad357
commit 53805f3608
2 changed files with 28 additions and 4 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=shpping_portal
DB_USERNAME=root
DB_PASSWORD=
DB_PASSWORD=root
BROADCAST_DRIVER=log
CACHE_DRIVER=file
+27 -3
View File
@@ -9,9 +9,9 @@ stages:
# Variables
variables:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: mysql_user
MYSQL_PASSWORD: mysql_password
MYSQL_DATABASE: mysql_db
MYSQL_USER: root
MYSQL_PASSWORD: root
MYSQL_DATABASE: shpping_portal
DB_HOST: mysql
@@ -42,6 +42,7 @@ before_script:
#jobs
#buld the backend
composer_php:
stage: service_build
@@ -61,4 +62,27 @@ node_gulp:
rules:
- if: '$CI_COMMIT_BRANCH =~ /.*/'
#mysql
database:
stage: database
services:
- name: mysql:8.0
command: [ "--default-authentication-plugin=mysql_native_password" ]
dependencies:
- composer_php
before_script:
- cp .env.example .env
- echo "extension=pdo_mysql.so" >> /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini
- php artisan config:cache
script:
- php artisan migrate:fresh
- php artisan db:seed
- mysqldump --host="${DB_HOST}" --user="${MYSQL_USER}" --password="${MYSQL_PASSWORD}" "${MYSQL_DATABASE}" > db.sql
rules:
- if: '$CI_COMMIT_BRANCH =~ /.*/'