chore: add php cs fixer from shared workflow (#7647) #29
This file contains 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: Test Suite | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
test: | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, windows-latest] | |
php: [ "8.0", "8.1", "8.2", "8.3", "8.4" ] | |
extensions: ["grpc-1.54.0"] | |
type: ["Unit Test"] | |
include: | |
- platform: "ubuntu-latest" | |
php: "8.0" | |
extensions: "protobuf,grpc-1.54.0" | |
type: "Unit Test + protobuf extension" | |
name: PHP ${{ matrix.php }} ${{ matrix.type }} (${{ matrix.platform }}) | |
runs-on: ${{ matrix.platform }} | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup cache environment | |
id: extcache | |
uses: shivammathur/cache-extensions@v1 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: sodium,${{ matrix.extensions }} | |
key: cache-key-1 # increment to bust the cache | |
- name: Cache extensions | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.extcache.outputs.dir }} | |
key: ${{ steps.extcache.outputs.key }} | |
restore-keys: ${{ steps.extcache.outputs.key }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@verbose | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: sodium,${{ matrix.extensions }} | |
- name: Install Dependencies | |
uses: nick-invision/retry@v3 | |
with: | |
timeout_minutes: 10 | |
max_attempts: 3 | |
command: composer --no-interaction --no-ansi --no-progress update | |
- if: ${{ matrix.platform == 'windows-latest' }} | |
name: Run Unit Test Suite (Windows) | |
run: | | |
vendor/bin/phpunit -c phpunit.xml.dist | |
if ( "$?" -ne "0" ) | |
{ | |
echo "*** RETRYING FLAKEY PHPUNIT ON WINDOWS ***" | |
vendor/bin/phpunit -c phpunit.xml.dist | |
} | |
- if: ${{ matrix.platform != 'windows-latest' }} | |
name: Run Unit Test Suite | |
run: | | |
vendor/bin/phpunit -c phpunit.xml.dist | |
- if: ${{ matrix.platform != 'windows-latest' }} | |
name: Run Snippet Test Suite | |
run: | | |
vendor/bin/phpunit -c phpunit-snippets.xml.dist --verbose | |
test_packages: | |
name: Package Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@verbose | |
with: | |
php-version: '8.1' | |
extensions: grpc | |
- name: Run Package Test Suites | |
run: bash .github/run-package-tests.sh | |
test_packages_lowest: | |
name: Package Tests (Lowest Dependencies) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@verbose | |
with: | |
php-version: '8.1' | |
extensions: grpc | |
- name: Run Package Test Suites | |
env: | |
PREFER_LOWEST: ${{ github.event.pull_request.user.login == 'release-please[bot]' && '--prefer-lowest-strict' || '--prefer-lowest' }} | |
run: bash .github/run-package-tests.sh $PREFER_LOWEST | |
test_dev_commands: | |
name: Dev Commands Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@verbose | |
with: | |
php-version: "8.1" | |
- name: "Install dependencies" | |
run: composer --no-interaction --no-ansi --no-progress update -d dev | |
- name: Run Dev Unit Test Suite | |
run: dev/vendor/bin/phpunit -c dev/phpunit.xml.dist |