Skip to:
Content

BuddyPress.org

Changeset 10997


Ignore:
Timestamp:
08/07/2016 01:47:28 PM (9 years ago)
Author:
djpaul
Message:

Travis-CI: adds code coverage with https://codecov.io

Adds a new Travis-CI task which runs PHPUnit with code coverage enabled.
The results are piped to codecov.io, which we're experimenting with to track
progress on our code's test coverage as the project grows.

Code coverage generation is very slow. To try to minimise the impact on the
rest of our Travis-CI configuration, the new travis:codecoverage task is
set in the allowed_failures section, which means Travis-CI should report
test pass/fail without waiting for the code coverage generation.

Another effort to speed this up has Travis-CI running the code coverage task
on PHP7 with phpdbg, as opposed to relying on xdebug, which is the default.

See #7207 and https://codecov.io/gh/buddypress/BuddyPress

Location:
trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/.travis.yml

    r10986 r10997  
    3636    - php: 7.0
    3737      env: WP_VERSION=master BP_TRAVISCI=travis:grunt
     38    - php: 7.0
     39      env: WP_VERSION=master BP_TRAVISCI=travis:codecoverage
    3840    - php: hhvm
    3941      sudo: required
     
    5254    - php: nightly
    5355    - php: hhvm
     56    - env: BP_TRAVISCI=travis:codecoverage WP_VERSION=master
    5457
    5558# before_install: Failures in this section will result in build status 'errored'
     
    6366  - cd ..
    6467  - mv $plugin_slug $plugin_dir
     68  # Disable xdebug if running codecoverage (use phpdbg instead).
     69  - if [[ "$BP_TRAVISCI" == "travis:codecoverage" ]] ; then phpenv config-rm xdebug.ini; fi
    6570  # set up tests config
    6671  - cd $WP_DEVELOP_DIR
     
    9196script: grunt $BP_TRAVISCI
    9297
     98+after_script:
     99- |
     100  if [[ "$BP_TRAVISCI" == "travis:codecoverage" ]] ; then
     101    bash <(curl -s https://codecov.io/bash)
     102  fi
     103
    93104notifications:
    94105  email: false
  • trunk/Gruntfile.js

    r10936 r10997  
    214214                cmd: 'phpunit',
    215215                args: ['-c', 'tests/phpunit/multisite.xml']
     216            },
     217            // Requires PHP 7+
     218            'codecoverage': {
     219                cmd: 'phpdbg',
     220                args: ['-qrr', 'phpunit', '-c', 'codecoverage.xml', '--coverage-clover', 'clover.xml' ]
    216221            }
    217222        },
     
    275280    });
    276281
    277     grunt.registerTask( 'test', 'Run all unit test tasks.', ['phpunit'] );
     282    grunt.registerTask( 'test', 'Run all unit test tasks.', ['phpunit:default', 'phpunit:multisite'] );
    278283
    279284    grunt.registerTask( 'jstest', 'Runs all JavaScript tasks.', [ 'jsvalidate:src', 'jshint' ] );
     
    282287    grunt.registerTask( 'travis:grunt', 'Runs Grunt build task.', [ 'build' ]);
    283288    grunt.registerTask( 'travis:phpunit', ['jsvalidate:src', 'jshint', 'checktextdomain', 'test'] );
     289    grunt.registerTask( 'travis:codecoverage', 'Runs PHPUnit tasks with code-coverage generation. Requires PHP7+.', [ 'phpunit:codecoverage' ]);
    284290
    285291    // Patch task.
Note: See TracChangeset for help on using the changeset viewer.