Refactor memcached dashboard #631
This file contains hidden or 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: Tests | |
| on: | |
| push: | |
| paths-ignore: | |
| - '**.md' | |
| pull_request: | |
| paths-ignore: | |
| - '**.md' | |
| jobs: | |
| tests-single-node: | |
| runs-on: ubuntu-latest | |
| services: | |
| memcached: | |
| image: memcached:1.6-alpine | |
| ports: | |
| - 11211:11211 | |
| redis: | |
| image: redis:8.8 | |
| ports: | |
| - 6379:6379 | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| php: [ '8.2', '8.3', '8.4', '8.5' ] | |
| stability: [ prefer-stable ] | |
| name: PHP ${{ matrix.php }} (Single-Node) | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: apcu, redis | |
| ini-values: apc.enable_cli=1 | |
| coverage: none | |
| env: | |
| REDIS_CONFIGURE_OPTS: --enable-redis --enable-redis-igbinary --enable-redis-msgpack --enable-redis-lzf --with-liblzf --enable-redis-zstd --with-libzstd --enable-redis-lz4 --with-liblz4 | |
| REDIS_LIBS: liblz4-dev, liblzf-dev, libzstd-dev | |
| - name: Install dependencies | |
| run: composer update --prefer-dist --no-interaction --no-progress | |
| - name: Execute tests | |
| run: vendor/bin/phpunit | |
| tests-cluster: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| php: [ '8.2', '8.3', '8.4', '8.5' ] | |
| stability: [ prefer-stable ] | |
| name: PHP ${{ matrix.php }} (Redis Cluster) | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Install Redis for Cluster | |
| run: | | |
| curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg | |
| echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list | |
| sudo apt-get update | |
| sudo apt-get install -y redis | |
| - name: Start Redis Cluster | |
| run: | | |
| REJSON=$(dpkg -S rejson.so 2>/dev/null | awk -F': ' '/rejson\.so$/ {print $2; exit}') | |
| [ -n "$REJSON" ] || REJSON=$(find /usr/lib /opt -name rejson.so 2>/dev/null | head -1) | |
| sudo sysctl -w vm.overcommit_memory=1 >/dev/null | |
| BASE_PORT=7000 | |
| NODE_COUNT=3 | |
| node_addresses="" | |
| for i in $(seq 0 $((NODE_COUNT - 1))); do | |
| port=$((BASE_PORT + i)) | |
| mkdir -p ./redis-cluster/node-$port | |
| node_addresses+=" 127.0.0.1:$port" | |
| cat > ./redis-cluster/node-$port/redis.conf <<EOF | |
| port $port | |
| cluster-enabled yes | |
| cluster-config-file nodes.conf | |
| cluster-node-timeout 5000 | |
| appendonly no | |
| databases 1 | |
| daemonize yes | |
| bind 127.0.0.1 | |
| dir "$(pwd)/redis-cluster/node-$port" | |
| ${REJSON:+loadmodule $REJSON} | |
| EOF | |
| redis-server ./redis-cluster/node-$port/redis.conf | |
| done | |
| sleep 3 | |
| echo "yes" | redis-cli --cluster create $node_addresses --cluster-replicas 0 | |
| echo "Redis cluster is up and running." | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: redis | |
| coverage: none | |
| env: | |
| REDIS_CONFIGURE_OPTS: --enable-redis --enable-redis-igbinary --enable-redis-msgpack --enable-redis-lzf --with-liblzf --enable-redis-zstd --with-libzstd --enable-redis-lz4 --with-liblz4 | |
| REDIS_LIBS: liblz4-dev, liblzf-dev, libzstd-dev | |
| - name: Install dependencies | |
| run: composer update --prefer-dist --no-interaction --no-progress | |
| - name: Execute tests | |
| env: | |
| PCA_REDIS_0_NODES: '["127.0.0.1:7000","127.0.0.1:7001","127.0.0.1:7002"]' | |
| run: vendor/bin/phpunit tests/Dashboards/Redis |