In preparation for the hacking day I am doing a blog series. First because we are dealing with issues we need to get our environment ready. I assume you have git installed, hub installed also since it is amazing to do quick PRs and the basic stuff, like composer system wide installed and your latest version of php5.5 installed among other things. Make sure you fork symfony/symfony also on your github account and upload your public ssh key.
Create two folders at least:
mkdir symfony-standard cd symfony-standard git clone git://github.com/symfony/symfony-standard.git . composer install --prefer-source cd vendor/symfony/symfony composer install --prefer-source git remote add cordoval git@github.com:cordoval/symfony.git git checkout master git remote update git pull -u origin master git checkout -b my-first-contribution-to-symfony-community git push -u cordoval my-first-contribution-to-symfony-community cd ../../../../ cp -rf symfony-standard symfony-standard2 |
So far we have two SE’s with symfony under vendors.
Even though we have travis let’s get our local phpunit right:
composer global require 'phpunit/phpunit=3.7.*' ... pico ~/.zshrc ... export PATH="$HOME/.composer/vendor/bin:$PATH" ... which phpunit phpunit --version PHPUnit 3.7.28 by Sebastian Bergmann. ... brew install parallel touch ~/.parallel/local pico ~/.parallel/local ... source ~/.bash_profile |
Parallel is a tool that will run tests faster than in the serial way.
After this you have all configured to run phpunit in parallel:
ls -d src/Symfony/*/* | parallel -J local --gnu --keep-order 'echo "Running {} tests"; phpunit --exclude-group tty,benchmark {};' |
If some apc related tests are failing and you are on php5.5 then you need to clean your apc.ini configuration, commenting everything but the new apcu extension:
[apcu] extension="/usr/local/Cellar/php55-apcu/4.0.2/apcu.so" ;apc.enabled=1 ;apc.shm_size=64M ;apc.ttl=7200 ;apc.mmap_file_mask=/tmp/apc.XXXXXX ;apc.enable_cli=1 |
If you have weird errors or tests are slow please be sure to comment the lines of your xdebug extension as above for apc but for xdebug.ini.
Notice if you run it serial it should also work, but why waiting for it to finish?
A trick to run only your tests is to add an annotation on the upper part of the class like:
/**
* @group cordoval
*/ |
And then run only it by doing:
phpunit --group=cordoval |
Ok so now you have vendor/symfony/symfony repo ready synced with master ready to contribute on the bleeding edge.
If you need to do work on another branch then you can easily just check it out and branch off of it. You have two directories so you can run tests on one and or do parallel work trying things so not just parallel tests.
By all mean try to avoid your specific ways of setting things. This flow here works and works well and it is what you are expected to have to contribute. You can go your own way as long as you know what you are doing, but it is best not to cause any delay on that day when we can avoid it.
So far so good, we want everybody to be ready for the hacking day in Warsaw.