Files
predis/.github/workflows/tests.yml
T
2025-01-14 09:41:14 -08:00

231 lines
6.6 KiB
YAML

name: Tests
on:
push:
branches:
- main
- v2.**
- v3.**
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
predis:
name: PHP ${{ matrix.php }} (Redis ${{ matrix.redis }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- '8.1'
- '8.2'
redis:
- 3
- 4
- 5
- 6
- 7
services:
redis:
image: redis:${{ matrix.redis }}
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
ports:
- 6379:6379
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup PHP with Composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: relay
coverage: ${{ (matrix.php == '8.1' && matrix.redis == '7') && 'xdebug' || 'none' }}
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: highest
composer-options: ${{ matrix.php == '8.0' && '--ignore-platform-reqs' || '' }}
- name: Run tests
if: ${{ matrix.php != '8.1' || matrix.redis != '7' }}
run: vendor/bin/phpunit
- name: Run tests with coverage
if: ${{ matrix.php == '8.1' && matrix.redis == '7' }}
run: vendor/bin/phpunit --coverage-clover build/logs/clover-default.xml --coverage-filter ./src
- name: Run tests using Relay
if: ${{ matrix.redis >= '6' && (matrix.php != '8.1' || matrix.redis != '7')}}
run: vendor/bin/phpunit -c phpunit.relay.xml
- name: Run tests using Relay with coverage
if: ${{ matrix.php == '8.1' && matrix.redis == '7' }}
run: vendor/bin/phpunit -c phpunit.relay.xml --coverage-clover build/logs/clover-relay.xml --coverage-filter ./src
- name: Send coverage to Coveralls
uses: coverallsapp/github-action@v2
if: ${{ matrix.php == '8.1' && matrix.redis == '7' }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
predis-cluster:
name: PHP ${{ matrix.php }} (Redis Cluster latest)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- '8.1'
- '8.2'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run Redis cluster
uses: hoverkraft-tech/compose-action@v2.0.1
with:
compose-file: .github/workflows/cluster/docker-compose.yml
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: relay
coverage: ${{ (matrix.php == '8.1') && 'xdebug' || 'none' }}
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: highest
composer-options: ${{ matrix.php == '8.0' && '--ignore-platform-reqs' || '' }}
- name: Run tests against cluster
run: |
sleep 5 # make sure that docker image is setup
vendor/bin/phpunit --group cluster
- name: Run tests against cluster using Relay
run: |
sleep 5 # make sure nodes are stable and fully joined
vendor/bin/phpunit -c phpunit.relay.xml --group cluster
predis-stack:
name: PHP ${{ matrix.php }} (Redis Stack ${{ matrix.redis }})
needs: predis
runs-on: ubuntu-latest
services:
redis:
image: redis/redis-stack-server:${{ matrix.redis }}
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
ports:
- 6379:6379
strategy:
fail-fast: false
matrix:
php:
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- '8.1'
- '8.2'
redis:
- edge
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP with Composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: relay
- name: Get Composer cache directory
id: composer-cache
run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.directory }}
key: tests-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: tests-php-${{ matrix.php }}-composer
- name: Install Composer dependencies
env:
PHP_VERSION: ${{ matrix.php }}
run: composer install --ansi --no-progress --prefer-dist
- name: Run tests
if: ${{ matrix.php != '8.1' }}
run: vendor/bin/phpunit --group realm-stack
- name: Run tests with coverage
if: ${{ matrix.php == '8.1' }}
run: vendor/bin/phpunit --group realm-stack --coverage-php build/cov/coverage-stack.cov --coverage-filter ./src
- name: Run redis gears tests
if: ${{ matrix.php != '8.1' }}
run: vendor/bin/phpunit --group gears
- name: Run redis gears tests with coverage
if: ${{ matrix.php == '8.1' }}
run: vendor/bin/phpunit --group gears --coverage-php build/cov/coverage-gears.cov --coverage-filter ./src
- name: Run tests using Relay
if: ${{ matrix.php != '8.1' }}
run: vendor/bin/phpunit --group realm-stack -c phpunit.relay.xml
- name: Run tests using Relay with coverage
if: ${{ matrix.php == '8.1' }}
run: vendor/bin/phpunit --group realm-stack --coverage-php build/cov/coverage-relay-stack.cov --coverage-filter ./src -c phpunit.relay.xml
- name: Merge coverage reports
if: ${{ matrix.php == '8.1' }}
run: php vendor/bin/phpcov merge --clover build/logs/clover.xml build/cov
- name: Send coverage to Coveralls
uses: coverallsapp/github-action@v2
if: ${{ matrix.php == '8.1' }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
finish:
name: Finish Coverall
needs: predis-stack
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true