Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ on:
push:
branches:
- 'master'
schedule:
- cron: '7 */8 * * *'

env:
COLUMNS: 120
Expand All @@ -34,7 +32,7 @@ jobs:
JBZOO_COMPOSER_UPDATE_FLAGS: ${{ matrix.composer_flags }}
strategy:
matrix:
php-version: [ 8.1, 8.2, 8.3 ]
php-version: [ 8.2, 8.3, 8.4 ]
coverage: [ xdebug, none ]
composer_flags: [ "--prefer-lowest", "" ]
steps:
Expand Down Expand Up @@ -65,7 +63,7 @@ jobs:
run: make report-coveralls --no-print-directory || true

- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: PHPUnit - ${{ matrix.php-version }} - ${{ matrix.coverage }}
Expand All @@ -77,7 +75,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 8.1, 8.2, 8.3 ]
php-version: [ 8.2, 8.3, 8.4 ]
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -99,7 +97,7 @@ jobs:
run: make codestyle --no-print-directory

- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: Linters - ${{ matrix.php-version }}
Expand All @@ -111,7 +109,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 8.1, 8.2, 8.3 ]
php-version: [ 8.2, 8.3, 8.4 ]
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -133,7 +131,7 @@ jobs:
run: make report-all --no-print-directory

- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: Reports - ${{ matrix.php-version }}
Expand Down
24 changes: 3 additions & 21 deletions src/PHPUnit/TraitGithubActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@
use function JBZoo\Data\yml;
use function JBZoo\PHPUnit\isSame;

/**
* @phan-file-suppress PhanUndeclaredProperty
*/
trait TraitGithubActions
{
public function testGithubActionsWorkflow(): void
public static function testGithubActionsWorkflow(): void
{
$mailYmlPath = PROJECT_ROOT . '/.github/workflows/main.yml';
$actual = yml($mailYmlPath)->getArrayCopy();
Expand All @@ -42,7 +39,6 @@ public function testGithubActionsWorkflow(): void
'on' => [
'pull_request' => ['branches' => ['*']],
'push' => ['branches' => ['master']],
'schedule' => [['cron' => $this->getScheduleMinute()]],
],

'jobs' => [
Expand Down Expand Up @@ -128,11 +124,6 @@ public function testGithubActionsWorkflow(): void
}
}

protected function getScheduleMinute(): string
{
return self::stringToNumber($this->packageName, 59) . ' */8 * * *';
}

protected static function stepBeforeTests(): ?array
{
return null;
Expand All @@ -159,7 +150,7 @@ protected static function checkoutStep(string $jobName): array

protected static function phpVersions(): array
{
return [8.1, 8.2, 8.3];
return [8.2, 8.3, 8.4];
}

/**
Expand Down Expand Up @@ -200,7 +191,7 @@ protected static function uploadArtifactsStep(string $stepName): array
{
return [
'name' => 'Upload Artifacts',
'uses' => 'actions/upload-artifact@v3',
'uses' => 'actions/upload-artifact@v4',
'continue-on-error' => true,
'with' => ['name' => $stepName, 'path' => 'build/'],
];
Expand All @@ -225,13 +216,4 @@ private static function toYaml(array $data): string
{
return (string)yml(self::normalizeData($data));
}

private static function stringToNumber(string $string, int $maxNumber): int
{
$hash = \md5($string);
$substr = \substr($hash, 0, 8);
$number = \hexdec($substr);

return $number % ($maxNumber + 1);
}
}
4 changes: 2 additions & 2 deletions src/PHPUnit/TraitReadme.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ public function testReadmeHeader(): void
}
}

$expectedBadgeLine = \implode("\n", [
$expectedBadgeLine = \str_replace(" \n", "\n", \implode("\n", [
$this->getTitle(),
'',
\trim(\implode('', \array_filter($expectedBadges))),
'',
'',
]);
]));

isFileContains($expectedBadgeLine, PROJECT_ROOT . '/README.md');
}
Expand Down
Loading