Merge branch '2-gitlab-ci-cd-pipeline-does-not-do-any-linting-or-testing' into 'master'
Resolve "Gitlab CI/CD Pipeline does not do any linting or testing" Closes #2 See merge request daniel/personal-website!3
This commit is contained in:
commit
99166666a3
15
.env.testing
Normal file
15
.env.testing
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
APP_NAME=Laravel
|
||||||
|
APP_ENV=testing
|
||||||
|
APP_KEY=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=http://localhost
|
||||||
|
|
||||||
|
LOG_CHANNEL=stack
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
|
BROADCAST_DRIVER=log
|
||||||
|
CACHE_DRIVER=file
|
||||||
|
FILESYSTEM_DRIVER=local
|
||||||
|
QUEUE_CONNECTION=sync
|
||||||
|
SESSION_DRIVER=file
|
||||||
|
SESSION_LIFETIME=120
|
||||||
@ -1,7 +1,70 @@
|
|||||||
stages:
|
stages:
|
||||||
|
- build
|
||||||
|
- test
|
||||||
- docker
|
- docker
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
|
variables:
|
||||||
|
MYSQL_DATABASE: portfolio
|
||||||
|
MYSQL_ROOT_PASSWORD: password
|
||||||
|
|
||||||
|
php-build-job:
|
||||||
|
stage: build
|
||||||
|
image: composer:2
|
||||||
|
script:
|
||||||
|
- composer install
|
||||||
|
- php artisan key:generate
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- .env.testing
|
||||||
|
- vendor/
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- vendor/
|
||||||
|
|
||||||
|
node-build-job:
|
||||||
|
stage: build
|
||||||
|
image: node:16
|
||||||
|
script:
|
||||||
|
- yarn
|
||||||
|
- yarn dev
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- public/js
|
||||||
|
- public/css
|
||||||
|
- public/fonts
|
||||||
|
- public/mix-manifest.json
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- node_modules/
|
||||||
|
|
||||||
|
test-job:
|
||||||
|
stage: test
|
||||||
|
image: php:8-cli
|
||||||
|
services:
|
||||||
|
- mysql:5
|
||||||
|
needs:
|
||||||
|
- php-build-job
|
||||||
|
- node-build-job
|
||||||
|
dependencies:
|
||||||
|
- php-build-job
|
||||||
|
- node-build-job
|
||||||
|
script:
|
||||||
|
- pecl install xdebug
|
||||||
|
- echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini
|
||||||
|
- echo "xdebug.mode=coverage" >> /usr/local/etc/php/conf.d/xdebug.ini
|
||||||
|
- export DB_CONNECTION=mysql
|
||||||
|
- export DB_HOST=mysql
|
||||||
|
- export DB_PORT=3306
|
||||||
|
- export DB_DATABASE="$MYSQL_DATABASE"
|
||||||
|
- export DB_USERNAME=root
|
||||||
|
- export DB_PASSWORD="$MYSQL_ROOT_PASSWORD"
|
||||||
|
- ./vendor/bin/phpunit --coverage-text --coverage-cobertura php-coverage.xml
|
||||||
|
artifacts:
|
||||||
|
reports:
|
||||||
|
cobertura: php-coverage.xml
|
||||||
|
coverage: '/^\s*Lines:\s*\d+(.\d+)?\%/'
|
||||||
|
|
||||||
docker-auth-job:
|
docker-auth-job:
|
||||||
stage: docker
|
stage: docker
|
||||||
image: docker:stable
|
image: docker:stable
|
||||||
@ -21,6 +84,8 @@ docker-build-job:
|
|||||||
only:
|
only:
|
||||||
refs:
|
refs:
|
||||||
- master
|
- master
|
||||||
|
needs:
|
||||||
|
- test-job
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
script:
|
script:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user