Skip to content

Commit

Permalink
Update to scaffold 0.12.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
tannguyen04 committed Feb 19, 2024
1 parent 796a9ee commit f9a89eb
Show file tree
Hide file tree
Showing 16 changed files with 248 additions and 187 deletions.
23 changes: 13 additions & 10 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
.gitattributes export-ignore
.gitignore export-ignore
.editorconfig export-ignore
.github export-ignore
tests export-ignore
behat.yml export-ignore
phpcs.xml export-ignore
phpmd.xml export-ignore
phpstan.neon export-ignore
renovate.json export-ignore
# Ignore files for distribution archives.

/.editorconfig export-ignore
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/tests export-ignore
/phpcs.xml export-ignore
/phpmd.xml export-ignore
/phpstan.neon export-ignore
/phpunit.xml export-ignore
/renovate.json export-ignore
/behat.yml export-ignore
9 changes: 3 additions & 6 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
## Checklist before requesting a review

- [ ] I have formatted the subject to include ticket number
as `[PRJ-123] Verb in past tense with dot at the end.`
- [ ] I have formatted the subject to include ticket number as `[#123] Verb in past tense with dot at the end.`
- [ ] I have added a link to the issue tracker
- [ ] I have provided information in `Changed` section about WHY something was
done if this was not a normal implementation
- [ ] I have provided information in `Changed` section about WHY something was done if this was not a normal implementation
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have run new and existing relevant tests locally with my changes, and
they passed
- [ ] I have run new and existing relevant tests locally with my changes, and they passed
- [ ] I have provided screenshots, where applicable

## Changed
Expand Down
8 changes: 5 additions & 3 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name-template: '$NEXT_MINOR_VERSION'
tag-template: '$NEXT_MINOR_VERSION'
name-template: '$RESOLVED_VERSION'
tag-template: '$RESOLVED_VERSION'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
default: minor
template: |
## What's new since $PREVIOUS_TAG
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...$NEXT_MINOR_VERSION
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...$RESOLVED_VERSION
$CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ permissions:
jobs:
assign-author:
runs-on: ubuntu-latest

steps:
- uses: toshimaru/[email protected]
- name: Assign author
uses: toshimaru/[email protected]
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Release
name: Draft release notes

on:
push:
tags:
- '*'
branches:
- main
- master

permissions:
contents: write
Expand All @@ -15,8 +15,11 @@ jobs:
permissions:
contents: write
pull-requests: write

runs-on: ubuntu-latest

steps:
- uses: release-drafter/release-drafter@v6
- name: Draft release notes
uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Test PHP

on:
push:
branches:
- master
pull_request:
branches:
- master
- 'feature/**'

jobs:
test-php:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3']

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

- name: Install dependencies
run: composer install

- name: Check coding standards
run: composer lint

- name: Run tests
run: XDEBUG_MODE=coverage composer test
29 changes: 0 additions & 29 deletions .github/workflows/test.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# To ignore OS temporary files use global .gitignore
# https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files#configuring-ignored-files-for-all-repositories-on-your-computer

vendor
composer.lock
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

[![GitHub Issues](https://img.shields.io/github/issues/drevops/behat-format-progress-fail.svg)](https://github.com/drevops/behat-format-progress-fail/issues)
[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/drevops/behat-format-progress-fail.svg)](https://github.com/drevops/behat-format-progress-fail/pulls)
[![Test](https://github.com/drevops/behat-format-progress-fail/actions/workflows/test.yml/badge.svg)](https://github.com/drevops/behat-format-progress-fail/actions/workflows/test.yml)
[![Test](https://github.com/drevops/behat-format-progress-fail/actions/workflows/test-php.yml/badge.svg)](https://github.com/drevops/behat-format-progress-fail/actions/workflows/test-php.yml)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/drevops/behat-format-progress-fail)
![LICENSE](https://img.shields.io/github/license/drevops/behat-format-progress-fail)
![Renovate](https://img.shields.io/badge/renovate-enabled-green?logo=renovatebot)
Expand Down Expand Up @@ -63,7 +63,7 @@ default:
```bash
composer lint
composer lint:fix
composer lint-fix
```

### Run tests
Expand Down
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"phpmd/phpmd": "^2.14",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^10.0",
"rector/rector": "^1.0.0",
"squizlabs/php_codesniffer": "^3",
"symfony/process": "^6 || ^7.0"
},
Expand All @@ -43,9 +44,13 @@
"lint": [
"phpcs",
"phpmd --exclude vendor . text phpmd.xml",
"phpstan"
"phpstan",
"rector --clear-cache --dry-run"
],
"lint-fix": [
"rector --clear-cache",
"phpcbf"
],
"lint:fix": "phpcbf",
"test": "vendor/bin/behat"
}
}
65 changes: 65 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

/**
* @file
* Rector configuration.
*
* Usage:
* ./vendor/bin/rector process .
*
* @see https://github.com/palantirnet/drupal-rector/blob/main/rector.php
*/

declare(strict_types=1);

use Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector;
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector;
use Rector\CodingStyle\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector;
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\CodingStyle\Rector\PostInc\PostIncDecToPreIncDecRector;
use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector;
use Rector\Set\ValueObject\SetList;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/**',
]);

$rectorConfig->sets([
SetList::PHP_80,
SetList::PHP_81,
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::DEAD_CODE,
SetList::INSTANCEOF,
SetList::TYPE_DECLARATION,
]);

$rectorConfig->skip([
// Rules added by Rector's rule sets.
ArraySpreadInsteadOfArrayMergeRector::class,
CountArrayToEmptyArrayComparisonRector::class,
DisallowedEmptyRuleFixerRector::class,
InlineArrayReturnAssignRector::class,
NewlineAfterStatementRector::class,
NewlineBeforeNewAssignSetRector::class,
PostIncDecToPreIncDecRector::class,
RemoveAlwaysTrueIfConditionRector::class,
SimplifyEmptyCheckOnEmptyArrayRector::class,
// Dependencies.
'*/vendor/*',
'*/node_modules/*',
]);

$rectorConfig->fileExtensions([
'php',
'inc',
]);

$rectorConfig->importNames(TRUE, FALSE);
$rectorConfig->importShortClasses(FALSE);
};
4 changes: 2 additions & 2 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"automerge": true,
"dependencyDashboard": true,
"extends": [
"config:base"
],
"automerge": true
]
}
33 changes: 22 additions & 11 deletions src/DrevOps/BehatFormatProgressFail/FormatExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@

namespace DrevOps\BehatFormatProgressFail;

use Behat\Behat\Output\Node\EventListener\AST\StepListener;
use DrevOps\BehatFormatProgressFail\Printer\PrinterProgressFail;
use Behat\Testwork\Output\NodeEventListeningFormatter;
use Behat\Testwork\Output\Node\EventListener\ChainEventListener;
use Behat\Behat\Output\Node\EventListener\Statistics\StatisticsListener;
use Behat\Behat\Output\Node\EventListener\Statistics\ScenarioStatsListener;
use Behat\Behat\Output\Node\EventListener\Statistics\StepStatsListener;
use Behat\Behat\Output\Node\EventListener\Statistics\HookStatsListener;
use Behat\Testwork\Output\Printer\StreamOutputPrinter;
use Behat\Behat\Output\Printer\ConsoleOutputFactory;
use Behat\Testwork\Exception\ServiceContainer\ExceptionExtension;
use Behat\Testwork\Output\ServiceContainer\OutputExtension;
use Behat\Testwork\ServiceContainer\Extension as ExtensionInterface;
Expand Down Expand Up @@ -76,14 +86,14 @@ public function configure(ArrayNodeDefinition $builder): void
public function load(ContainerBuilder $container, array $config): void
{
$definition = new Definition(
'Behat\Behat\Output\Node\EventListener\AST\StepListener', [
StepListener::class, [
new Reference('output.printer.'.$config['name']),
]
);
$container->setDefinition(self::ROOT_LISTENER_ID, $definition);

$definition = new Definition(
'DrevOps\BehatFormatProgressFail\Printer\PrinterProgressFail', [
PrinterProgressFail::class, [
new Reference(self::RESULT_TO_STRING_CONVERTER_ID),
$config['base_path'],
]
Expand All @@ -93,38 +103,38 @@ public function load(ContainerBuilder $container, array $config): void
);

$definition = new Definition(
'Behat\Testwork\Output\NodeEventListeningFormatter', [
NodeEventListeningFormatter::class, [
$config['name'],
'Prints one character per step and fail view pretty.',
['timer' => true],
$this->createOutputPrinterDefinition(),
new Definition(
'Behat\Testwork\Output\Node\EventListener\ChainEventListener', [
ChainEventListener::class, [
[
new Reference(self::ROOT_LISTENER_ID),
new Definition(
'Behat\Behat\Output\Node\EventListener\Statistics\StatisticsListener', [
StatisticsListener::class, [
new Reference('output.progress.statistics'),
new Reference(
'output.node.printer.progress.statistics'
),
]
),
new Definition(
'Behat\Behat\Output\Node\EventListener\Statistics\ScenarioStatsListener', [
ScenarioStatsListener::class, [
new Reference('output.progress.statistics'),
]
),
new Definition(
'Behat\Behat\Output\Node\EventListener\Statistics\StepStatsListener', [
StepStatsListener::class, [
new Reference('output.progress.statistics'),
new Reference(
ExceptionExtension::PRESENTER_ID
),
]
),
new Definition(
'Behat\Behat\Output\Node\EventListener\Statistics\HookStatsListener', [
HookStatsListener::class, [
new Reference('output.progress.statistics'),
new Reference(
ExceptionExtension::PRESENTER_ID
Expand All @@ -148,13 +158,14 @@ public function load(ContainerBuilder $container, array $config): void
* Creates output printer definition.
*
* @return Definition
* The output printer definition.
*/
protected function createOutputPrinterDefinition()
protected function createOutputPrinterDefinition(): Definition
{
return new Definition(
'Behat\Testwork\Output\Printer\StreamOutputPrinter', [
StreamOutputPrinter::class, [
new Definition(
'Behat\Behat\Output\Printer\ConsoleOutputFactory'
ConsoleOutputFactory::class
),
]
);
Expand Down
Loading

0 comments on commit f9a89eb

Please sign in to comment.