Skip to content

Commit

Permalink
Upgrade build system
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Aug 23, 2024
1 parent 9bed2ae commit f978434
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 63 deletions.
37 changes: 13 additions & 24 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on:
- push
- pull_request

env:
SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT: "1"
permissions:
contents: read

jobs:
tests:
name: "CI"

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}

strategy:
Expand All @@ -24,37 +24,26 @@ jobs:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
experimental: [false]
os: [ubuntu-latest]
include:
- php-version: "8.4"
experimental: true
- php-version: "8.3"
os: windows-latest

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
- uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
coverage: none

- name: Get composer cache directory
id: composercache
run: "echo \"dir=$(composer config cache-files-dir)\" >> $GITHUB_OUTPUT"

- name: Cache dependencies
uses: actions/cache@v2
- uses: ramsey/composer-install@v3
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: "Install latest dependencies"
run: |
composer update ${{ env.COMPOSER_FLAGS }}
dependency-versions: highest

- name: "Run tests"
- name: Run tests
run: |
vendor/bin/phpunit
vendor/bin/phpunit --testsuite phpstan
27 changes: 20 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
- push
- pull_request

permissions:
contents: read

jobs:
tests:
name: "Lint"
Expand All @@ -14,17 +17,27 @@ jobs:
matrix:
php-version:
- "7.2"
- "8.3"
- "nightly"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
- uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
coverage: none

- name: "Lint PHP files"
run: "find src/ -type f -name '*.php' -print0 | xargs -0 -L1 -P4 -- php -l -f"
run: |
hasErrors=0
for f in $(find src/ tests/ -type f -name '*.php' ! -path '*/vendor/*' ! -path '*/Fixtures/*')
do
{ error="$(php -derror_reporting=-1 -ddisplay_errors=1 -l -f $f 2>&1 1>&3 3>&-)"; } 3>&1;
if [ "$error" != "" ]; then
while IFS= read -r line; do echo "::error file=$f::$line"; done <<< "$error"
hasErrors=1
fi
done
if [ $hasErrors -eq 1 ]; then
exit 1
fi
31 changes: 9 additions & 22 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ on:
- push
- pull_request

env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
SYMFONY_PHPUNIT_VERSION: ""
permissions:
contents: read

jobs:
tests:
Expand All @@ -21,28 +20,16 @@ jobs:
- "8.3"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
- uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
coverage: none

- name: Get composer cache directory
id: composercache
run: "echo \"dir=$(composer config cache-files-dir)\" >> $GITHUB_OUTPUT"

- name: Cache dependencies
uses: actions/cache@v2
- uses: ramsey/composer-install@v3
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: "Install latest dependencies"
run: "composer update ${{ env.COMPOSER_FLAGS }}"
dependency-versions: highest

- name: "Run PHPStan"
run: "composer phpstan"
- name: Run PHPStan
run: composer phpstan
24 changes: 14 additions & 10 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="vendor/autoload.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
defaultTestSuite="pcre"
>
>
<testsuites>
<testsuite name="pcre">
<directory>tests/PregTests</directory>
Expand All @@ -16,10 +21,9 @@
<directory>tests/PHPStanTests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>src</directory>
</whitelist>
</filter>
<coverage>
<include>
<directory>./src/</directory>
</include>
</coverage>
</phpunit>

0 comments on commit f978434

Please sign in to comment.