Skip to content

Commit

Permalink
Merge pull request #4 from kilip/wip
Browse files Browse the repository at this point in the history
repository split preparation
  • Loading branch information
kilip committed Jun 13, 2019
2 parents 9e395dd + 84e67b2 commit 16d10fc
Show file tree
Hide file tree
Showing 104 changed files with 2,151 additions and 475 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/vendor/
/build/
composer.lock
composer.lock
.php_cs.cache
7 changes: 2 additions & 5 deletions RoboFile.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the doyo/behat-code-coverage project.
* This file is part of the doyo/code-coverage project.
*
* (c) Anthonius Munthi <me@itstoni.com>
*
Expand Down Expand Up @@ -33,9 +33,7 @@ public function watch($options = ['coverage' => false])
$this->watch = true;

$paths = [
'src',
'tests',
'spec',
'src'
];

$this->taskWatch()
Expand Down Expand Up @@ -70,7 +68,6 @@ public function test()
/** @var \Robo\Result[] $results */
$results = [];
$results[] = $this->configurePhpSpec()->run();
//$results[] = $this->configurePhpUnit()->run();

if (!$this->watch) {
$results[] = $this->configureBehat()->run();
Expand Down
44 changes: 44 additions & 0 deletions bin/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash

#!/usr/bin/env bash

set -e

if (( "$#" != 1 ))
then
echo "Tag has to be provided"

exit 1
fi

BRANCH="master"
VERSION=$1

# Always prepend with "v"
if [[ $VERSION != v* ]]
then
VERSION="v$VERSION"
fi

for REMOTE in code-coverage-bridge behat-code-coverage phpspec-code-coverage
do
echo ""
echo ""
echo "Releasing $REMOTE";

TMP_DIR="/tmp/code-coverage-split"
REMOTE_URL="git@github.com:doyolabs/$REMOTE.git"

rm -rf $TMP_DIR;
mkdir $TMP_DIR;

(
cd $TMP_DIR;

git clone $REMOTE_URL .
git checkout "$BRANCH";

git tag -s $VERSION
git push origin --tags
)
done
23 changes: 23 additions & 0 deletions bin/split
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -x
set -e

BRANCH=$1

function split()
{
SHA1=`./bin/splitsh-lite --prefix=$1`
git push $2 "$SHA1:refs/heads/$BRANCH" -f
}

function remote()
{
git remote add $1 $2 || true
}

git pull origin $BRANCH

remote code-coverage-bridge git@github.com:doyolabs/code-coverage-bridge.git
remote behat-code-coverage git@github.com:doyolabs/behat-code-coverage.git
remote phpspec-code-coverage git@github.com:doyolabs/phpspec-code-coverage.git
Binary file added bin/splitsh-lite
Binary file not shown.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"psr-4": {
"Spec\\Doyo\\Bridge\\CodeCoverage\\": "src/code-coverage/Spec",
"Spec\\Doyo\\Behat\\CodeCoverage\\": "src/behat-extension/Spec",
"Spec\\Doyo\\PhpSpec\\CodeCoverage\\": "src/php-extension/Spec"
"Spec\\Doyo\\PhpSpec\\CodeCoverage\\": "src/phpspec-extension/Spec"
}
},
"replace": {
Expand Down
4 changes: 4 additions & 0 deletions src/behat-extension/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.gitignore export-ignore
.travis.yml export-ignore
Spec export-ignore
composer.lock export-ignore
3 changes: 3 additions & 0 deletions src/behat-extension/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/vendor/
/build/
composer.lock
62 changes: 62 additions & 0 deletions src/behat-extension/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
language: php

cache:
directories:
- $HOME/.composer/cache
- $HOME/bin
- vendor

.steps:
- &disable-php-memory-limit |
echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- &disable-xdebug-php-extension |
if [[ ${COVERAGE} != yes ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
- &update-project-dependencies |
composer update --prefer-dist --no-progress --no-suggest --ansi
- &install-php-coveralls |
composer require php-coveralls/php-coveralls --no-scripts
- &install-scrutinizer-ocular |
composer require scrutinizer/ocular --no-scripts
- &upload-coverage |
travis_retry vendor/bin/php-coveralls
travis_retry vendor/bin/ocular code-coverage:upload --format=php-clover build/logs/clover.xml
- &install-robo |
mkdir -p ${HOME}/bin || echo "directory exists"
export ROBO=${HOME}/bin/robo
[ -f "${ROBO}" ] && echo "installed" || wget -c https://github.com/kilip/robo/raw/site/robotheme/robo.phar -O ${ROBO}
chmod +x $ROBO
export PATH=${HOME}/bin:${PATH}
- &run-test |
./vendor/bin/phpcs
robo test
- &run-test-coverage
robo coverage
- &start-php-server
php -S localhost:8000 -t tests/Fixtures/public > /dev/null 2>&1 &

jobs:
include:
- php: '7.0'
- php: '7.1'
- php: '7.2'
- php: '7.3'
env: COVERAGE=yes
before_cache:
- *install-php-coveralls
- *install-scrutinizer-ocular
before_script: *start-php-server
script:
- *run-test-coverage
after_script:
- *upload-coverage

before_install:
- *disable-php-memory-limit
- *disable-xdebug-php-extension
- *install-robo

install:
- *update-project-dependencies

script:
- *run-test
14 changes: 11 additions & 3 deletions src/behat-extension/Compiler/CoveragePass.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
<?php

/*
* This file is part of the doyo/code-coverage project.
*
* (c) Anthonius Munthi <me@itstoni.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Doyo\Behat\CodeCoverage\Compiler;
declare(strict_types=1);

namespace Doyo\Behat\CodeCoverage\Compiler;

use Doyo\Behat\CodeCoverage\Controller\CliController;
use Doyo\Behat\CodeCoverage\Listener\CoverageListener;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand All @@ -20,6 +28,6 @@ public function process(ContainerBuilder $container)
$listener->addArgument($container->getParameterBag()->get('doyo.coverage_enabled'));
$listener->addTag('event_dispatcher.subscriber');

$container->setDefinition('doyo.coverage.listener',$listener);
$container->setDefinition('doyo.coverage.listener', $listener);
}
}

0 comments on commit 16d10fc

Please sign in to comment.