Merge pull request #265 from voku/renovate/shivammathur-setup-php-2.x #397
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| defaults: | |
| run: | |
| shell: bash | |
| permissions: | |
| contents: read | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: [ | |
| 7.2, | |
| 7.3, | |
| 7.4, | |
| 8.0, | |
| 8.1, | |
| 8.2, | |
| 8.3, | |
| 8.4, | |
| 8.5 | |
| ] | |
| composer: [basic] | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@2.37.2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: xdebug | |
| extensions: zip | |
| tools: composer | |
| - name: Determine composer cache directory | |
| id: composer-cache | |
| run: echo "directory=$(composer config cache-dir)" >> "$GITHUB_OUTPUT" | |
| - name: Cache composer dependencies | |
| uses: actions/cache@v6.0.0 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.directory }} | |
| key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ${{ matrix.php }}-composer- | |
| - name: Install dependencies | |
| run: | | |
| if [[ "${{ matrix.composer }}" == "lowest" ]]; then | |
| composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable | |
| elif [[ "${{ matrix.composer }}" == "basic" ]]; then | |
| composer update --prefer-dist --no-interaction | |
| fi; | |
| composer dump-autoload -o | |
| - name: Run tests | |
| run: | | |
| mkdir -p build/logs | |
| php vendor/bin/phpunit -c phpunit.xml --coverage-clover=build/logs/clover.xml | |
| - name: Upload coverage results to Coveralls | |
| continue-on-error: true | |
| env: | |
| COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| composer global require php-coveralls/php-coveralls | |
| php-coveralls --coverage_clover=build/logs/clover.xml -v | |
| - name: Upload coverage results to Codecov | |
| uses: codecov/codecov-action@v7 | |
| with: | |
| files: build/logs/clover.xml | |
| - name: Archive logs artifacts | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: logs_composer-${{ matrix.composer }}_php-${{ matrix.php }} | |
| path: | | |
| build/logs | |
| phpstan: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - phpstan-config: phpstan.neon | |
| label: "8.x" | |
| php: 8.4 | |
| - phpstan-config: phpstan-php7.neon | |
| label: "7.x" | |
| php: 7.4 | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@2.37.2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: none | |
| extensions: zip | |
| tools: composer | |
| - name: Determine composer cache directory | |
| id: composer-cache | |
| run: echo "directory=$(composer config cache-dir)" >> "$GITHUB_OUTPUT" | |
| - name: Cache composer dependencies | |
| uses: actions/cache@v6.0.0 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.directory }} | |
| key: phpstan-composer-${{ hashFiles('**/composer.json') }} | |
| restore-keys: phpstan-composer- | |
| - name: Install runtime dependencies | |
| run: | | |
| composer update --prefer-dist --no-interaction --no-dev | |
| composer dump-autoload -o | |
| - name: Install PHPStan | |
| run: | | |
| composer require --dev --no-interaction phpstan/phpstan:^2.1 phpstan/phpstan-strict-rules:^2.0 | |
| - name: Run PHPStan (PHP ${{ matrix.label }}) | |
| run: | | |
| php vendor/bin/phpstan analyse -c ${{ matrix.phpstan-config }} | |
| infection: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@2.37.2 | |
| with: | |
| php-version: 8.4 | |
| coverage: xdebug | |
| extensions: zip | |
| tools: composer | |
| - name: Determine composer cache directory | |
| id: composer-cache | |
| run: echo "directory=$(composer config cache-dir)" >> "$GITHUB_OUTPUT" | |
| - name: Cache composer dependencies | |
| uses: actions/cache@v6.0.0 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.directory }} | |
| key: infection-composer-${{ hashFiles('**/composer.json') }} | |
| restore-keys: infection-composer- | |
| - name: Install project dependencies | |
| run: | | |
| composer update --prefer-dist --no-interaction | |
| composer dump-autoload -o | |
| - name: Install Infection tooling | |
| run: | | |
| composer config --global --no-plugins allow-plugins.infection/extension-installer false | |
| composer require --dev --no-interaction infection/infection:^0.32.7 phpstan/phpstan:^2.1 phpstan/phpstan-strict-rules:^2.0 | |
| - name: Run Infection function-signature checks | |
| env: | |
| XDEBUG_MODE: coverage | |
| run: | | |
| mkdir -p build/logs | |
| rm -rf /tmp/infection_portable_utf8 | |
| php vendor/bin/infection --configuration=infection.json5 --filter=src/voku/helper/Bootup.php --threads=max --only-covering-test-cases --mutators=@function_signature --min-msi=100 --min-covered-msi=100 --ignore-msi-with-no-mutations | |
| - name: Archive Infection logs | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: logs_infection_php-8.4 | |
| path: | | |
| build/logs |