Skip to content

Commit

Permalink
Merge pull request #11 from Icinga/add-lint-and-style-tests
Browse files Browse the repository at this point in the history
Add php action workflow
  • Loading branch information
nilmerg authored Apr 8, 2021
2 parents b9eedec + 3292e0b commit 8ec504e
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 2 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -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', '8.0']
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@v2
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
27 changes: 27 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<ruleset name="PHP_CodeSniffer">
<description>Sniff our code a while</description>

<file>./</file>

<exclude-pattern>vendor/*</exclude-pattern>

<arg value="wps"/>
<arg name="report-width" value="auto"/>
<arg name="report-full"/>
<arg name="report-gitblame"/>
<arg name="report-summary"/>
<arg name="encoding" value="UTF-8"/>
<arg name="extensions" value="php"/>

<rule ref="PSR12">
<exclude name="PSR12.Properties.ConstantVisibility.NotFound"/>
</rule>

<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="120"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
</rule>
</ruleset>
1 change: 1 addition & 0 deletions application/controllers/ConfigController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/* Icinga Web 2 | (c) 2018 Icinga Development Team | GPLv2+ */

namespace Icinga\Module\Audit\Controllers;
Expand Down
1 change: 1 addition & 0 deletions application/controllers/LogController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/* Icinga Web 2 | (c) 2018 Icinga Development Team | GPLv2+ */

namespace Icinga\Module\Audit\Controllers;
Expand Down
1 change: 1 addition & 0 deletions application/forms/Config/AuditLogConfigForm.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/* Icinga Web 2 | (c) 2018 Icinga Development Team | GPLv2+ */

namespace Icinga\Module\Audit\Forms\Config;
Expand Down
1 change: 1 addition & 0 deletions configuration.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/* Icinga Web 2 | (c) 2018 Icinga Development Team | GPLv2+ */

/** @var $this \Icinga\Application\Modules\Module */
Expand Down
4 changes: 2 additions & 2 deletions library/Audit/ProvidedHook/AuditLog.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/* Icinga Web 2 | (c) 2018 Icinga Development Team | GPLv2+ */

namespace Icinga\Module\Audit\ProvidedHook;
Expand Down Expand Up @@ -39,8 +40,7 @@ public function logMessage($time, $identity, $type, $message, array $data = null
*/
protected function resolveSyslogFacility($name)
{
switch ($name)
{
switch ($name) {
case 'auth':
return LOG_AUTH;
case 'authpriv':
Expand Down
1 change: 1 addition & 0 deletions library/Audit/ProvidedHook/AuditStream.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/* Icinga Web 2 | (c) 2018 Icinga Development Team | GPLv2+ */

namespace Icinga\Module\Audit\ProvidedHook;
Expand Down
1 change: 1 addition & 0 deletions run.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/* Icinga Web 2 | (c) 2018 Icinga Development Team | GPLv2+ */

/** @var $this \Icinga\Application\Modules\Module */
Expand Down

0 comments on commit 8ec504e

Please sign in to comment.