Merge pull request #267 from Icinga/github-lint-tests

Add PHP action workflow
This commit is contained in:
Johannes Meyer 2020-02-26 10:17:43 +01:00 committed by GitHub
commit 27f1c41a42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 9 deletions

47
.github/workflows/php.yml vendored Normal file
View file

@ -0,0 +1,47 @@
name: PHP Tests
on:
push:
branches:
- master
- release/*
pull_request:
branches:
- master
jobs:
lint:
name: Static analysis for php ${{ matrix.php }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
os: ['ubuntu-latest']
include:
- php: '5.6'
allow_failure: true
- php: '7.0'
allow_failure: true
steps:
- name: Checkout code base
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php }}
tools: phpcs
- name: Setup dependencies
run: composer require -n --no-progress overtrue/phplint
- name: PHP Lint
if: success() || matrix.allow_failure
run: ./vendor/bin/phplint -n --exclude={^vendor/.*} -- .
- name: PHP CodeSniffer
if: success() || matrix.allow_failure
run: phpcs

View file

@ -452,7 +452,7 @@ class AddNodeForm extends QuickForm
* @param BpNode $node
* @param BpNode[] $parents
*/
protected function collectAllParents(BpNode $node, array & $parents)
protected function collectAllParents(BpNode $node, array &$parents)
{
foreach ($node->getParents() as $parent) {
$parents[$parent->getName()] = $parent;

View file

@ -375,7 +375,7 @@ class EditNodeForm extends QuickForm
* @param BpNode $node
* @param BpNode[] $parents
*/
protected function collectAllParents(BpNode $node, array & $parents)
protected function collectAllParents(BpNode $node, array &$parents)
{
foreach ($node->getParents() as $parent) {
$parents[$parent->getName()] = $parent;

View file

@ -140,7 +140,7 @@ class LegacyConfigParser
return $metadata;
}
public static function readMetadataFromString($name, & $string)
public static function readMetadataFromString($name, &$string)
{
$metadata = new Metadata($name);
@ -201,7 +201,7 @@ class LegacyConfigParser
* @param $line
* @param BpConfig $bp
*/
protected function parseDisplay(& $line, BpConfig $bp)
protected function parseDisplay(&$line, BpConfig $bp)
{
list($display, $name, $desc) = preg_split('~\s*;\s*~', substr($line, 8), 3);
$bp->getBpNode($name)->setAlias($desc)->setDisplay($display);
@ -214,26 +214,26 @@ class LegacyConfigParser
* @param $line
* @param BpConfig $bp
*/
protected function parseExternalInfo(& $line, BpConfig $bp)
protected function parseExternalInfo(&$line, BpConfig $bp)
{
list($name, $script) = preg_split('~\s*;\s*~', substr($line, 14), 2);
$bp->getBpNode($name)->setInfoCommand($script);
}
protected function parseExtraInfo(& $line, BpConfig $bp)
protected function parseExtraInfo(&$line, BpConfig $bp)
{
// TODO: Not yet
// list($name, $script) = preg_split('~\s*;\s*~', substr($line, 14), 2);
// $this->getNode($name)->setExtraInfo($script);
}
protected function parseInfoUrl(& $line, BpConfig $bp)
protected function parseInfoUrl(&$line, BpConfig $bp)
{
list($name, $url) = preg_split('~\s*;\s*~', substr($line, 9), 2);
$bp->getBpNode($name)->setInfoUrl($url);
}
protected function parseExtraLine(& $line, $typeLength, BpConfig $bp)
protected function parseExtraLine(&$line, $typeLength, BpConfig $bp)
{
$type = substr($line, 0, $typeLength);
if (substr($type, 0, 7) === 'display') {
@ -270,7 +270,7 @@ class LegacyConfigParser
*
* @throws ConfigurationError
*/
protected function parseLine(& $line)
protected function parseLine(&$line)
{
$bp = $this->config;
$line = trim($line);