|
| 1 | +on: [push, pull_request] |
| 2 | + |
| 3 | +jobs: |
| 4 | + build: |
| 5 | + runs-on: ubuntu-latest |
| 6 | + continue-on-error: ${{ matrix.experimental }} |
| 7 | + strategy: |
| 8 | + fail-fast: false |
| 9 | + matrix: |
| 10 | + php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0'] |
| 11 | + experimental: [false] |
| 12 | + include: |
| 13 | + - php: '8.1' |
| 14 | + experimental: true |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v2 |
| 18 | + with: |
| 19 | + submodules: true |
| 20 | + - name: Install PHP ${{ matrix.php }} |
| 21 | + uses: shivammathur/setup-php@v2 |
| 22 | + with: |
| 23 | + php-version: ${{ matrix.php }} |
| 24 | + extensions: json, igbinary, msgpack, :redis |
| 25 | + coverage: none |
| 26 | + tools: none |
| 27 | + - name: Install dependencies |
| 28 | + run: | |
| 29 | + sudo add-apt-repository ppa:redislabs/redis |
| 30 | + sudo add-apt-repository ppa:ondrej/php |
| 31 | + sudo apt-get update |
| 32 | + sudo apt-get install redis valgrind libzstd-dev liblz4-dev |
| 33 | + - name: Build phpredis |
| 34 | + run: | |
| 35 | + phpize |
| 36 | + ./configure --enable-redis-lzf --enable-redis-zstd --enable-redis-igbinary --enable-redis-msgpack --enable-redis-lz4 --with-liblz4 |
| 37 | + sudo make install |
| 38 | + sudo mkdir -p /etc/php/${{ matrix.php }}/cli/conf.d |
| 39 | + echo 'extension = redis.so' | sudo tee -a /etc/php/${{ matrix.php }}/cli/conf.d/90-redis.ini |
| 40 | + - name: Start redis |
| 41 | + run: | |
| 42 | + redis-cli SHUTDOWN NOSAVE |
| 43 | + for PORT in $(seq 6379 6382) $(seq 32767 32769); do |
| 44 | + redis-server --port $PORT --daemonize yes --aclfile tests/users.acl |
| 45 | + done |
| 46 | + redis-server --port 0 --unixsocket /tmp/redis.sock --daemonize yes --aclfile tests/users.acl |
| 47 | + - name: Start redis cluster |
| 48 | + run: | |
| 49 | + mkdir -p tests/nodes |
| 50 | + echo -n > tests/nodes/nodemap |
| 51 | + for PORT in $(seq 7000 7011); do |
| 52 | + redis-server --port $PORT --cluster-enabled yes --cluster-config-file $PORT.conf --daemonize yes --aclfile tests/users.acl |
| 53 | + echo 127.0.0.1:$PORT >> tests/nodes/nodemap |
| 54 | + done |
| 55 | + echo yes | redis-cli --cluster create $(seq -f 127.0.0.1:%g 7000 7011) --cluster-replicas 3 --user phpredis -a phpredis |
| 56 | + - name: Start redis sentinel |
| 57 | + run: | |
| 58 | + wget raw.githubusercontent.com/redis/redis/6.2/sentinel.conf |
| 59 | + for PORT in $(seq 26379 26380); do |
| 60 | + cp sentinel.conf $PORT.conf |
| 61 | + sed -i '/^sentinel/d' $PORT.conf |
| 62 | + redis-server $PORT.conf --port $PORT --daemonize yes --sentinel monitor mymaster 127.0.0.1 6379 1 --sentinel auth-pass mymaster phpredis |
| 63 | + done |
| 64 | + - name: Run tests |
| 65 | + run: | |
| 66 | + php tests/TestRedis.php --class Redis --user phpredis --auth phpredis |
| 67 | + php tests/TestRedis.php --class RedisArray --user phpredis --auth phpredis |
| 68 | + php tests/TestRedis.php --class RedisCluster --user phpredis --auth phpredis |
| 69 | + php tests/TestRedis.php --class RedisSentinel --auth phpredis |
| 70 | + env: |
| 71 | + TEST_PHP_ARGS: -e |
| 72 | + - name: Run tests using valgrind |
| 73 | + continue-on-error: true |
| 74 | + run: | |
| 75 | + valgrind --error-exitcode=1 php tests/TestRedis.php --class Redis --user phpredis --auth phpredis |
| 76 | + valgrind --error-exitcode=1 php tests/TestRedis.php --class RedisArray --user phpredis --auth phpredis |
| 77 | + valgrind --error-exitcode=1 php tests/TestRedis.php --class RedisCluster --user phpredis --auth phpredis |
| 78 | + valgrind --error-exitcode=1 php tests/TestRedis.php --class RedisSentinel --auth phpredis |
| 79 | + env: |
| 80 | + TEST_PHP_ARGS: -e |
| 81 | + USE_ZEND_ALLOC: 0 |
0 commit comments