Skip to content

Commit bf431dc

Browse files
authored
GitHub Actions: Use new PHP workflow (#1251)
This PR switches to the new PHP workflow, which combines linting, static analysis, and unit testing. `phpcs.xml` and `phpunit.xml` have been removed, as the new workflow provides sane defaults for both and the files did not contain any special configurations anyway. In addition, code style corrections were made to comply with the latest PSR coding standards. References to removed PHP files have been cleaned up from the phpstan baseline.
2 parents 0589146 + 01b5312 commit bf431dc

File tree

28 files changed

+89
-357
lines changed

28 files changed

+89
-357
lines changed

.github/workflows/php.yml

Lines changed: 13 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,21 @@
1-
name: PHP Tests
1+
name: CI
22

33
on:
44
push:
55
branches:
66
- main
7-
- release/*
7+
- support/*
88
pull_request:
99

1010
jobs:
11-
lint:
12-
name: Static analysis for php ${{ matrix.php }} on ${{ matrix.os }}
13-
runs-on: ${{ matrix.os }}
14-
15-
strategy:
16-
fail-fast: false
17-
matrix:
18-
php: ['8.2', '8.3', '8.4']
19-
os: ['ubuntu-latest']
20-
21-
steps:
22-
- name: Checkout code base
23-
uses: actions/checkout@v4
24-
25-
- name: Setup PHP
26-
uses: shivammathur/setup-php@v2
27-
with:
28-
php-version: ${{ matrix.php }}
29-
tools: phpcs
30-
31-
- name: Setup dependencies
32-
run: composer require -n --no-progress overtrue/phplint
33-
34-
- name: PHP Lint
35-
if: ${{ ! cancelled() }}
36-
run: ./vendor/bin/phplint -n --exclude={^vendor/.*} -- .
37-
38-
- name: PHP CodeSniffer
39-
if: ${{ ! cancelled() }}
40-
run: phpcs -wps --colors
41-
42-
test:
43-
name: Unit tests with php ${{ matrix.php }} on ${{ matrix.os }}
44-
runs-on: ${{ matrix.os }}
45-
46-
env:
47-
phpunit-version: 8.5
48-
49-
strategy:
50-
fail-fast: false
51-
matrix:
52-
php: ['8.2', '8.3', '8.4']
53-
os: ['ubuntu-latest']
54-
55-
steps:
56-
- name: Checkout code base
57-
uses: actions/checkout@v4
58-
59-
- name: Setup PHP
60-
uses: shivammathur/setup-php@v2
61-
with:
62-
php-version: ${{ matrix.php }}
63-
tools: phpunit:${{ matrix.phpunit-version || env.phpunit-version }}
64-
65-
- name: Setup Icinga Web
66-
run: |
67-
git clone --depth 1 https://github.com/Icinga/icingaweb2.git _icingaweb2
68-
ln -s `pwd` _icingaweb2/modules/icingadb
69-
70-
- name: Setup Libraries
71-
run: |
72-
mkdir _libraries
73-
git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-library.git _libraries/ipl
74-
git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-thirdparty.git _libraries/vendor
75-
76-
- name: PHPUnit
77-
env:
78-
ICINGAWEB_LIBDIR: _libraries
79-
run: phpunit --verbose --bootstrap _icingaweb2/test/php/bootstrap.php
11+
php:
12+
name: PHP
13+
uses: Icinga/github-actions/.github/workflows/php.yml@main
14+
with:
15+
php-extensions: ldap
16+
dependencies: |
17+
{
18+
"./vendor/icingaweb2-modules/x509" : "https://github.com/Icinga/icingaweb2-module-x509.git",
19+
"./vendor/icingaweb2-modules/pdfexport" : "https://github.com/Icinga/icingaweb2-module-pdfexport.git",
20+
"./vendor/icingaweb2-modules/reporting" : "https://github.com/Icinga/icingaweb2-module-reporting.git"
21+
}

.github/workflows/phpstan.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@
44
# Except those related to Git and GitHub
55
!.git*
66
!.github
7-
!.phpcs.xml

.phpcs.xml

Lines changed: 0 additions & 26 deletions
This file was deleted.

application/forms/Command/Object/ToggleObjectFeaturesForm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
class ToggleObjectFeaturesForm extends CommandForm
1818
{
19-
const LEAVE_UNCHANGED = 'noop';
19+
public const LEAVE_UNCHANGED = 'noop';
2020

2121
protected $features;
2222

library/Icingadb/Command/Instance/ToggleInstanceFeatureCommand.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,32 @@ class ToggleInstanceFeatureCommand extends IcingaCommand
1414
/**
1515
* Feature for enabling or disabling active host checks on an Icinga instance
1616
*/
17-
const FEATURE_ACTIVE_HOST_CHECKS = 'active_host_checks_enabled';
17+
public const FEATURE_ACTIVE_HOST_CHECKS = 'active_host_checks_enabled';
1818

1919
/**
2020
* Feature for enabling or disabling active service checks on an Icinga instance
2121
*/
22-
const FEATURE_ACTIVE_SERVICE_CHECKS = 'active_service_checks_enabled';
22+
public const FEATURE_ACTIVE_SERVICE_CHECKS = 'active_service_checks_enabled';
2323

2424
/**
2525
* Feature for enabling or disabling host and service event handlers on an Icinga instance
2626
*/
27-
const FEATURE_EVENT_HANDLERS = 'event_handlers_enabled';
27+
public const FEATURE_EVENT_HANDLERS = 'event_handlers_enabled';
2828

2929
/**
3030
* Feature for enabling or disabling host and service flap detection on an Icinga instance
3131
*/
32-
const FEATURE_FLAP_DETECTION = 'flap_detection_enabled';
32+
public const FEATURE_FLAP_DETECTION = 'flap_detection_enabled';
3333

3434
/**
3535
* Feature for enabling or disabling host and service notifications on an Icinga instance
3636
*/
37-
const FEATURE_NOTIFICATIONS = 'notifications_enabled';
37+
public const FEATURE_NOTIFICATIONS = 'notifications_enabled';
3838

3939
/**
4040
* Feature for enabling or disabling the processing of host and service performance data on an Icinga instance
4141
*/
42-
const FEATURE_PERFORMANCE_DATA = 'process_performance_data';
42+
public const FEATURE_PERFORMANCE_DATA = 'process_performance_data';
4343

4444
/**
4545
* Feature that is to be enabled or disabled

library/Icingadb/Command/Object/ProcessCheckResultCommand.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,32 @@ class ProcessCheckResultCommand extends ObjectsCommand
1212
/**
1313
* Host up
1414
*/
15-
const HOST_UP = 0;
15+
public const HOST_UP = 0;
1616

1717
/**
1818
* Host down
1919
*/
20-
const HOST_DOWN = 1;
20+
public const HOST_DOWN = 1;
2121

2222
/**
2323
* Service ok
2424
*/
25-
const SERVICE_OK = 0;
25+
public const SERVICE_OK = 0;
2626

2727
/**
2828
* Service warning
2929
*/
30-
const SERVICE_WARNING = 1;
30+
public const SERVICE_WARNING = 1;
3131

3232
/**
3333
* Service critical
3434
*/
35-
const SERVICE_CRITICAL = 2;
35+
public const SERVICE_CRITICAL = 2;
3636

3737
/**
3838
* Service unknown
3939
*/
40-
const SERVICE_UNKNOWN = 3;
40+
public const SERVICE_UNKNOWN = 3;
4141

4242
/**
4343
* Status code of the host or service check result

library/Icingadb/Command/Object/ToggleObjectFeatureCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,31 @@ class ToggleObjectFeatureCommand extends ObjectsCommand
1212
/**
1313
* Feature for enabling or disabling active checks of a host or service
1414
*/
15-
const FEATURE_ACTIVE_CHECKS = 'active_checks_enabled';
15+
public const FEATURE_ACTIVE_CHECKS = 'active_checks_enabled';
1616

1717
/**
1818
* Feature for enabling or disabling passive checks of a host or service
1919
*/
20-
const FEATURE_PASSIVE_CHECKS = 'passive_checks_enabled';
20+
public const FEATURE_PASSIVE_CHECKS = 'passive_checks_enabled';
2121

2222
/**
2323
* Feature for enabling or disabling notifications for a host or service
2424
*
2525
* Notifications will be sent out only if notifications are enabled on a program-wide basis as well.
2626
*/
27-
const FEATURE_NOTIFICATIONS = 'notifications_enabled';
27+
public const FEATURE_NOTIFICATIONS = 'notifications_enabled';
2828

2929
/**
3030
* Feature for enabling or disabling event handler for a host or service
3131
*/
32-
const FEATURE_EVENT_HANDLER = 'event_handler_enabled';
32+
public const FEATURE_EVENT_HANDLER = 'event_handler_enabled';
3333

3434
/**
3535
* Feature for enabling or disabling flap detection for a host or service.
3636
*
3737
* In order to enable flap detection flap detection must be enabled on a program-wide basis as well.
3838
*/
39-
const FEATURE_FLAP_DETECTION = 'flapping_enabled';
39+
public const FEATURE_FLAP_DETECTION = 'flapping_enabled';
4040

4141
/**
4242
* Feature that is to be enabled or disabled

library/Icingadb/Command/Transport/ApiCommandTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ApiCommandTransport implements CommandTransportInterface
2525
/**
2626
* Transport identifier
2727
*/
28-
const TRANSPORT = 'api';
28+
public const TRANSPORT = 'api';
2929

3030
/**
3131
* API host

library/Icingadb/Common/HostStates.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
*/
1010
class HostStates
1111
{
12-
const UP = 0;
12+
public const UP = 0;
1313

14-
const DOWN = 1;
14+
public const DOWN = 1;
1515

16-
const PENDING = 99;
16+
public const PENDING = 99;
1717

1818
/**
1919
* Get the integer value of the given textual host state

0 commit comments

Comments
 (0)