Skip to content

Commit

Permalink
versioning workarounds in pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
remorhaz committed Nov 10, 2023
1 parent 1eab991 commit 000e4ad
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 22 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,17 @@ jobs:
${{ matrix.composer-options }}

- name: Run tests
if: ${{ matrix.os != 'windows-latest' }}
if: ${{ matrix.os != 'windows-latest' && !contains(matrix.composer-options, '--prefer-lowest') }}
run: composer test

- name: Run tests (lowest)
if: ${{ matrix.os != 'windows-latest' && contains(matrix.composer-options, '--prefer-lowest') }}
run: composer test-lowest

- name: Run tests (windows)
if: ${{ matrix.os == 'windows-latest' }}
if: ${{ matrix.os == 'windows-latest' && !contains(matrix.composer-options, '--prefer-lowest') }}
run: composer test-windows

- name: Run tests (windows-lowest)
if: ${{ matrix.os == 'windows-latest' && contains(matrix.composer-options, '--prefer-lowest') }}
run: composer test-windows-lowest
23 changes: 23 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,52 @@
"scripts": {
"test-cs": "vendor/bin/phpcs -sp",
"test-unit": "vendor/bin/phpunit --coverage-text",
"test-unit-lowest": "vendor/bin/phpunit --configuration=phpunit.10.0.xml --coverage-text",
"clear-allure-results": "rm -rf ./build/allure-results",
"test-report": [
"@clear-allure-results",
"vendor/bin/paratest --processes=3 --configuration=phpunit.report.xml --testsuite=positive",
"vendor/bin/paratest --processes=3 --configuration=phpunit.report.xml --testsuite=negative; exit 0"
],
"test-report-lowest": [
"@clear-allure-results",
"vendor/bin/paratest --processes=3 --configuration=phpunit.10.0.report.xml --testsuite=positive",
"vendor/bin/paratest --processes=3 --configuration=phpunit.10.0.report.xml --testsuite=negative; exit 0"
],
"test-report-windows": [
"@clear-allure-results",
"vendor/bin/paratest --processes=3 --configuration=phpunit.report.xml --testsuite=positive",
"vendor/bin/paratest --processes=3 --configuration=phpunit.report.xml --testsuite=negative & exit 0"
],
"test-report-windows-lowest": [
"@clear-allure-results",
"vendor/bin/paratest --processes=3 --configuration=phpunit.10.0.report.xml --testsuite=positive",
"vendor/bin/paratest --processes=3 --configuration=phpunit.10.0.report.xml --testsuite=negative & exit 0"
],
"test-psalm": "vendor/bin/psalm --shepherd",
"test": [
"@test-cs",
"@test-unit",
"@test-report",
"@test-psalm"
],
"test-lowest": [
"@test-cs",
"@test-unit-lowest",
"@test-report-lowest",
"@test-psalm"
],
"test-windows": [
"@test-cs",
"@test-unit",
"@test-report-windows",
"@test-psalm"
],
"test-windows-lowest": [
"@test-cs",
"@test-unit-lowest",
"@test-report-windows-lowest",
"@test-psalm"
]
}
}
25 changes: 25 additions & 0 deletions phpunit.10.0.report.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
colors="true"
displayDetailsOnIncompleteTests="true"
displayDetailsOnSkippedTests="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerErrors="true"
defaultTestSuite="positive">
<testsuites>
<testsuite name="positive">
<directory>test/report/Generate</directory>
<exclude>test/report/Generate/NegativeTest.php</exclude>
</testsuite>
<testsuite name="negative">
<file>test/report/Generate/NegativeTest.php</file>
</testsuite>
</testsuites>
<extensions>
<bootstrap class="Qameta\Allure\PHPUnit\AllureExtension" />
</extensions>
</phpunit>
23 changes: 23 additions & 0 deletions phpunit.10.0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
colors="true"
displayDetailsOnIncompleteTests="true"
displayDetailsOnSkippedTests="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerErrors="true"
defaultTestSuite="unit">
<testsuites>
<testsuite name="unit">
<directory>test/unit/</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
</phpunit>
8 changes: 7 additions & 1 deletion phpunit.report.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
colors="true"
displayDetailsOnIncompleteTests="true"
displayDetailsOnSkippedTests="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerErrors="true"
defaultTestSuite="positive">
<testsuites>
<testsuite name="positive">
Expand Down
17 changes: 13 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
colors="true"
displayDetailsOnIncompleteTests="true"
displayDetailsOnSkippedTests="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerErrors="true"
defaultTestSuite="unit">
<testsuites>
<testsuite name="unit">
<directory>test/unit/</directory>
</testsuite>
</testsuites>
<coverage>
<source>
<include>
<directory suffix=".php">src/</directory>
<directory>src/</directory>
</include>
</coverage>
<exclude>
<directory>vendor/</directory>
</exclude>
</source>
</phpunit>
22 changes: 7 additions & 15 deletions test/report/Generate/NegativeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@

namespace Qameta\Allure\PHPUnit\Test\Report\Generate;

use PHPUnit\Event;
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
use PHPUnit\Framework\TestCase;
use Qameta\Allure\Allure;
use Qameta\Allure\Attribute\DisplayName;
use Qameta\Allure\PHPUnit\ExceptionDetailsTrait;
use RuntimeException;

use function trigger_error;

use const E_USER_WARNING;

class NegativeTest extends TestCase
{
use ExceptionDetailsTrait;
Expand Down Expand Up @@ -51,22 +55,10 @@ function () {
);
}

#[DisplayName('Test that emits warning is reported as broken')]
#[DisplayName('Test that emits warning is reported as broken'), DoesNotPerformAssertions]
public function testWarning(): void
{
/**
* @psalm-suppress InternalMethod
* @psalm-suppress InternalClass
* @psalm-suppress TooManyArguments
*/
Event\Facade::emitter()->testTriggeredWarning(
$this->valueObjectForEvents(),
"Test triggered warning",
__FILE__,
__LINE__,
false,
);
self::assertTrue(true);
trigger_error('"Test triggered warning"', E_USER_WARNING);
}

#[DisplayName('Skipped test is reported as skipped')]
Expand Down
1 change: 1 addition & 0 deletions test/unit/Event/EventTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ protected function createTestWarningTriggeredEvent(
'file',
1,
false,
false,
);
}
}

0 comments on commit 000e4ad

Please sign in to comment.