-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b43bd23
Showing
14 changed files
with
964 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# yamllint disable rule:line-length | ||
# yamllint disable rule:braces | ||
|
||
name: Code Analysis | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: Static code analysis with PHP ${{ matrix.php-version }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- "7.4" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
coverage: none | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: vendor | ||
key: composer-${{ matrix.php-version }}-${{ hashFiles('composer.*') }} | ||
restore-keys: | | ||
composer-${{ matrix.php-version }}- | ||
composer- | ||
- name: Install dependencies | ||
run: | | ||
composer install --prefer-dist --no-progress | ||
- name: Run Psalm | ||
run: | | ||
php vendor/bin/psalm --output-format=github --long-progress --php-version=${{ matrix.php-version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# yamllint disable rule:line-length | ||
# yamllint disable rule:braces | ||
|
||
name: Code Style | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: Code style with PHP ${{ matrix.php-version }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- "7.4" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
coverage: none | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: vendor | ||
key: composer-${{ matrix.php-version }}-${{ hashFiles('composer.*') }} | ||
restore-keys: | | ||
composer-${{ matrix.php-version }}- | ||
composer- | ||
- name: Install dependencies | ||
run: | | ||
composer install --prefer-dist --no-progress | ||
- name: Validate composer.json | ||
run: | | ||
composer validate --strict | ||
- name: Normalize composer.json | ||
run: | | ||
composer normalize --dry-run --diff | ||
- name: Restore PHP-CS-Fixer cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: build/cache/.php_cs.cache | ||
key: php-cs-fixer-${{ matrix.php-version }}-${{ hashFiles('composer.*') }} | ||
restore-keys: | | ||
php-cs-fixer-${{ matrix.php-version }}- | ||
php-cs-fixer- | ||
- name: Run PHP-CS-Fixer | ||
run: | | ||
mkdir -p build/cache/ | ||
vendor/bin/php-cs-fixer fix --diff --dry-run --verbose --cache-file=build/cache/.php_cs.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# yamllint disable rule:line-length | ||
# yamllint disable rule:braces | ||
name: Tests | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
tests: | ||
name: Testing with PHP ${{ matrix.php-version }} ${{ matrix.dependencies }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- '7.4' | ||
- '8.0' | ||
- '8.1' | ||
- '8.2' | ||
dependencies: [''] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
coverage: none | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/composer | ||
key: composer-${{ matrix.php-version }}-${{ hashFiles('composer.*') }} | ||
restore-keys: | | ||
composer-${{ matrix.php-version }}- | ||
composer- | ||
- name: Install dependencies | ||
run: | | ||
composer install --prefer-dist --no-interaction --no-progress ${{ matrix.dependencies }} | ||
- name: Execute tests | ||
run: | | ||
php vendor/bin/phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/composer.lock | ||
/vendor | ||
/build | ||
*.cache | ||
.?* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* The TimeKeeper. | ||
* Copyright 2023 Automattic, Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
$header = <<<'EOF' | ||
The TimeKeeper. | ||
Copyright 2023 Automattic, Inc. | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License along | ||
with this program; if not, write to the Free Software Foundation, Inc., | ||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
EOF; | ||
|
||
$config = new PhpCsFixer\Config(); | ||
$config | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'header_comment' => [ | ||
'comment_type' => 'PHPDoc', | ||
'header' => $header, | ||
'separate' => 'bottom', | ||
'location' => 'after_declare_strict', | ||
], | ||
'@PER-CS1.0' => true, | ||
'array_indentation' => true, | ||
'native_function_invocation' => [ | ||
'include' => ['@internal'], | ||
'scope' => 'namespaced', | ||
], | ||
'global_namespace_import' => [ | ||
'import_classes' => true, | ||
'import_constants' => true, | ||
'import_functions' => true, | ||
], | ||
'declare_equal_normalize' => ['space' => 'none'], | ||
'blank_line_after_opening_tag' => false, | ||
'linebreak_after_opening_tag' => false, | ||
]) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->in(__DIR__) | ||
->append([__FILE__]) | ||
) | ||
; | ||
|
||
return $config; |
Oops, something went wrong.