Skip to content

Commit f978434

Browse files
committed
Upgrade build system
1 parent 9bed2ae commit f978434

File tree

4 files changed

+56
-63
lines changed

4 files changed

+56
-63
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ on:
44
- push
55
- pull_request
66

7-
env:
8-
SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT: "1"
7+
permissions:
8+
contents: read
99

1010
jobs:
1111
tests:
1212
name: "CI"
1313

14-
runs-on: ubuntu-latest
14+
runs-on: ${{ matrix.os }}
1515
continue-on-error: ${{ matrix.experimental }}
1616

1717
strategy:
@@ -24,37 +24,26 @@ jobs:
2424
- "8.1"
2525
- "8.2"
2626
- "8.3"
27+
- "8.4"
2728
experimental: [false]
29+
os: [ubuntu-latest]
2830
include:
29-
- php-version: "8.4"
30-
experimental: true
31+
- php-version: "8.3"
32+
os: windows-latest
3133

3234
steps:
33-
- name: "Checkout"
34-
uses: "actions/checkout@v2"
35+
- uses: actions/checkout@v4
3536

36-
- name: "Install PHP"
37-
uses: "shivammathur/setup-php@v2"
37+
- uses: shivammathur/setup-php@v2
3838
with:
39-
coverage: "none"
4039
php-version: "${{ matrix.php-version }}"
40+
coverage: none
4141

42-
- name: Get composer cache directory
43-
id: composercache
44-
run: "echo \"dir=$(composer config cache-files-dir)\" >> $GITHUB_OUTPUT"
45-
46-
- name: Cache dependencies
47-
uses: actions/cache@v2
42+
- uses: ramsey/composer-install@v3
4843
with:
49-
path: ${{ steps.composercache.outputs.dir }}
50-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
51-
restore-keys: ${{ runner.os }}-composer-
52-
53-
- name: "Install latest dependencies"
54-
run: |
55-
composer update ${{ env.COMPOSER_FLAGS }}
44+
dependency-versions: highest
5645

57-
- name: "Run tests"
46+
- name: Run tests
5847
run: |
5948
vendor/bin/phpunit
6049
vendor/bin/phpunit --testsuite phpstan

.github/workflows/lint.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
- push
55
- pull_request
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
tests:
912
name: "Lint"
@@ -14,17 +17,27 @@ jobs:
1417
matrix:
1518
php-version:
1619
- "7.2"
17-
- "8.3"
20+
- "nightly"
1821

1922
steps:
20-
- name: "Checkout"
21-
uses: "actions/checkout@v2"
23+
- uses: actions/checkout@v4
2224

23-
- name: "Install PHP"
24-
uses: "shivammathur/setup-php@v2"
25+
- uses: shivammathur/setup-php@v2
2526
with:
26-
coverage: "none"
2727
php-version: "${{ matrix.php-version }}"
28+
coverage: none
2829

2930
- name: "Lint PHP files"
30-
run: "find src/ -type f -name '*.php' -print0 | xargs -0 -L1 -P4 -- php -l -f"
31+
run: |
32+
hasErrors=0
33+
for f in $(find src/ tests/ -type f -name '*.php' ! -path '*/vendor/*' ! -path '*/Fixtures/*')
34+
do
35+
{ error="$(php -derror_reporting=-1 -ddisplay_errors=1 -l -f $f 2>&1 1>&3 3>&-)"; } 3>&1;
36+
if [ "$error" != "" ]; then
37+
while IFS= read -r line; do echo "::error file=$f::$line"; done <<< "$error"
38+
hasErrors=1
39+
fi
40+
done
41+
if [ $hasErrors -eq 1 ]; then
42+
exit 1
43+
fi

.github/workflows/phpstan.yml

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ on:
44
- push
55
- pull_request
66

7-
env:
8-
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
9-
SYMFONY_PHPUNIT_VERSION: ""
7+
permissions:
8+
contents: read
109

1110
jobs:
1211
tests:
@@ -21,28 +20,16 @@ jobs:
2120
- "8.3"
2221

2322
steps:
24-
- name: "Checkout"
25-
uses: "actions/checkout@v2"
23+
- uses: actions/checkout@v4
2624

27-
- name: "Install PHP"
28-
uses: "shivammathur/setup-php@v2"
25+
- uses: shivammathur/setup-php@v2
2926
with:
30-
coverage: "none"
3127
php-version: "${{ matrix.php-version }}"
28+
coverage: none
3229

33-
- name: Get composer cache directory
34-
id: composercache
35-
run: "echo \"dir=$(composer config cache-files-dir)\" >> $GITHUB_OUTPUT"
36-
37-
- name: Cache dependencies
38-
uses: actions/cache@v2
30+
- uses: ramsey/composer-install@v3
3931
with:
40-
path: ${{ steps.composercache.outputs.dir }}
41-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
42-
restore-keys: ${{ runner.os }}-composer-
43-
44-
- name: "Install latest dependencies"
45-
run: "composer update ${{ env.COMPOSER_FLAGS }}"
32+
dependency-versions: highest
4633

47-
- name: "Run PHPStan"
48-
run: "composer phpstan"
34+
- name: Run PHPStan
35+
run: composer phpstan

phpunit.xml.dist

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd"
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
53
backupGlobals="false"
4+
backupStaticAttributes="false"
65
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
711
bootstrap="vendor/autoload.php"
12+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
813
defaultTestSuite="pcre"
9-
>
14+
>
1015
<testsuites>
1116
<testsuite name="pcre">
1217
<directory>tests/PregTests</directory>
@@ -16,10 +21,9 @@
1621
<directory>tests/PHPStanTests</directory>
1722
</testsuite>
1823
</testsuites>
19-
20-
<filter>
21-
<whitelist>
22-
<directory>src</directory>
23-
</whitelist>
24-
</filter>
24+
<coverage>
25+
<include>
26+
<directory>./src/</directory>
27+
</include>
28+
</coverage>
2529
</phpunit>

0 commit comments

Comments
 (0)