Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI #167

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 14 additions & 23 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ on:
- pull_request

env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT: "1"

permissions:
contents: read

jobs:
tests:
name: "CI"
Expand All @@ -30,33 +32,22 @@ jobs:
- "8.1"
- "8.2"
- "8.3"
- "8.4"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- 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: "Remove PHPStan as it requires a newer PHP"
run: composer remove phpstan/phpstan --dev --no-update

- name: Cache dependencies
uses: actions/cache@v4
- 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: |
# Remove PHPStan as it requires a newer PHP
composer remove phpstan/phpstan --dev --no-update
composer update ${{ env.COMPOSER_FLAGS }}

- name: "Run tests"
run: "vendor/bin/simple-phpunit --verbose"
dependency-versions: highest

- name: Run tests
run: vendor/bin/simple-phpunit --verbose
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 @@ -15,17 +18,27 @@ jobs:
php-version:
- "5.3"
- "7.4"
- "8.3"
- "nightly"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- 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
29 changes: 8 additions & 21 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 @@ -23,30 +22,18 @@ jobs:
phpunit-version-constraint: "^9.6"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- 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@v4
- 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 require --dev phpunit/phpunit:"${{ matrix.phpunit-version-constraint }}" --with-all-dependencies ${{ env.COMPOSER_FLAGS }}
composer require --dev phpunit/phpunit:"${{ matrix.phpunit-version-constraint }}" --with-all-dependencies -n
vendor/bin/phpstan analyse
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"php": "^5.3.2 || ^7.0 || ^8.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^4.2 || ^5",
"phpstan/phpstan": "^1.4"
"symfony/phpunit-bridge": "^3 || ^7",
"phpstan/phpstan": "^1.11"
},
"autoload": {
"psr-4": {
Expand Down