Update SHAs #1
This file contains 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: Test Redis CE | |
on: | |
pull_request: | |
types: [ labeled ] | |
branches: [ main ] | |
paths: | |
- '.github/workflows/test.yml' | |
- 'Casks/**' | |
jobs: | |
test: | |
if: github.event.label.name == 'run-tests' | |
name: Test Redis CE | |
strategy: | |
fail-fast: false | |
matrix: | |
os_version: # See: https://github.com/actions/runner-images/blob/main/README.md#available-images | |
- macos-15-large # macOS 15 x86_64 | |
- macos-15 # macOS 15 arm64 | |
- macos-14-large # macOS 14 x86_64 | |
- macos-14 # macOS 14 arm64 | |
- macos-13 # macOS 13 x86_64 | |
- macos-13-xlarge # macOS 13 arm64 | |
cask: | |
- redis | |
- redis-rc | |
runs-on: ${{ matrix.os_version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Homebrew | |
run: | | |
export HOMEBREW_GITHUB_API_TOKEN=$GITHUB_TOKEN | |
brew update | |
brew tap ${{ vars.REDIS_TAP }} . | |
- name: Install Redis CE | |
run: | | |
brew install --cask ${{ matrix.cask }} --debug --verbose | |
ls -al $(brew --prefix)/etc/redis.conf | |
ls -al $(brew --prefix)/lib/redis/modules | |
ls -al $(brew --prefix)/bin/redis* | |
- name: Test Redis Installation | |
run: | | |
redis-server --version | |
redis-server $(brew --prefix)/etc/redis.conf | |
for i in {1..30}; do redis-cli ping && break || echo "Waiting for Redis... $i" && sleep 1; done | |
redis-cli info server || { echo "Cannot get server info"; exit 1; } | |
redis-cli module list | |
- name: Verify Installed Modules | |
run: | | |
modules=$(redis-cli module list) | |
echo "Installed modules:" | |
echo "$modules" | |
missing_modules=() | |
for module in "bf" "search" "timeseries" "ReJSON"; do | |
if ! echo "$modules" | grep -q "$module"; then | |
missing_modules+=("$module") | |
fi | |
done | |
if [ ${#missing_modules[@]} -eq 0 ]; then | |
echo "All required modules are installed" | |
else | |
echo "The following modules are missing: ${missing_modules[*]}" | |
exit 1 | |
fi | |
- name: Test RedisBloom | |
run: | | |
redis-cli BF.ADD popular_keys "redis:hash" | |
redis-cli BF.ADD popular_keys "redis:set" | |
[ "$(redis-cli BF.EXISTS popular_keys "redis:hash")" = "1" ] || \ | |
{ echo "RedisBloom test failed: 'redis:hash' not found"; exit 1; } | |
[ "$(redis-cli BF.EXISTS popular_keys "redis:list")" = "0" ] || \ | |
{ echo "RedisBloom test failed: 'redis:list' found unexpectedly"; exit 1; } | |
echo "RedisBloom test passed successfully" | |
- name: Test RediSearch | |
run: | | |
redis-cli FT.CREATE redis_commands ON HASH PREFIX 1 cmd: SCHEMA name TEXT SORTABLE description TEXT | |
redis-cli HSET cmd:set name "SET" description "Set the string value of a key" | |
redis-cli HSET cmd:get name "GET" description "Get the value of a key" | |
result=$(redis-cli FT.SEARCH redis_commands "value") | |
if echo "$result" | grep -q "Set the string value of a key" && \ | |
echo "$result" | grep -q "Get the value of a key"; then | |
echo "RediSearch test passed successfully" | |
else | |
echo "RediSearch test failed: expected commands not found in search results" | |
exit 1 | |
fi | |
- name: Test RedisTimeSeries | |
run: | | |
redis-cli TS.CREATE redis:cpu:usage RETENTION 86400 | |
redis-cli TS.ADD redis:cpu:usage "*" 80 | |
redis-cli TS.ADD redis:cpu:usage "*" 65 | |
redis-cli TS.ADD redis:cpu:usage "*" 70 | |
result=$(redis-cli TS.RANGE redis:cpu:usage - + COUNT 3) | |
if echo "$result" | grep -q "80" && \ | |
echo "$result" | grep -q "65" && \ | |
echo "$result" | grep -q "70"; then | |
echo "RedisTimeSeries test passed successfully" | |
else | |
echo "RedisTimeSeries test failed: expected values not found in time series" | |
exit 1 | |
fi | |
- name: Test ReJSON | |
run: | | |
redis-cli JSON.SET redis:config $ '{"maxmemory":"2gb","maxmemory-policy":"allkeys-lru"}' | |
result=$(redis-cli JSON.GET redis:config $.maxmemory-policy) | |
cleaned_result=$(echo $result | tr -d '[]"') | |
if [ "$cleaned_result" = "allkeys-lru" ]; then | |
echo "ReJSON test passed successfully" | |
else | |
echo "ReJSON test failed: expected 'allkeys-lru', got $result" | |
exit 1 | |
fi | |
- name: Test uninstall | |
run: | | |
brew uninstall ${{ matrix.cask }} | |
brew untap ${{ vars.REDIS_TAP }} |