diff --git a/.env.sample b/.env.sample new file mode 100644 index 00000000..5e9bbbf7 --- /dev/null +++ b/.env.sample @@ -0,0 +1,24 @@ +APP_ENV=local +APP_DEBUG=true +APP_KEY=SomeRandomString +APP_URL=http://localhost + +DB_HOST=172.31.24.250 +DB_DATABASE=homestead +DB_USERNAME=homestead +DB_PASSWORD=sePret^i + +CACHE_DRIVER=file +SESSION_DRIVER=file +QUEUE_DRIVER=sync + +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_DRIVER=smtp +MAIL_HOST=mailtrap.io +MAIL_PORT=2525 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..ae636f4f --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,92 @@ +pipeline { + agent any + + stages { + stage('Initial Cleanup') { + steps { + deleteDir() + } + } + + stage('Checkout SCM') { + steps { + git branch: 'main', url: 'https://github.com/citadelict/php-todo.git' + } + } + + stage('Prepare Dependencies') { + steps { + sh 'mv .env.sample .env' + sh 'mkdir -p bootstrap/cache' + sh 'composer install' + sh 'php artisan migrate' + sh 'php artisan db:seed' + sh 'php artisan key:generate' + } + } + + stage('Execute Unit Tests') { + steps { + sh './vendor/bin/phpunit' + } + } + + stage('Code Analysis') { + steps { + sh 'phploc app/ --log-csv build/logs/phploc.csv' + } + } + + stage('Plot Code Coverage Report') { + steps { + plot csvFileName: 'plot-loc.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Lines of Code (LOC),Comment Lines of Code (CLOC),Non-Comment Lines of Code (NCLOC),Logical Lines of Code (LLOC)', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'A - Lines of Code', yaxis: 'Lines of Code' + plot csvFileName: 'plot-structures.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Directories,Files,Namespaces', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'B - Structures Containers', yaxis: 'Count' + plot csvFileName: 'plot-avg-length.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Average Class Length (LLOC),Average Method Length (LLOC),Average Function Length (LLOC)', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'C - Average Length', yaxis: 'Average Lines of Code' + plot csvFileName: 'plot-complexity.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Cyclomatic Complexity / Lines of Code,Cyclomatic Complexity / Number of Methods', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'D - Relative Cyclomatic Complexity', yaxis: 'Cyclomatic Complexity by Structure' + plot csvFileName: 'plot-classes.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Classes,Abstract Classes,Concrete Classes', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'E - Types of Classes', yaxis: 'Count' + plot csvFileName: 'plot-methods.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Methods,Non-Static Methods,Static Methods,Public Methods,Non-Public Methods', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'F - Types of Methods', yaxis: 'Count' + plot csvFileName: 'plot-constants.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Constants,Global Constants,Class Constants', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'G - Types of Constants', yaxis: 'Count' + plot csvFileName: 'plot-testing.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Test Classes,Test Methods', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'I - Testing', yaxis: 'Count' + plot csvFileName: 'plot-lloc.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Logical Lines of Code (LLOC),Classes Length (LLOC),Functions Length (LLOC),LLOC outside functions or classes', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'AB - Code Structure by Logical Lines of Code', yaxis: 'Logical Lines of Code' + plot csvFileName: 'plot-functions.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Functions,Named Functions,Anonymous Functions', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'H - Types of Functions', yaxis: 'Count' + plot csvFileName: 'plot-objects.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Interfaces,Traits,Classes,Methods,Functions,Constants', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'BB - Structure Objects', yaxis: 'Count' + } + } + + stage('Package Artifact') { + steps { + sh 'zip -qr php-todo.zip ${WORKSPACE}/*' + } + } + + stage('Upload Artifact to Artifactory') { + steps { + script { + def server = Artifactory.server 'artifactory-server' + def uploadSpec = """{ + "files": [ + { + "pattern": "php-todo.zip", + "target": "Todo-dev-local/php-todo", + "props": "type=zip;status=ready" + } + ] + }""" + println "Upload Spec: ${uploadSpec}" + try { + server.upload spec: uploadSpec + println "Upload successful" + } catch (Exception e) { + println "Upload failed: ${e.message}" + } + } + } + } + + stage('Deploy to Dev Environment') { + steps { + build job: 'ansibllle-config-mgt/main', parameters: [[$class: 'StringParameterValue', name: 'inventory', value: 'dev']], propagate: false, wait: true + } + } + } +} diff --git a/storage/app/.file b/storage/app/.file new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/storage/app/.file @@ -0,0 +1 @@ + diff --git a/storage/app/public/.p b/storage/app/public/.p new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/storage/app/public/.p @@ -0,0 +1 @@ + diff --git a/storage/framework/cache/.c b/storage/framework/cache/.c new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/storage/framework/cache/.c @@ -0,0 +1 @@ + diff --git a/storage/framework/sessions/.s b/storage/framework/sessions/.s new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/storage/framework/sessions/.s @@ -0,0 +1 @@ + diff --git a/storage/framework/views/.v b/storage/framework/views/.v new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/storage/framework/views/.v @@ -0,0 +1 @@ + diff --git a/storage/logs/laravel.log b/storage/logs/laravel.log new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/storage/logs/laravel.log @@ -0,0 +1 @@ +