diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index e001692..7869ced 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -4,8 +4,8 @@ on: - push - pull_request -env: - COMPOSER_FLAGS: "--ansi --no-interaction" +permissions: + contents: read jobs: tests: @@ -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 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8a717c8..f23abf1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,8 +1,11 @@ name: "PHP Lint" on: - push: - pull_request: + - push + - pull_request + +permissions: + contents: read jobs: tests: @@ -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 diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index ae682a9..b00ae8d 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -4,8 +4,8 @@ on: - push - pull_request -env: - COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist" +permissions: + contents: read jobs: tests: @@ -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 diff --git a/composer.json b/composer.json index cbbab08..28220c0 100644 --- a/composer.json +++ b/composer.json @@ -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/" }