Skip to content

Commit

Permalink
Upgrade CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Aug 23, 2024
1 parent 61b55b6 commit 4773a07
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 61 deletions.
43 changes: 17 additions & 26 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
- push
- pull_request

env:
COMPOSER_FLAGS: "--ansi --no-interaction"
permissions:
contents: read

jobs:
tests:
Expand All @@ -15,42 +15,33 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest]
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
os: [ubuntu-latest]
include:
- os: windows-latest
php-version: "7.4"
- os: windows-latest
php-version: "8.1"
- php-version: "7.4"
os: windows-latest
- 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"
run: "php vendor/bin/phpunit"
- name: Run tests
run: composer test
31 changes: 22 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: "PHP Lint"

on:
push:
pull_request:
- push
- pull_request

permissions:
contents: read

jobs:
tests:
Expand All @@ -14,17 +17,27 @@ jobs:
matrix:
php-version:
- "7.2"
- "8.1"
- "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
29 changes: 9 additions & 20 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
- push
- pull_request

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

jobs:
tests:
Expand All @@ -16,31 +16,20 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "7.4"
- "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
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
"php": ">=7.2.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5.20 || ^8.5.23",
"psr/log": "^1 || ^2 || ^3",
"phpstan/phpstan": "^1",
"phpstan/phpstan-phpunit": "^1",
"phpstan/phpstan-strict-rules": "^1.3",
"phpstan/phpstan-deprecation-rules": "^1.0"
"phpunit/phpunit": "^8.5.39",
"psr/log": "^1.1.4 || ^2 || ^3",
"phpstan/phpstan": "^1.11.11",
"phpstan/phpstan-phpunit": "^1.4",
"phpstan/phpstan-strict-rules": "^1.6",
"phpstan/phpstan-deprecation-rules": "^1.2"
},
"autoload": {
"psr-4": { "Seld\\Signal\\": "src/" }
Expand Down

0 comments on commit 4773a07

Please sign in to comment.