chore(ci): add grpc and opentelemetry PHP extensions in docs workflow #592
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
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| # TODO: Add PHP 8.5 to the matrix once ext-grpc is compatible with it | |
| jobs: | |
| php-cs-fixer: | |
| name: PHP CS Fixer (PHP ${{ matrix.php }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| strategy: | |
| matrix: | |
| php: | |
| - '8.2' | |
| - '8.3' | |
| - '8.4' | |
| fail-fast: false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@fcafdd6392932010c2bd5094439b8e33be2a8a09 # v2.37.0 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: mbstring | |
| 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@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | |
| with: | |
| path: ${{ steps.composercache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-tools-php-cs-fixer-${{ hashFiles('**/composer.json') }} | |
| restore-keys: ${{ runner.os }}-composer-tools-php-cs-fixer | |
| - name: Install PHP CS Fixer dependencies | |
| run: cd tools/php-cs-fixer && composer update --no-interaction --no-progress --ansi | |
| - name: Run PHP-CS-Fixer fix | |
| run: tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run --diff --ansi | |
| phpstan: | |
| name: PHPStan (PHP ${{ matrix.php }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| strategy: | |
| matrix: | |
| php: | |
| - '8.2' | |
| - '8.3' | |
| - '8.4' | |
| fail-fast: false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@fcafdd6392932010c2bd5094439b8e33be2a8a09 # v2.37.0 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: grpc, mbstring, opentelemetry, pdo, pdo_sqlite | |
| coverage: xdebug | |
| - name: Get composer cache directory | |
| id: composercache | |
| run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" | |
| - name: Cache dependencies | |
| uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | |
| with: | |
| path: ${{ steps.composercache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-tools-phpstan-${{ hashFiles('**/composer.json') }} | |
| restore-keys: ${{ runner.os }}-composer-tools-phpstan | |
| - name: Install PHPStan dependencies | |
| run: | | |
| composer update --no-interaction --no-progress --ansi | |
| cd tools/phpstan && composer update --no-interaction --no-progress --ansi | |
| - name: Cache PHPStan results | |
| uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | |
| with: | |
| path: /tmp/phpstan | |
| key: phpstan-php${{ matrix.php }}-${{ github.sha }} | |
| restore-keys: | | |
| phpstan-php${{ matrix.php }}- | |
| phpstan- | |
| continue-on-error: true | |
| - name: Run PHPStan analysis | |
| run: | | |
| tools/phpstan/vendor/bin/phpstan --version | |
| tools/phpstan/vendor/bin/phpstan analyse --no-interaction --no-progress --ansi --error-format=github --memory-limit=256M | |
| phpunit: | |
| name: PHPUnit (PHP ${{ matrix.php }}, ${{ matrix.dependencies }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| strategy: | |
| matrix: | |
| php: | |
| - '8.2' | |
| - '8.3' | |
| - '8.4' | |
| dependencies: | |
| - 'highest' | |
| include: | |
| - php: '8.4' | |
| dependencies: 'highest' | |
| coverage: true | |
| - php: '8.3' | |
| dependencies: 'highest' | |
| coverage: true | |
| - php: '8.2' | |
| dependencies: 'highest' | |
| coverage: true | |
| fail-fast: false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@fcafdd6392932010c2bd5094439b8e33be2a8a09 # v2.37.0 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: grpc, mbstring, opentelemetry, pdo, pdo_sqlite | |
| coverage: xdebug | |
| - name: Get composer cache directory | |
| id: composercache | |
| run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" | |
| - name: Cache dependencies | |
| uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | |
| with: | |
| path: ${{ steps.composercache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }} | |
| restore-keys: ${{ runner.os }}-composer-${{ matrix.dependencies }}- | |
| - name: Update project dependencies | |
| run: composer update --no-interaction --no-progress --ansi ${{ matrix.dependencies == 'lowest' && '--prefer-lowest --prefer-stable' || '' }} | |
| - name: Create database & schema | |
| run: composer test:console -- doctrine:schema:update --force --complete | |
| - name: Run PHPUnit tests | |
| run: vendor/bin/phpunit --log-junit build/logs/phpunit/junit.xml ${{ matrix.coverage && '--coverage-clover build/logs/phpunit/clover.xml' || '' }} | |
| env: | |
| XDEBUG_MODE: coverage | |
| - name: Upload test artifacts | |
| if: always() | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: phpunit-logs-php${{ matrix.php }}-${{ matrix.dependencies }} | |
| path: build/logs/phpunit | |
| - name: Upload coverage results to Codecov | |
| if: matrix.coverage | |
| uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| with: | |
| directory: build/logs/phpunit | |
| name: phpunit-php${{ matrix.php }} | |
| flags: phpunit | |
| fail_ci_if_error: true | |
| continue-on-error: true | |
| - name: Upload coverage results to Coveralls | |
| if: matrix.coverage | |
| env: | |
| COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
| run: | | |
| composer global require --prefer-dist --no-interaction --no-progress --ansi php-coveralls/php-coveralls | |
| export PATH="$PATH:$HOME/.composer/vendor/bin" | |
| php-coveralls --coverage_clover=build/logs/phpunit/clover.xml | |
| continue-on-error: true |