|
| 1 | +name: Redis and Redis Cluster |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - '*.x' |
| 8 | + pull_request: |
| 9 | + |
| 10 | +jobs: |
| 11 | + redis: |
| 12 | + runs-on: ubuntu-24.04 |
| 13 | + |
| 14 | + services: |
| 15 | + redis: |
| 16 | + image: redis:7.0 |
| 17 | + ports: |
| 18 | + - 6379:6379 |
| 19 | + options: --entrypoint redis-server |
| 20 | + |
| 21 | + strategy: |
| 22 | + fail-fast: true |
| 23 | + matrix: |
| 24 | + client: ['phpredis', 'predis'] |
| 25 | + |
| 26 | + name: Redis (${{ matrix.client}}) Driver |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout code |
| 30 | + uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Setup PHP |
| 33 | + uses: shivammathur/setup-php@v2 |
| 34 | + with: |
| 35 | + php-version: 8.2 |
| 36 | + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, :php-psr |
| 37 | + tools: composer:v2 |
| 38 | + coverage: none |
| 39 | + |
| 40 | + - name: Set Framework version |
| 41 | + run: composer config version "12.x-dev" |
| 42 | + |
| 43 | + - name: Install dependencies |
| 44 | + uses: nick-fields/retry@v3 |
| 45 | + with: |
| 46 | + timeout_minutes: 5 |
| 47 | + max_attempts: 5 |
| 48 | + command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress |
| 49 | + |
| 50 | + - name: Execute Broadcasting tests |
| 51 | + run: vendor/bin/phpunit tests/Integration/Broadcasting |
| 52 | + env: |
| 53 | + REDIS_CLIENT: ${{ matrix.client }} |
| 54 | + |
| 55 | + - name: Execute Cache tests |
| 56 | + run: vendor/bin/phpunit tests/Integration/Cache |
| 57 | + env: |
| 58 | + REDIS_CACHE_CONNECTION: cache |
| 59 | + REDIS_CACHE_LOCK_CONNECTION: cache |
| 60 | + REDIS_CLIENT: ${{ matrix.client }} |
| 61 | + |
| 62 | + - name: Execute Queue tests |
| 63 | + run: vendor/bin/phpunit tests/Integration/Queue |
| 64 | + env: |
| 65 | + REDIS_CLIENT: ${{ matrix.client }} |
| 66 | + QUEUE_CONNECTION: redis |
| 67 | + |
| 68 | + redis-cluster: |
| 69 | + runs-on: ubuntu-24.04 |
| 70 | + |
| 71 | + strategy: |
| 72 | + fail-fast: true |
| 73 | + matrix: |
| 74 | + client: ['phpredis', 'predis'] |
| 75 | + |
| 76 | + name: Redis Cluster (${{ matrix.client}}) Driver |
| 77 | + |
| 78 | + steps: |
| 79 | + - name: Checkout code |
| 80 | + uses: actions/checkout@v4 |
| 81 | + |
| 82 | + - name: Setup PHP |
| 83 | + uses: shivammathur/setup-php@v2 |
| 84 | + with: |
| 85 | + php-version: 8.2 |
| 86 | + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, :php-psr |
| 87 | + tools: composer:v2 |
| 88 | + coverage: none |
| 89 | + |
| 90 | + - name: Set Framework version |
| 91 | + run: composer config version "12.x-dev" |
| 92 | + |
| 93 | + - name: Install dependencies |
| 94 | + uses: nick-fields/retry@v3 |
| 95 | + with: |
| 96 | + timeout_minutes: 5 |
| 97 | + max_attempts: 5 |
| 98 | + command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress |
| 99 | + |
| 100 | + - name: Create Redis Cluster |
| 101 | + run: | |
| 102 | + sudo apt update |
| 103 | + sudo apt-get install -y --fix-missing redis-server |
| 104 | + sudo service redis-server stop |
| 105 | + redis-server --daemonize yes --port 7000 --appendonly yes --cluster-enabled yes --cluster-config-file nodes-7000.conf |
| 106 | + redis-server --daemonize yes --port 7001 --appendonly yes --cluster-enabled yes --cluster-config-file nodes-7001.conf |
| 107 | + redis-server --daemonize yes --port 7002 --appendonly yes --cluster-enabled yes --cluster-config-file nodes-7002.conf |
| 108 | + redis-cli --cluster create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 --cluster-replicas 0 --cluster-yes |
| 109 | +
|
| 110 | + - name: Check Redis Cluster is ready |
| 111 | + uses: nick-fields/retry@v3 |
| 112 | + with: |
| 113 | + timeout_seconds: 5 |
| 114 | + max_attempts: 5 |
| 115 | + retry_wait_seconds: 5 |
| 116 | + retry_on: error |
| 117 | + command: | |
| 118 | + redis-cli -c -h 127.0.0.1 -p 7000 cluster info | grep "cluster_state:ok" |
| 119 | + redis-cli -c -h 127.0.0.1 -p 7001 cluster info | grep "cluster_state:ok" |
| 120 | + redis-cli -c -h 127.0.0.1 -p 7002 cluster info | grep "cluster_state:ok" |
| 121 | +
|
| 122 | + - name: Execute Broadcasting tests |
| 123 | + run: vendor/bin/phpunit tests/Integration/Broadcasting |
| 124 | + env: |
| 125 | + REDIS_CLIENT: ${{ matrix.client }} |
| 126 | + REDIS_CLUSTER_HOSTS_AND_PORTS: 127.0.0.1:7000,127.0.0.1:7001,127.0.0.1:7002 |
| 127 | + |
| 128 | + - name: Execute Cache tests |
| 129 | + run: vendor/bin/phpunit tests/Integration/Cache |
| 130 | + env: |
| 131 | + REDIS_CACHE_CONNECTION: default |
| 132 | + REDIS_CACHE_LOCK_CONNECTION: default |
| 133 | + REDIS_CLIENT: ${{ matrix.client }} |
| 134 | + REDIS_CLUSTER_HOSTS_AND_PORTS: 127.0.0.1:7000,127.0.0.1:7001,127.0.0.1:7002 |
| 135 | + |
| 136 | + - name: Execute Queue Tests |
| 137 | + run: vendor/bin/phpunit tests/Integration/Queue |
| 138 | + env: |
| 139 | + REDIS_CLIENT: ${{ matrix.client }} |
| 140 | + REDIS_CLUSTER_HOSTS_AND_PORTS: 127.0.0.1:7000,127.0.0.1:7001,127.0.0.1:7002 |
| 141 | + REDIS_QUEUE: '{default}' |
| 142 | + QUEUE_CONNECTION: redis |
| 143 | + |
0 commit comments