Skip to content

Commit

Permalink
Update build
Browse files Browse the repository at this point in the history
  • Loading branch information
mabar committed Nov 26, 2019
1 parent a2dc544 commit 790c199
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 43 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
@@ -1,4 +1,5 @@
language: php

php:
- 7.2
- 7.3
Expand All @@ -9,15 +10,15 @@ before_install:
- phpenv config-rm xdebug.ini || return 0 # Turn off XDebug

install:
- travis_retry composer install --no-progress --prefer-dist # Install dependencies
- travis_retry composer install --no-progress --prefer-dist

script:
- make tests # Tests
- make tests

jobs:
include:
- env: title="Lowest Dependencies 7.3"
php: 7.3
- env: title="Lowest Dependencies"
php: 7.2
install:
- travis_retry composer update --no-progress --prefer-dist --prefer-lowest --prefer-stable
script:
Expand Down
24 changes: 13 additions & 11 deletions Makefile
@@ -1,27 +1,29 @@
.PHONY: qa lint cs csf phpstan tests coverage

all:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n\nTargets:\n"}'
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'

vendor: composer.json composer.lock
composer install
# QA

qa: lint phpstan cs
qa: lint phpstan cs ## Check code quality - coding style and static analysis

lint: vendor
lint: ## Check PHP files syntax
vendor/bin/linter src tests

cs: vendor
cs: ## Check PHP files coding style
vendor/bin/codesniffer src tests

csf: vendor
csf: ## Fix PHP files coding style
vendor/bin/codefixer src tests

phpstan: vendor
phpstan: ## Analyse code with PHPStan
vendor/bin/phpstan analyse -l max -c phpstan.neon src

tests: vendor
# Tests

tests: ## Run all tests
vendor/bin/phpunit tests --cache-result-file=tests/tmp/phpunit.cache --colors=always

coverage: vendor
vendor/bin/phpdbg -qrr vendor/bin/phpunit tests --cache-result-file=tests/tmp/phpunit.cache --colors=always -c tests/coverage.xml
coverage: ## Generate code coverage in XML format
phpdbg -qrr vendor/bin/phpunit tests --cache-result-file=tests/tmp/phpunit.cache --colors=always -c tests/coverage.xml
7 changes: 2 additions & 5 deletions composer.json
Expand Up @@ -22,9 +22,8 @@
"doctrine/cache": "^1.8.0"
},
"require-dev": {
"mockery/mockery": "^1.2.2",
"nettrine/cache": "^0.1.0",
"ninjify/qa": "^0.9.0",
"ninjify/qa": "^0.10.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan-deprecation-rules": "^0.11.0",
"phpstan/phpstan-nette": "^0.11.0",
Expand All @@ -39,9 +38,7 @@
},
"autoload-dev": {
"psr-4": {
"Tests\\Cases\\": "tests/cases",
"Tests\\Fixtures\\": "tests/fixtures",
"Tests\\Toolkit\\": "tests/toolkit"
"Tests\\Nettrine\\Annotations\\": "tests"
}
},
"minimum-stability": "dev",
Expand Down
6 changes: 2 additions & 4 deletions ruleset.xml
Expand Up @@ -6,10 +6,8 @@
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
<properties>
<property name="rootNamespaces" type="array" value="
src=>Nettrine\Annotations,
tests/cases=>Tests\Cases,
tests/fixtures=>Tests\Fixtures,
tests/toolkit=>Tests\Toolkit
src => Nettrine\Annotations,
tests => Tests\Nettrine\Annotations,
"/>
</properties>
</rule>
Expand Down
@@ -1,6 +1,6 @@
<?php declare(strict_types = 1);

namespace Tests\Fixtures;
namespace Tests\Nettrine\Annotations\Fixtures;

use Doctrine\Common\Annotations\Annotation;

Expand Down
@@ -1,6 +1,6 @@
<?php declare(strict_types = 1);

namespace Tests\Fixtures;
namespace Tests\Nettrine\Annotations\Fixtures;

/**
* @ignoredAnnotation
Expand Down
@@ -1,6 +1,6 @@
<?php declare(strict_types = 1);

namespace Tests\Toolkit;
namespace Tests\Nettrine\Annotations\Toolkit;

use Nette\DI\Config\Adapters\NeonAdapter;
use Nette\Neon\Neon;
Expand Down
10 changes: 2 additions & 8 deletions tests/toolkit/TestCase.php → tests/Toolkit/TestCase.php
@@ -1,8 +1,7 @@
<?php declare(strict_types = 1);

namespace Tests\Toolkit;
namespace Tests\Nettrine\Annotations\Toolkit;

use Mockery;
use PHPUnit\Framework\TestCase as PHPUnitTestCase;

abstract class TestCase extends PHPUnitTestCase
Expand All @@ -17,13 +16,8 @@ protected function setUp(): void
}

if (!defined('FIXTURES_PATH')) {
define('FIXTURES_PATH', __DIR__ . '/../fixtures');
define('FIXTURES_PATH', __DIR__ . '/../fixturesa');
}
}

protected function tearDown(): void
{
Mockery::close();
}

}
@@ -1,6 +1,6 @@
<?php declare(strict_types = 1);

namespace Tests\Cases\Unit\DI;
namespace Tests\Nettrine\Annotations\Unit\DI;

use Doctrine\Common\Annotations\CachedReader;
use Doctrine\Common\Annotations\Reader;
Expand All @@ -13,8 +13,8 @@
use Nette\InvalidStateException;
use Nettrine\Annotations\DI\AnnotationsExtension;
use Nettrine\Cache\DI\CacheExtension;
use Tests\Toolkit\NeonLoader;
use Tests\Toolkit\TestCase;
use Tests\Nettrine\Annotations\Toolkit\NeonLoader;
use Tests\Nettrine\Annotations\Toolkit\TestCase;

final class AnnotationsExtensionTest extends TestCase
{
Expand Down
@@ -1,17 +1,17 @@
<?php declare(strict_types = 1);

namespace Tests\Cases\Unit\Reader;
namespace Tests\Nettrine\Annotations\Unit\Reader;

use Doctrine\Common\Annotations\Reader;
use Nette\DI\Compiler;
use Nette\DI\Container;
use Nette\DI\ContainerLoader;
use Nettrine\Annotations\DI\AnnotationsExtension;
use ReflectionClass;
use Tests\Fixtures\SampleAnnotation;
use Tests\Fixtures\SampleClass;
use Tests\Toolkit\NeonLoader;
use Tests\Toolkit\TestCase;
use Tests\Nettrine\Annotations\Fixtures\SampleAnnotation;
use Tests\Nettrine\Annotations\Fixtures\SampleClass;
use Tests\Nettrine\Annotations\Toolkit\NeonLoader;
use Tests\Nettrine\Annotations\Toolkit\TestCase;

final class ReaderTest extends TestCase
{
Expand Down

0 comments on commit 790c199

Please sign in to comment.