-
Notifications
You must be signed in to change notification settings - Fork 49
Continuous Integration
JP Barbosa edited this page Mar 14, 2016
·
7 revisions
brew install php70-xdebug
echo "remote_enable=on" >> /usr/local/etc/php/7.0/conf.d/ext-xdebug.ini
echo "remote_handler=dbgp" >> /usr/local/etc/php/7.0/conf.d/ext-xdebug.ini
echo "remote_host=localhost" >> /usr/local/etc/php/7.0/conf.d/ext-xdebug.ini
echo "remote_port=8000" >> /usr/local/etc/php/7.0/conf.d/ext-xdebug.ini
nano composer.json
...
"require-dev": {
...
"codeception/c3": "2.*"
},
...
composer update
echo 'c3.php' >> .gitignore
nano public/index.php
...
$app = require_once __DIR__.'/../bootstrap/app.php';
if (env('APP_ENV') == 'testing') {
require __DIR__.'/../c3.php';
}
...
nano codeception.yml
...
coverage:
enabled: true
c3_url: 'http://localhost:8000'
include:
- app/*
redis-server
php artisan serve --env=testing
selenium-server
vendor/bin/codecept run --coverage --coverage-xml --env=testing
...
OK (10 tests, 10 assertions)
Code Coverage Report:
2015-07-17 17:14:26
Summary:
Classes: 48.39% (15/31)
Methods: 30.77% (16/52)
Lines: 32.02% (65/203)
...
XML report generated in coverage.xml
The follow steps require that you pushed your repository to GitHub.
open https://codeclimate.com/github/signup
export CODECLIMATE_REPO_TOKEN=XXXXXXXXXXXXXXXX
mkdir build
mkdir build/logs/
cp tests/_output/coverage.xml build/logs/clover.xml
echo "build" >> .gitignore
nano .codeclimate.yml
languages:
PHP: true
JavaScript: true
exclude_paths:
- ".bowerrc_files/*"
- ".bootstrap/cache/*"
- "node_modules/*"
- "public/*"
- "storage/*"
- "tests/_data/*"
- "tests/_output/*"
- "tests/_support/*"
- "vendor/*"
composer require codeclimate/php-test-reporter
./vendor/bin/test-reporter
Test coverage data sent.
wget https://raw.githubusercontent.com/codeship/scripts/master/packages/selenium_server.sh
open https://codeship.com/projects
Do not forget to replace YOUR_APP_KEY.
## Set env variables
export APP_ENV=testing
export APP_DEBUG=true
export APP_KEY=YOUR_APP_KEY
export DB_CONNECTION=sqlite
export SQLITE_FILE=testing.sqlite
## Set php version through phpenv. 5.5, 5.6 and 7.0 available
phpenv local 7.0
## Install dependencies through composer
composer install --no-interaction
## Install app node packages, bower and gulp
nvm install 4.0
npm install
## Install app bower packages
bower install --config.interactive=false
## Compile assets
gulp --production
## Database
touch database/testing.sqlite
php artisan migrate --env=testing
## Start server
php artisan serve >/dev/null 2>&1 &
sh selenium_server.sh
## Run tests
vendor/bin/codecept run --no-interaction --fail-fast
git add .
git commit -m "Add code coverage, Codeship and Code Climate"
git push -u origin master
open https://codeship.com/projects
Tip: If you changed some configuration and got any problem, try to click on "Reset Dependency Cache"
Next step: Deploy with Heroku
- Setup
- Basic CRUD
- Validation
- Views
- Association
- Association Controller
- Association Views
- Basic Template
- Bootstrap
- Bootstrap CRUD
- Alerts
- Welcome Page
- Ajax CRUD
- Send Email
- Send Email Views
- Jobs Queue
- Captcha
- Async External Content
- Cached External Content
- Tests Setup
- Functional Tests
- Acceptance Tests
- Continuous Integration
- Deploy with Heroku
- Deploy with Forge
- Update README