Skip to content

Commit ab97765

Browse files
authored
GitHub Actions: Use new PHP workflow (#82)
This PR switches to the new PHP workflow, which combines linting, static analysis, and unit testing. `phpcs.xml` file has been removed because the new workflow provides a default config for it and the file did not contain any special configurations anyway. Code style corrections were made to comply with the latest PSR coding standards. In addition, allow GitHub Actions workflow to run for every pull request instead of only main-based pull requests.
2 parents 8fb4c28 + 0e81a09 commit ab97765

5 files changed

Lines changed: 10 additions & 80 deletions

File tree

.github/workflows/php.yml

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,13 @@
1-
name: PHP Tests
1+
name: CI
22

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

1210
jobs:
13-
lint:
14-
name: Static analysis for php ${{ matrix.php }} on ${{ matrix.os }}
15-
runs-on: ${{ matrix.os }}
16-
17-
strategy:
18-
fail-fast: false
19-
matrix:
20-
php: ['8.2', '8.3', '8.4']
21-
os: ['ubuntu-latest']
22-
23-
steps:
24-
- name: Checkout code base
25-
uses: actions/checkout@v4
26-
27-
- name: Setup PHP
28-
uses: shivammathur/setup-php@v2
29-
with:
30-
php-version: ${{ matrix.php }}
31-
tools: phpcs
32-
33-
- name: Setup dependencies
34-
run: composer require -n --no-progress overtrue/phplint
35-
36-
- name: PHP Lint
37-
if: ${{ ! cancelled() }}
38-
run: ./vendor/bin/phplint -n --exclude={^vendor/.*} -- .
39-
40-
- name: PHP CodeSniffer
41-
if: ${{ ! cancelled() }}
42-
run: phpcs
11+
php:
12+
name: PHP
13+
uses: Icinga/github-actions/.github/workflows/php.yml@main

.github/workflows/phpstan.yml

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

.phpcs.xml

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

library/Pdfexport/HeadlessChrome.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ class HeadlessChrome
2727
*
2828
* First matching group is the used port and the second one the browser id.
2929
*/
30-
const DEBUG_ADDR_PATTERN = '/DevTools listening on ws:\/\/((?>\d+\.?){4}:\d+)\/devtools\/browser\/([\w-]+)/';
30+
public const DEBUG_ADDR_PATTERN = '/DevTools listening on ws:\/\/((?>\d+\.?){4}:\d+)\/devtools\/browser\/([\w-]+)/';
3131

3232
/** @var string */
33-
const WAIT_FOR_NETWORK = 'wait-for-network';
33+
public const WAIT_FOR_NETWORK = 'wait-for-network';
3434

3535
/** @var string Javascript Promise to wait for layout initialization */
36-
const WAIT_FOR_LAYOUT = <<<JS
36+
public const WAIT_FOR_LAYOUT = <<<JS
3737
new Promise((fulfill, reject) => {
3838
let timeoutId = setTimeout(() => reject('fail'), 10000);
3939
@@ -519,7 +519,7 @@ private function printToPDF($socket, $browserId, array $parameters)
519519
$parameters,
520520
['transferMode' => 'ReturnAsBase64', 'printBackground' => true]
521521
));
522-
if (isset($result['data']) && !empty($result['data'])) {
522+
if (! empty($result['data'])) {
523523
$pdf = base64_decode($result['data']);
524524
} else {
525525
throw new Exception('Expected base64 data. Got instead: ' . json_encode($result));

library/Pdfexport/PrintableHtmlDocument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class PrintableHtmlDocument extends BaseHtmlElement
1818
{
1919
/** @var string */
20-
const DEFAULT_HEADER_FOOTER_STYLE = <<<'CSS'
20+
public const DEFAULT_HEADER_FOOTER_STYLE = <<<'CSS'
2121
@font-face {
2222
font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
2323
}

0 commit comments

Comments
 (0)