mirror of
https://github.com/predis/predis.git
synced 2026-08-17 22:33:47 +00:00
f4dcf6ce57
* Added testing with 8.4-RC1-pre.2 * Updated CHANGELOG.md
204 lines
7.2 KiB
YAML
204 lines
7.2 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'
|
|
- '8.0'
|
|
- '8.3'
|
|
- '8.4'
|
|
redis:
|
|
- '4.0'
|
|
- '7.2'
|
|
- '7.4'
|
|
- '8.0'
|
|
- '8.2'
|
|
- '8.4'
|
|
|
|
steps:
|
|
|
|
- name: Resolve container name
|
|
run: |
|
|
# Mapping of original redis versions to client test containers
|
|
declare -A redis_clients_version_mapping=(
|
|
["8.4"]="8.4-RC1-pre.2"
|
|
["8.2"]="8.2.2-pre"
|
|
["8.0"]="8.0.2"
|
|
["7.4"]="7.4.2"
|
|
["7.2"]="7.2.7"
|
|
)
|
|
|
|
# Mapping of redis version to stack version
|
|
declare -A redis_stack_version_mapping=(
|
|
["7.4"]="rs-7.4.0-v3"
|
|
["7.2"]="rs-7.2.0-v15"
|
|
)
|
|
|
|
if [[ -v redis_clients_version_mapping[${{ matrix.redis }}] ]]; then
|
|
echo "REDIS_IMAGE_NAME=redislabs/client-libs-test:${redis_clients_version_mapping[${{ matrix.redis }}]}" >> $GITHUB_ENV
|
|
echo "REDIS_STACK_IMAGE_NAME=redislabs/client-libs-test:${redis_stack_version_mapping[${{ matrix.redis }}]}" >> $GITHUB_ENV
|
|
echo "DOCKER_SERVICE=redis-clients" >> $GITHUB_ENV
|
|
|
|
redis_major_version=$(echo "${{ matrix.redis }}" | grep -oP '^\d+')
|
|
|
|
# Some configuration options available since Redis > 7
|
|
if (( redis_major_version < 7 )); then
|
|
echo "REDIS_EXTRA_ARGS="--tls-auth-clients optional --save ''"" >> $GITHUB_ENV
|
|
else
|
|
# Since 8.0 modules are bundled with core
|
|
echo "REDIS_STACK_SERVER_PORT=6379" >> $GITHUB_ENV
|
|
fi
|
|
|
|
else
|
|
echo "REDIS_IMAGE_NAME=redis:${{ matrix.redis }}" >> $GITHUB_ENV
|
|
echo "DOCKER_SERVICE=redis-official" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Start Redis standalone image
|
|
uses: hoverkraft-tech/compose-action@v2.0.1
|
|
with:
|
|
compose-file: .github/docker-compose.yml
|
|
services: ${{ env.DOCKER_SERVICE }}
|
|
|
|
- name: Start Redis unprotected image
|
|
uses: hoverkraft-tech/compose-action@v2.0.1
|
|
if: ${{ matrix.redis > '4.0' }}
|
|
with:
|
|
compose-file: .github/docker-compose.yml
|
|
services: redis-unprotected
|
|
|
|
- name: Start Redis stack image
|
|
id: stack_infra
|
|
uses: hoverkraft-tech/compose-action@v2.0.1
|
|
if: ${{ matrix.redis >= '7.2' && matrix.redis < '8.0' }}
|
|
with:
|
|
compose-file: .github/docker-compose.yml
|
|
services: redis-stack
|
|
|
|
- name: Start Redis cluster image
|
|
id: cluster_infra
|
|
uses: hoverkraft-tech/compose-action@v2.0.1
|
|
if: ${{ matrix.redis > '4.0' }}
|
|
with:
|
|
compose-file: .github/docker-compose.yml
|
|
services: redis-cluster
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php }}
|
|
extensions: relay
|
|
coverage: ${{ (matrix.php == '8.4' && matrix.redis == '8.0') && '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.4' || matrix.redis != '8.0' }}
|
|
run: vendor/bin/phpunit
|
|
|
|
- name: Run tests with coverage
|
|
if: ${{ matrix.php == '8.4' && matrix.redis == '8.0' }}
|
|
run: vendor/bin/phpunit --coverage-php build/cov/coverage-predis.cov --coverage-filter ./src
|
|
|
|
- name: Run tests using Relay
|
|
if: ${{ matrix.php != '8.4' && matrix.redis >= '8.0' }}
|
|
run: vendor/bin/phpunit -c phpunit.relay.xml
|
|
|
|
- name: Run tests using Relay with coverage
|
|
if: ${{ matrix.php == '8.4' && matrix.redis == '8.0' }}
|
|
run: vendor/bin/phpunit -c phpunit.relay.xml --coverage-php build/cov/coverage-relay.cov --coverage-filter ./src
|
|
|
|
- name: Run tests against unprotected Redis
|
|
if: ${{ (matrix.php != '8.4' || matrix.redis != '8.0') && matrix.redis > '4.0'}}
|
|
run: vendor/bin/phpunit --group unprotected
|
|
|
|
- name: Run tests against unprotected Redis with coverage
|
|
if: ${{ matrix.php == '8.4' && matrix.redis == '8.0' }}
|
|
run: vendor/bin/phpunit --group unprotected --coverage-php build/cov/coverage-unprotected.cov --coverage-filter ./src
|
|
|
|
- name: Run stack tests
|
|
if: ${{ (matrix.php != '8.4' || matrix.redis != '8.0') && matrix.redis >= '7.2' }}
|
|
run: vendor/bin/phpunit --group realm-stack
|
|
|
|
- name: Run stack tests with coverage
|
|
if: ${{ matrix.php == '8.4' && matrix.redis == '8.0' }}
|
|
run: vendor/bin/phpunit --group realm-stack --coverage-php build/cov/coverage-stack.cov --coverage-filter ./src
|
|
|
|
- name: Run stack tests using Relay
|
|
if: ${{ (matrix.php != '8.4' || matrix.redis != '8.0') && matrix.redis >= '7.2' }}
|
|
run: vendor/bin/phpunit --group realm-stack -c phpunit.relay.xml
|
|
|
|
- name: Run stack tests using Relay with coverage
|
|
if: ${{ matrix.php == '8.4' && matrix.redis == '8.0' }}
|
|
run: vendor/bin/phpunit --group realm-stack -c phpunit.relay.xml --coverage-php build/cov/coverage-stack-relay.cov --coverage-filter ./src
|
|
|
|
- name: Run tests against cluster
|
|
if: ${{ (matrix.php != '8.4' || matrix.redis != '8.0') && steps.cluster_infra.conclusion == 'success' }}
|
|
run: |
|
|
vendor/bin/phpunit --group cluster
|
|
|
|
- name: Run tests against cluster with coverage
|
|
if: ${{ matrix.php == '8.4' && matrix.redis == '8.0' && steps.cluster_infra.conclusion == 'success' }}
|
|
run: |
|
|
vendor/bin/phpunit --group cluster --coverage-php build/cov/coverage-cluster.cov --coverage-filter ./src
|
|
|
|
- name: Run tests against cluster using Relay
|
|
if: ${{ matrix.php != '8.4' && matrix.redis == '8.0' }}
|
|
run: |
|
|
sleep 5
|
|
vendor/bin/phpunit -c phpunit.relay.xml --group cluster
|
|
|
|
- name: Run tests against cluster using Relay with coverage
|
|
if: ${{ matrix.php == '8.4' && matrix.redis == '8.0' }}
|
|
run: |
|
|
sleep 5
|
|
vendor/bin/phpunit -c phpunit.relay.xml --group cluster --coverage-php build/cov/coverage-cluster-relay.cov --coverage-filter ./src
|
|
|
|
- name: Merge coverage reports
|
|
if: ${{ matrix.php == '8.4' && matrix.redis == '8.0' }}
|
|
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.4' && matrix.redis == '8.0' }}
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
parallel: true
|
|
|
|
finish:
|
|
name: Finish Coverall
|
|
needs: predis
|
|
if: ${{ always() }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Coveralls Finished
|
|
uses: coverallsapp/github-action@v2
|
|
with:
|
|
parallel-finished: true
|