forked from christian-putzke/freshrss-pocket-button
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add PHPStan and automated tests to CI
- Loading branch information
Showing
7 changed files
with
318 additions
and
6 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,12 @@ | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
- package-ecosystem: "composer" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" |
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,52 @@ | ||
name: Automated tests | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
|
||
tests: | ||
# https://github.com/actions/virtual-environments | ||
runs-on: ubuntu-22.04 | ||
defaults: | ||
run: | ||
working-directory: ./Extensions | ||
|
||
steps: | ||
- name: Git checkout source code | ||
uses: actions/checkout@v4 | ||
with: | ||
path: Extensions | ||
|
||
# Composer tests | ||
|
||
- name: Check PHP syntax | ||
run: composer run-script php-lint | ||
|
||
- name: Check PHTML syntax | ||
run: composer run-script phtml-lint | ||
|
||
- name: Use Composer cache | ||
id: composer-cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: Extensions/vendor | ||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-php- | ||
- name: Run Composer install | ||
run: composer install --prefer-dist --no-progress | ||
if: steps.composer-cache.outputs.cache-hit != 'true' | ||
|
||
- name: Git checkout FreshRSS source code | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: FreshRSS/FreshRSS | ||
path: FreshRSS | ||
|
||
- name: PHPStan | ||
run: composer run-script phpstan |
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
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,55 @@ | ||
{ | ||
"description": "Extension for FreshRSS", | ||
"type": "project", | ||
"require": { | ||
"php": ">=8.1", | ||
"ext-ctype": "*", | ||
"ext-curl": "*", | ||
"ext-dom": "*", | ||
"ext-fileinfo": "*", | ||
"ext-gmp": "*", | ||
"ext-intl": "*", | ||
"ext-json": "*", | ||
"ext-libxml": "*", | ||
"ext-mbstring": "*", | ||
"ext-openssl": "*", | ||
"ext-pcre": "*", | ||
"ext-pdo": "*", | ||
"ext-pdo_sqlite": "*", | ||
"ext-session": "*", | ||
"ext-simplexml": "*", | ||
"ext-xml": "*", | ||
"ext-xmlreader": "*", | ||
"ext-zend-opcache": "*", | ||
"ext-zip": "*", | ||
"ext-zlib": "*" | ||
}, | ||
"suggest": { | ||
"ext-iconv": "*", | ||
"ext-pdo_mysql": "*", | ||
"ext-pdo_pgsql": "*" | ||
}, | ||
"require-dev": { | ||
"php": ">=8.1", | ||
"ext-phar": "*", | ||
"ext-tokenizer": "*", | ||
"ext-xmlwriter": "*", | ||
"phpstan/phpstan": "^1.11", | ||
"phpstan/phpstan-strict-rules": "^1.6" | ||
}, | ||
"scripts": { | ||
"php-lint": "find . -type d -name 'vendor' -prune -o -name '*.php' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null", | ||
"phtml-lint": "find . -type d -name 'vendor' -prune -o -name '*.phtml' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null", | ||
"phpstan": "phpstan analyse --memory-limit 512M .", | ||
"test": [ | ||
"@php-lint", | ||
"@phtml-lint", | ||
"@phpstan" | ||
] | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"phpstan/extension-installer": false | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,44 @@ | ||
parameters: | ||
level: 6 # TODO: Increase to 9 | ||
fileExtensions: | ||
- php | ||
- phtml | ||
paths: | ||
- ../FreshRSS | ||
- . | ||
excludePaths: | ||
analyse: | ||
- ../FreshRSS | ||
- vendor/ | ||
- fresh_rss_data/ | ||
analyseAndScan: | ||
- .github/ | ||
- .vscode/ | ||
- .git/ | ||
- node_modules/ | ||
checkMissingOverrideMethodAttribute: true | ||
reportMaybesInPropertyPhpDocTypes: false | ||
treatPhpDocTypesAsCertain: false | ||
strictRules: | ||
allRules: false | ||
booleansInConditions: true | ||
closureUsesThis: true | ||
disallowedConstructs: false | ||
disallowedLooseComparison: false | ||
matchingInheritedMethodNames: true | ||
noVariableVariables: true | ||
numericOperandsInArithmeticOperators: true | ||
overwriteVariablesWithLoop: true | ||
requireParentConstructorCall: true | ||
strictCalls: true | ||
switchConditionsMatchingType: true | ||
uselessCast: true | ||
exceptions: | ||
check: | ||
missingCheckedExceptionInThrows: false # TODO pass | ||
tooWideThrowType: true | ||
implicitThrows: false | ||
checkedExceptionClasses: | ||
- 'Minz_Exception' | ||
includes: | ||
- vendor/phpstan/phpstan-strict-rules/rules.neon |