name: PHP Composer # whenever master has a PR or is pushed to on: push: branches: [master] pull_request: branches: [master] permissions: contents: read jobs: verify-no-models-changes: runs-on: ubuntu-latest name: Check for model changes if: github.event_name == 'pull_request' steps: - name: Checkout codebase uses: actions/checkout@v5 with: fetch-depth: 0 - run: | BASE_REPO="${{ github.event.pull_request.base.repo.clone_url }}" git fetch $BASE_REPO master:master -q CHANGED_FILES=$(git diff --name-only FETCH_HEAD...HEAD -- src/data/) if [ ! -z "$CHANGED_FILES" ]; then echo "Changes detected in the following models:" echo "$CHANGED_FILES" exit 1 fi run: runs-on: ubuntu-latest strategy: # for each of the following versions of PHP, with and without --prefer-lowest matrix: include: - php-versions: '8.1' composer-options: '' - php-versions: '8.1' composer-options: '--prefer-lowest' - php-versions: '8.2' composer-options: '' - php-versions: '8.2' composer-options: '--prefer-lowest' - php-versions: '8.3' composer-options: '' - php-versions: '8.3' composer-options: '--prefer-lowest' - php-versions: '8.4' composer-options: '' # 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@v5 with: fetch-depth: 0 # Added for code coverage # validate composer files - name: Validate composer.json and composer.lock run: composer validate # get dependencies - name: Install dependencies run: composer update ${{ matrix.composer-options }} --no-interaction --prefer-source # php 8.1+ requirements - name: PHP 8.1+ requirements run: composer require --dev phpunit/phpunit "^9.5" guzzlehttp/guzzle "^7.4.5" --no-interaction --prefer-source --with-all-dependencies # run tests - name: Run test suite run: make test # static analysis - name: Static analysis run: | composer require --dev nette/neon "^3.4.4" composer require --dev phpstan/phpstan "2.1.1" vendor/bin/phpstan analyse src # generate package - if: ${{ matrix.composer-options == '' }} name: Package generation run: | composer config platform.php 8.1 composer update make package # generate code coverage - if: ${{ matrix.composer-options == '' }} name: Code Coverage run: bash <(curl -s https://codecov.io/bash)