node { stage('download') { git branch: 'master', url: 'github/url/to/your/project' } stage('install') { sh 'composer install' } stage('init') { sh 'cp .env.example .env' sh 'php artisan key:generate' sh "sed -i -e 's/DB_DATABASE=homestead/DB_DATABASE=staging/g' .env" sh "sed -i -e 's/DB_USERNAME=homestead/DB_USERNAME=yourusername/g' .env" sh "sed -i -e 's/DB_PASSWORD=secret/DB_PASSWORD=yourpassword/g' .env" } stage('integration_testing') { sh 'vendor/bin/phpunit tests/Feature' } stage('acceptance_testing') { // Because we'll use database as session driver during testing, we have to explictly migrate sessions table. sh 'php artisan migrate' sh 'cp .env .env.dusk.local' sh "sed -i -e 's;APP_URL=http://localhost;APP_URL=your.domain.com;g' .env.dusk.local" // Use database as session driver instead of file so that every single test will not share the same session context. sh "sed -i -e 's/SESSION_DRIVER=file/SESSION_DRIVER=database/g' .env.dusk.local" // Allow web server to access storage directory. sh 'sudo chmod -R 775 storage/' sh 'sudo chown -R :www-data storage/' sh 'php artisan dusk' } }