name: PHP Composer #whenever master has a PR or is pushed to on: push: branches: [ master ] pull_request: branches: [ master ] permissions: contents: read jobs: run: runs-on: ubuntu-20.04 strategy: #for each of the following versions of PHP, with and without --prefer-lowest matrix: php-versions: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] composer-options: ['', '--prefer-lowest'] #set the name for each job name: PHP ${{ matrix.php-versions }} ${{ matrix.composer-options }} #set up environment variables used by unit tests env: AWS_ACCESS_KEY_ID: foo AWS_SECRET_ACCESS_KEY: bar AWS_CSM_ENABLED: false AWS_SUPPRESS_PHP_DEPRECATION_WARNING: true steps: #sets up the correct version of PHP with necessary config options - name: Setup PHP with Xdebug uses: shivammathur/setup-php@v2 with: coverage: xdebug php-version: ${{ matrix.php-versions }} ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false #checkout the codebase from github - name: Checkout codebase uses: actions/checkout@v3 #validate composer files - name: Validate composer.json and composer.lock run: composer validate #remove incompatible xdebug file if it exists - if: ${{ matrix.php-versions == '5.5' }} name: PHP 5.5 run: | sudo rm -f /etc/php5/cli/conf.d/20-xdebug.ini #get dependencies - name: Install dependencies run: composer update ${{ matrix.composer-options }} --no-interaction --prefer-source #php 8.x requirements - if: ${{ matrix.php-versions >= '8.0' && matrix.composer-options != '' }} name: PHP 8.x run: composer require --dev phpunit/phpunit "^9.5" --no-interaction --prefer-source --with-all-dependencies #php 8.1+ requirements - if: ${{ matrix.php-versions >= '8.1' && matrix.composer-options != '' }} name: PHP 8.1+ run: composer require --dev guzzlehttp/guzzle "^7.4.5" --no-interaction --prefer-source --with-all-dependencies #run tests - name: Run test suite run: make test #static analysis - if: ${{ matrix.php-versions >= '7.1' && matrix.php-versions < '8.0' && matrix.composer-options == '' }} name: Static analysis run: | composer require --dev nette/neon "^3.0" composer require --dev phpstan/phpstan "0.12.45" vendor/bin/phpstan analyse src #generate package - if: ${{ matrix.composer-options == '' }} name: Package generation run: | composer require guzzlehttp/psr7 "^1.9.1" composer update make package #generate code coverage - if: ${{ (matrix.php-versions == '7.1' || matrix.php-versions == '8.0') && matrix.composer-options == '' }} name: Code coverage run: bash <(curl -s https://codecov.io/bash)