diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 0434d1c8..0352c3bf 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -4,10 +4,6 @@ on: - push - pull_request -env: - COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist" - SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT: "1" - permissions: contents: read @@ -15,7 +11,8 @@ jobs: tests: name: "CI" - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} strategy: matrix: @@ -25,41 +22,37 @@ jobs: - "7.4" - "8.0" - "8.1" - dependencies: [locked] + - "8.2" + - "8.3" + - "8.4" + dependencies: [highest] + experimental: [false] + os: [ubuntu-latest] include: - php-version: "7.2" dependencies: lowest - - php-version: "8.1" + os: ubuntu-latest + experimental: false + - php-version: "8.3" dependencies: lowest + os: ubuntu-latest + experimental: false + - php-version: "8.3" + dependencies: highest + os: windows-latest + experimental: false 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 }}" - tools: composer:snapshot - - - name: Get composer cache directory - id: composercache - run: "echo \"dir=$(composer config cache-files-dir)\" >> $GITHUB_OUTPUT" + coverage: none - - 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: "Handle lowest dependencies update" - if: "contains(matrix.dependencies, 'lowest')" - run: "echo \"COMPOSER_FLAGS=$COMPOSER_FLAGS --prefer-lowest\" >> $GITHUB_ENV" - - - name: "Install latest dependencies" - run: "composer update ${{ env.COMPOSER_FLAGS }}" + dependency-versions: ${{ matrix.dependencies }} - - name: "Run tests" - run: "vendor/bin/simple-phpunit --verbose" + - name: Run tests + run: composer test diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d3204ae4..f23abf17 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,17 +17,27 @@ jobs: matrix: php-version: - "7.2" - - "latest" + - "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 diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index ce2300b7..ce7db11f 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -4,10 +4,6 @@ on: - push - pull_request -env: - COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist" - SYMFONY_PHPUNIT_VERSION: "" - permissions: contents: read @@ -20,33 +16,20 @@ jobs: strategy: matrix: php-version: - - "8.0" + - "7.2" + - "8.3" 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@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 require --dev phpunit/phpunit:^8.5.18 --with-all-dependencies ${{ env.COMPOSER_FLAGS }} - vendor/bin/phpstan analyse + run: composer phpstan diff --git a/composer.json b/composer.json index 91034848..a0f178ab 100644 --- a/composer.json +++ b/composer.json @@ -105,13 +105,13 @@ "require-dev": { "composer/composer": "^1.10.27 || ^2.7", "composer/semver": "^1.7.2 || ^3.4.0", - "symfony/phpunit-bridge": "^7.1.1", + "phpunit/phpunit": "^8 || ^9", "phpstan/phpstan": "^1.11", "symfony/process": "^5 || ^6 || ^7", "phpstan/phpstan-phpunit": "^1" }, "scripts": { - "test": "@php vendor/bin/simple-phpunit", - "phpstan": "@php vendor/bin/phpstan analyse" + "test": "@php phpunit", + "phpstan": "@php phpstan analyse" } } diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 51554790..2ed1c4e1 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -3,7 +3,7 @@ parameters: paths: - src - tests - excludes_analyse: + excludePaths: - tests/Composer/Installers/Test/PolyfillTestCase.php ignoreErrors: - '~Test::[a-zA-Z0-9]+Provider\(\) return type~'