Improve CI

* Adjust names of tasks.
* Add composer require checker.
* Install without plugins to not use custom installer and stay
  compatible with require checker.
* Stay phpunit 10 compatible.
This commit is contained in:
Daniel Siepmann 2020-04-07 15:04:20 +02:00
parent 60f76b0d9f
commit d3878d928d
8 changed files with 81 additions and 20 deletions

View file

@ -1,22 +1,62 @@
name: CI name: CI
on: [push] on: [push]
jobs: jobs:
build: check-composer:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Validate composer.json and composer.lock - name: Validate composer.json
run: composer validate run: composer validate
check-dependencies:
runs-on: ubuntu-latest
needs: [check-composer]
steps:
- uses: actions/checkout@v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-plugins
- name: Missing composer requirements
run: ./vendor/bin/composer-require-checker
full-check:
runs-on: ubuntu-latest
needs: [check-composer]
steps:
- uses: actions/checkout@v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies - name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest run: composer install --prefer-dist --no-progress --no-suggest
- name: Test CGL - name: Coding Guideline
run: ./vendor/bin/phpcs run: ./vendor/bin/phpcs
- name: Execute PHPStan Code Quality - name: Code Quality (by PHPStan)
run: ./vendor/bin/phpstan analyse run: ./vendor/bin/phpstan analyse
- name: Execute PHPUnit Tests - name: PHPUnit Tests
run: ./vendor/bin/phpunit --testdox run: ./vendor/bin/phpunit --testdox

View file

@ -23,6 +23,7 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Model;
use DanielSiepmann\Tracking\Domain\Model\Pageview; use DanielSiepmann\Tracking\Domain\Model\Pageview;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage; use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
/** /**
@ -30,6 +31,8 @@ use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
*/ */
class PageviewTest extends TestCase class PageviewTest extends TestCase
{ {
use ProphecyTrait;
/** /**
* @test * @test
*/ */

View file

@ -24,6 +24,8 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Pageview;
use DanielSiepmann\Tracking\Domain\Model\Pageview; use DanielSiepmann\Tracking\Domain\Model\Pageview;
use DanielSiepmann\Tracking\Domain\Pageview\Factory; use DanielSiepmann\Tracking\Domain\Pageview\Factory;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophet;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Routing\PageArguments; use TYPO3\CMS\Core\Routing\PageArguments;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage; use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
@ -33,6 +35,8 @@ use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
*/ */
class FactoryTest extends TestCase class FactoryTest extends TestCase
{ {
use ProphecyTrait;
/** /**
* @test * @test
*/ */

View file

@ -24,6 +24,7 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Repository;
use DanielSiepmann\Tracking\Domain\Model\Pageview as Model; use DanielSiepmann\Tracking\Domain\Model\Pageview as Model;
use DanielSiepmann\Tracking\Domain\Repository\Pageview; use DanielSiepmann\Tracking\Domain\Repository\Pageview;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage; use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
@ -32,6 +33,8 @@ use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
*/ */
class PageviewTest extends TestCase class PageviewTest extends TestCase
{ {
use ProphecyTrait;
/** /**
* @test * @test
*/ */

View file

@ -26,6 +26,7 @@ use DanielSiepmann\Tracking\Domain\Repository\Pageview as Repository;
use DanielSiepmann\Tracking\Middleware\Pageview; use DanielSiepmann\Tracking\Middleware\Pageview;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
@ -38,6 +39,8 @@ use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
*/ */
class PageviewTest extends TestCase class PageviewTest extends TestCase
{ {
use ProphecyTrait;
/** /**
* @test * @test
*/ */

View file

@ -33,11 +33,28 @@
"psr/http-server-handler": "^1.0", "psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0", "psr/http-server-middleware": "^1.0",
"symfony/expression-language": "^5.0", "symfony/expression-language": "^5.0",
"typo3/cms-core": "^10.3.0" "typo3/cms-core": "^10.3",
"symfony/console": "^5.0",
"typo3/cms-dashboard": "^10.3"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5",
"phpunit/phpunit": "^9.0",
"phpstan/phpstan": "^0.12.18",
"phpstan/extension-installer": "^1.0",
"jangregor/phpstan-prophecy": "^0.6.2",
"maglnet/composer-require-checker": "^2.1",
"phpspec/prophecy-phpunit": "^2.0"
}, },
"suggest": { "suggest": {
"typo3/cms-dashboard": "To make use of provided TYPO3 widgets" "typo3/cms-dashboard": "To make use of provided TYPO3 widgets"
}, },
"scripts": {
"post-autoload-dump": [
"mkdir -p .Build/web/typo3conf/ext/",
"[ -L .Build/web/typo3conf/ext/tracking ] || ln -snvf ../../../../. .Build/web/typo3conf/ext/tracking"
]
},
"extra": { "extra": {
"typo3/cms": { "typo3/cms": {
"cms-package-dir": "{$vendor-dir}/typo3/cms", "cms-package-dir": "{$vendor-dir}/typo3/cms",
@ -47,19 +64,5 @@
"branch-alias": { "branch-alias": {
"dev-master": "1.0.x-dev" "dev-master": "1.0.x-dev"
} }
},
"scripts": {
"post-autoload-dump": [
"mkdir -p .Build/web/typo3conf/ext/",
"[ -L .Build/web/typo3conf/ext/tracking ] || ln -snvf ../../../../. .Build/web/typo3conf/ext/tracking"
]
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5",
"phpunit/phpunit": "^9.0",
"typo3/cms-dashboard": "^10.3.0",
"phpstan/phpstan": "^0.12.18",
"phpstan/extension-installer": "^1.0",
"jangregor/phpstan-prophecy": "^0.6.2"
} }
} }

View file

@ -13,4 +13,7 @@
<!-- Base rules --> <!-- Base rules -->
<rule ref="PSR12" /> <rule ref="PSR12" />
<rule ref="Generic.Files.LineLength.TooLong">
<exclude-pattern>/Tests/*</exclude-pattern>
</rule>
</ruleset> </ruleset>

View file

@ -39,6 +39,8 @@ Todos
#. Add 100% code coverage (Widgets are missing) #. Add 100% code coverage (Widgets are missing)
#. Add version matrix to test with multiple PHP versions.
#. Add campaigns if possible (twitter parameter, etc.) #. Add campaigns if possible (twitter parameter, etc.)
#. Add referrer if available. #. Add referrer if available.