Update actions/checkout action to v4 #38
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: "Continuous Integration" | |
on: | |
- push | |
- pull_request | |
env: | |
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist" | |
jobs: | |
tests: | |
name: "CI" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-version: | |
- "7.2" | |
- "7.3" | |
- "7.4" | |
- "8.0" | |
# disabled for now as phpspec/prophecy does not allow 8.1 | |
# - "8.1" | |
dependencies: [highest] | |
include: | |
- php-version: "7.2" | |
dependencies: lowest | |
- php-version: "8.0" | |
dependencies: lowest | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- name: "Install PHP" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
extensions: mongodb, redis, amqp | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Add require for mongodb/mongodb to make tests runnable | |
run: 'composer require ${{ env.COMPOSER_FLAGS }} mongodb/mongodb --dev --no-update' | |
- name: "Handle lowest dependencies update" | |
if: "contains(matrix.dependencies, 'lowest')" | |
run: "echo \"COMPOSER_FLAGS=$COMPOSER_FLAGS --prefer-lowest\" >> $GITHUB_ENV" | |
- name: "Install latest dependencies" | |
run: | | |
composer update ${{ env.COMPOSER_FLAGS }} | |
- name: "Run tests" | |
run: "composer exec phpunit -- --verbose" | |
- name: "Run tests with psr/log 3" | |
if: "contains(matrix.dependencies, 'highest') && matrix.php-version >= '8.0'" | |
run: | | |
composer remove --no-update --dev graylog2/gelf-php ruflin/elastica elasticsearch/elasticsearch rollbar/rollbar | |
composer require --no-update psr/log:^3 | |
composer update -W ${{ env.COMPOSER_FLAGS }} | |
composer exec phpunit -- --verbose |