Skip to content

Commit a965e2b

Browse files
authored
sync: update 11 files from source repository (#182)
1 parent 13772e2 commit a965e2b

File tree

11 files changed

+184
-78
lines changed

11 files changed

+184
-78
lines changed

.github/.env.base

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,14 @@ REDIS_HOST=localhost # Redis host (localhost for GitHub Action
203203
REDIS_PORT=6379 # Redis port (standard: 6379)
204204

205205
# Redis Health Check Configuration
206+
REDIS_TRUST_SERVICE_HEALTH=true # Trust GitHub Actions service container health checks (skip redis-cli verification)
206207
REDIS_HEALTH_CHECK_RETRIES=10 # Number of health check retries
207208
REDIS_HEALTH_CHECK_INTERVAL=10 # Health check interval in seconds
208209
REDIS_HEALTH_CHECK_TIMEOUT=5 # Health check timeout in seconds
209210

211+
# Redis Cache Configuration
212+
REDIS_CACHE_FORCE_PULL=false # Force pull Redis images even when cached (true/false)
213+
210214
# ================================================================================================
211215
# 🔧 TOOL VERSIONS
212216
# ================================================================================================

.github/actions/cache-redis-image/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ runs:
218218
fi
219219
220220
# ————————————————————————————————————————————————————————————————
221-
# Save cache using actions/cache
221+
# Save cache using actions/cache (only if cache wasn't already hit)
222222
# ————————————————————————————————————————————————————————————————
223223
- name: 🗄️ Save Redis image cache
224-
if: contains(inputs.cache-mode, 'save') && steps.save-redis-image.outputs.image-saved == 'true'
224+
if: contains(inputs.cache-mode, 'save') && steps.save-redis-image.outputs.image-saved == 'true' && steps.restore-redis-image.outputs.cache-hit != 'true'
225225
uses: actions/cache/save@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
226226
with:
227227
path: ${{ steps.cache-config.outputs.cache-path }}

.github/actions/configure-redis/action.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ outputs:
5757
redis-health-timeout:
5858
description: "Redis health check timeout in seconds"
5959
value: ${{ steps.redis-config.outputs.redis-health-timeout }}
60+
redis-cache-force-pull:
61+
description: "Whether to force pull Redis images even when cached (true/false)"
62+
value: ${{ steps.redis-config.outputs.redis-cache-force-pull }}
63+
redis-trust-service-health:
64+
description: "Trust GitHub Actions service container health checks (skip redis-cli verification)"
65+
value: ${{ steps.redis-config.outputs.redis-trust-service-health }}
66+
redis-service-mode:
67+
description: "Redis service mode (auto, always, never)"
68+
value: ${{ steps.redis-config.outputs.redis-service-mode }}
6069

6170
runs:
6271
using: "composite"
@@ -88,6 +97,8 @@ runs:
8897
REDIS_HEALTH_RETRIES=$(echo "$ENV_JSON" | jq -r '.REDIS_HEALTH_CHECK_RETRIES // "10"')
8998
REDIS_HEALTH_INTERVAL=$(echo "$ENV_JSON" | jq -r '.REDIS_HEALTH_CHECK_INTERVAL // "10"')
9099
REDIS_HEALTH_TIMEOUT=$(echo "$ENV_JSON" | jq -r '.REDIS_HEALTH_CHECK_TIMEOUT // "5"')
100+
REDIS_CACHE_FORCE_PULL=$(echo "$ENV_JSON" | jq -r '.REDIS_CACHE_FORCE_PULL // "false"')
101+
REDIS_TRUST_SERVICE_HEALTH=$(echo "$ENV_JSON" | jq -r '.REDIS_TRUST_SERVICE_HEALTH // "true"')
91102
92103
echo "📋 Initial Redis Configuration:"
93104
echo " • ENABLE_REDIS_SERVICE: $REDIS_ENABLED"
@@ -98,6 +109,8 @@ runs:
98109
echo " • REDIS_HEALTH_CHECK_RETRIES: $REDIS_HEALTH_RETRIES"
99110
echo " • REDIS_HEALTH_CHECK_INTERVAL: $REDIS_HEALTH_INTERVAL"
100111
echo " • REDIS_HEALTH_CHECK_TIMEOUT: $REDIS_HEALTH_TIMEOUT"
112+
echo " • REDIS_CACHE_FORCE_PULL: $REDIS_CACHE_FORCE_PULL"
113+
echo " • REDIS_TRUST_SERVICE_HEALTH: $REDIS_TRUST_SERVICE_HEALTH"
101114
echo ""
102115
103116
# Initialize detection tracking
@@ -180,12 +193,16 @@ runs:
180193
echo "redis-health-retries=$REDIS_HEALTH_RETRIES" >> $GITHUB_OUTPUT
181194
echo "redis-health-interval=$REDIS_HEALTH_INTERVAL" >> $GITHUB_OUTPUT
182195
echo "redis-health-timeout=$REDIS_HEALTH_TIMEOUT" >> $GITHUB_OUTPUT
196+
echo "redis-cache-force-pull=$REDIS_CACHE_FORCE_PULL" >> $GITHUB_OUTPUT
197+
echo "redis-trust-service-health=$REDIS_TRUST_SERVICE_HEALTH" >> $GITHUB_OUTPUT
198+
echo "redis-service-mode=$REDIS_MODE" >> $GITHUB_OUTPUT
183199
184200
# Final configuration summary
185201
echo ""
186202
echo "🎯 Final Redis Configuration:"
187203
if [[ "$REDIS_ENABLED" == "true" ]]; then
188204
echo "✅ Redis service enabled:"
205+
echo " • Service Mode: $REDIS_MODE"
189206
echo " • Detection Method: $DETECTION_METHOD"
190207
echo " • Auto-detected: $AUTO_DETECTED"
191208
echo " • Version: $REDIS_VERSION"
@@ -194,8 +211,11 @@ runs:
194211
echo " • Health Check Retries: $REDIS_HEALTH_RETRIES"
195212
echo " • Health Check Interval: ${REDIS_HEALTH_INTERVAL}s"
196213
echo " • Health Check Timeout: ${REDIS_HEALTH_TIMEOUT}s"
214+
echo " • Cache Force Pull: $REDIS_CACHE_FORCE_PULL"
215+
echo " • Trust Service Health: $REDIS_TRUST_SERVICE_HEALTH"
197216
else
198217
echo "❌ Redis service disabled:"
218+
echo " • Service Mode: $REDIS_MODE"
199219
echo " • Detection Method: $DETECTION_METHOD"
200220
echo " • Auto-detected: $AUTO_DETECTED"
201221
fi

.github/actions/setup-magex/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ runs:
5252
with:
5353
path: |
5454
~/.cache/magex-bin
55-
key: ${{ inputs.runner-os }}-magex-${{ inputs.magex-version }}-v2
55+
key: ${{ inputs.runner-os }}-magex-${{ inputs.magex-version }}
5656

5757
# ————————————————————————————————————————————————————————————————
5858
# Make cached magex usable by copying to GOPATH/bin and adding to PATH

.github/actions/setup-redis-service/action.yml

Lines changed: 114 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ inputs:
5454
description: "Whether to use cached Redis image (true/false)"
5555
required: false
5656
default: "true"
57+
matrix-os:
58+
description: "Matrix OS for consistent cache key generation (e.g., ubuntu-24.04)"
59+
required: false
60+
default: "ubuntu-24.04"
61+
trust-service-health:
62+
description: "Trust GitHub Actions service container health checks (skip redis-cli verification)"
63+
required: false
64+
default: "true"
5765

5866
outputs:
5967
redis-available:
@@ -103,7 +111,7 @@ runs:
103111
uses: ./.github/actions/cache-redis-image
104112
with:
105113
redis-version: ${{ inputs.redis-version }}
106-
runner-os: ${{ runner.os }}
114+
runner-os: ${{ inputs.matrix-os }}
107115
cache-mode: "restore"
108116

109117
# ————————————————————————————————————————————————————————————————
@@ -118,8 +126,7 @@ runs:
118126
echo "📋 Redis Configuration:"
119127
echo " • Host: ${{ inputs.redis-host }}"
120128
echo " • Port: ${{ inputs.redis-port }}"
121-
echo " • Max Retries: ${{ inputs.max-retries }}"
122-
echo " • Retry Interval: ${{ inputs.retry-interval }}s"
129+
echo " • Trust Service Health: ${{ inputs.trust-service-health }}"
123130
echo ""
124131
125132
# Track connection timing
@@ -130,88 +137,120 @@ runs:
130137
REDIS_VERSION="unknown"
131138
INSTALLATION_METHOD="unknown"
132139
133-
# Install redis-cli if not available
134-
if ! command -v redis-cli &> /dev/null; then
135-
echo "📦 Installing redis-cli..."
136-
if [[ "$RUNNER_OS" == "Linux" ]]; then
137-
if sudo apt-get update && sudo apt-get install -y redis-tools; then
138-
echo "✅ redis-cli installed successfully on Linux"
139-
INSTALLATION_METHOD="installed"
140-
else
141-
echo "❌ Failed to install redis-cli on Linux"
140+
# Check if we should trust service container health checks
141+
TRUST_SERVICE_HEALTH="${{ inputs.trust-service-health }}"
142+
TRUST_SERVICE_HEALTH=$(echo "$TRUST_SERVICE_HEALTH" | xargs) # Trim whitespace
143+
if [[ "$TRUST_SERVICE_HEALTH" == "true" ]]; then
144+
echo "✅ Trusting GitHub Actions service container health checks"
145+
echo "🔗 Skipping redis-cli installation and verification"
146+
147+
# Assume Redis is available since service container health checks passed
148+
REDIS_AVAILABLE="true"
149+
REDIS_VERSION="service-container"
150+
INSTALLATION_METHOD="trusted-service"
151+
152+
# Set Redis connection environment variables for tests/benchmarks
153+
echo "REDIS_ADDR=${{ inputs.redis-host }}:${{ inputs.redis-port }}" >> $GITHUB_ENV
154+
echo "REDIS_HOST=${{ inputs.redis-host }}" >> $GITHUB_ENV
155+
echo "REDIS_PORT=${{ inputs.redis-port }}" >> $GITHUB_ENV
156+
echo "REDIS_URL=redis://${{ inputs.redis-host }}:${{ inputs.redis-port }}" >> $GITHUB_ENV
157+
158+
echo "✅ Redis environment variables configured:"
159+
echo " • REDIS_ADDR=${{ inputs.redis-host }}:${{ inputs.redis-port }}"
160+
echo " • REDIS_HOST=${{ inputs.redis-host }}"
161+
echo " • REDIS_PORT=${{ inputs.redis-port }}"
162+
echo " • REDIS_URL=redis://${{ inputs.redis-host }}:${{ inputs.redis-port }}"
163+
164+
else
165+
echo "🔧 Performing full Redis verification with redis-cli..."
166+
echo "📋 Retry Configuration:"
167+
echo " • Max Retries: ${{ inputs.max-retries }}"
168+
echo " • Retry Interval: ${{ inputs.retry-interval }}s"
169+
echo ""
170+
171+
# Install redis-cli if not available
172+
if ! command -v redis-cli &> /dev/null; then
173+
echo "📦 Installing redis-cli..."
174+
if [[ "$RUNNER_OS" == "Linux" ]]; then
175+
if sudo apt-get update && sudo apt-get install -y redis-tools; then
176+
echo "✅ redis-cli installed successfully on Linux"
177+
INSTALLATION_METHOD="installed"
178+
else
179+
echo "❌ Failed to install redis-cli on Linux"
180+
INSTALLATION_METHOD="unavailable"
181+
fi
182+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
183+
if brew install redis; then
184+
echo "✅ redis-cli installed successfully on macOS"
185+
INSTALLATION_METHOD="installed"
186+
else
187+
echo "❌ Failed to install redis-cli on macOS"
188+
INSTALLATION_METHOD="unavailable"
189+
fi
190+
elif [[ "$RUNNER_OS" == "Windows" ]]; then
191+
echo "⚠️ Redis CLI not available on Windows runner - skipping verification"
142192
INSTALLATION_METHOD="unavailable"
143-
fi
144-
elif [[ "$RUNNER_OS" == "macOS" ]]; then
145-
if brew install redis; then
146-
echo "✅ redis-cli installed successfully on macOS"
147-
INSTALLATION_METHOD="installed"
193+
echo "redis-available=false" >> $GITHUB_OUTPUT
194+
echo "redis-version=n/a" >> $GITHUB_OUTPUT
195+
echo "connection-time=0" >> $GITHUB_OUTPUT
196+
echo "installation-method=$INSTALLATION_METHOD" >> $GITHUB_OUTPUT
197+
exit 0
148198
else
149-
echo "❌ Failed to install redis-cli on macOS"
199+
echo "❌ Unsupported runner OS: $RUNNER_OS"
150200
INSTALLATION_METHOD="unavailable"
151201
fi
152-
elif [[ "$RUNNER_OS" == "Windows" ]]; then
153-
echo "⚠️ Redis CLI not available on Windows runner - skipping verification"
154-
INSTALLATION_METHOD="unavailable"
155-
echo "redis-available=false" >> $GITHUB_OUTPUT
156-
echo "redis-version=n/a" >> $GITHUB_OUTPUT
157-
echo "connection-time=0" >> $GITHUB_OUTPUT
158-
echo "installation-method=$INSTALLATION_METHOD" >> $GITHUB_OUTPUT
159-
exit 0
160202
else
161-
echo "❌ Unsupported runner OS: $RUNNER_OS"
162-
INSTALLATION_METHOD="unavailable"
203+
echo "✅ redis-cli already available"
204+
INSTALLATION_METHOD="pre-existing"
163205
fi
164-
else
165-
echo "✅ redis-cli already available"
166-
INSTALLATION_METHOD="pre-existing"
167-
fi
168206
169-
# Only proceed with verification if redis-cli is available
170-
if command -v redis-cli &> /dev/null; then
171-
echo "🔗 Testing Redis connection..."
207+
# Only proceed with verification if redis-cli is available
208+
if command -v redis-cli &> /dev/null; then
209+
echo "🔗 Testing Redis connection..."
210+
211+
# Test Redis connection with retries
212+
MAX_RETRIES=${{ inputs.max-retries }}
213+
RETRY_INTERVAL=${{ inputs.retry-interval }}
214+
RETRY_COUNT=0
172215
173-
# Test Redis connection with retries
174-
MAX_RETRIES=${{ inputs.max-retries }}
175-
RETRY_INTERVAL=${{ inputs.retry-interval }}
176-
RETRY_COUNT=0
216+
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
217+
if redis-cli -h ${{ inputs.redis-host }} -p ${{ inputs.redis-port }} ping > /dev/null 2>&1; then
218+
echo "✅ Redis is responding to PING"
219+
REDIS_AVAILABLE="true"
220+
break
221+
fi
222+
RETRY_COUNT=$((RETRY_COUNT + 1))
223+
echo "⏳ Waiting for Redis... (attempt $RETRY_COUNT/$MAX_RETRIES)"
224+
sleep $RETRY_INTERVAL
225+
done
177226
178-
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
179-
if redis-cli -h ${{ inputs.redis-host }} -p ${{ inputs.redis-port }} ping > /dev/null 2>&1; then
180-
echo "✅ Redis is responding to PING"
181-
REDIS_AVAILABLE="true"
182-
break
227+
if [ $RETRY_COUNT -eq $MAX_RETRIES ]; then
228+
echo "❌ Redis failed to respond after $MAX_RETRIES attempts"
229+
REDIS_AVAILABLE="false"
183230
fi
184-
RETRY_COUNT=$((RETRY_COUNT + 1))
185-
echo "⏳ Waiting for Redis... (attempt $RETRY_COUNT/$MAX_RETRIES)"
186-
sleep $RETRY_INTERVAL
187-
done
188231
189-
if [ $RETRY_COUNT -eq $MAX_RETRIES ]; then
190-
echo "❌ Redis failed to respond after $MAX_RETRIES attempts"
191-
REDIS_AVAILABLE="false"
192-
fi
232+
# Get Redis version and additional info if connected
233+
if [ "$REDIS_AVAILABLE" = "true" ]; then
234+
echo "📊 Gathering Redis information..."
235+
REDIS_VERSION=$(redis-cli -h ${{ inputs.redis-host }} -p ${{ inputs.redis-port }} INFO server 2>/dev/null | grep "redis_version:" | cut -d: -f2 | tr -d '\r\n' || echo "unknown")
236+
echo "✅ Redis Version: $REDIS_VERSION"
237+
238+
# Set Redis connection environment variables for tests/benchmarks
239+
echo "REDIS_ADDR=${{ inputs.redis-host }}:${{ inputs.redis-port }}" >> $GITHUB_ENV
240+
echo "REDIS_HOST=${{ inputs.redis-host }}" >> $GITHUB_ENV
241+
echo "REDIS_PORT=${{ inputs.redis-port }}" >> $GITHUB_ENV
242+
echo "REDIS_URL=redis://${{ inputs.redis-host }}:${{ inputs.redis-port }}" >> $GITHUB_ENV
193243
194-
# Get Redis version and additional info if connected
195-
if [ "$REDIS_AVAILABLE" = "true" ]; then
196-
echo "📊 Gathering Redis information..."
197-
REDIS_VERSION=$(redis-cli -h ${{ inputs.redis-host }} -p ${{ inputs.redis-port }} INFO server 2>/dev/null | grep "redis_version:" | cut -d: -f2 | tr -d '\r\n' || echo "unknown")
198-
echo "✅ Redis Version: $REDIS_VERSION"
199-
200-
# Set Redis connection environment variables for tests/benchmarks
201-
echo "REDIS_ADDR=${{ inputs.redis-host }}:${{ inputs.redis-port }}" >> $GITHUB_ENV
202-
echo "REDIS_HOST=${{ inputs.redis-host }}" >> $GITHUB_ENV
203-
echo "REDIS_PORT=${{ inputs.redis-port }}" >> $GITHUB_ENV
204-
echo "REDIS_URL=redis://${{ inputs.redis-host }}:${{ inputs.redis-port }}" >> $GITHUB_ENV
205-
206-
echo "✅ Redis environment variables configured:"
207-
echo " • REDIS_ADDR=${{ inputs.redis-host }}:${{ inputs.redis-port }}"
208-
echo " • REDIS_HOST=${{ inputs.redis-host }}"
209-
echo " • REDIS_PORT=${{ inputs.redis-port }}"
210-
echo " • REDIS_URL=redis://${{ inputs.redis-host }}:${{ inputs.redis-port }}"
244+
echo "✅ Redis environment variables configured:"
245+
echo " • REDIS_ADDR=${{ inputs.redis-host }}:${{ inputs.redis-port }}"
246+
echo " • REDIS_HOST=${{ inputs.redis-host }}"
247+
echo " • REDIS_PORT=${{ inputs.redis-port }}"
248+
echo " • REDIS_URL=redis://${{ inputs.redis-host }}:${{ inputs.redis-port }}"
249+
fi
250+
else
251+
echo "❌ redis-cli not available - cannot verify Redis connection"
252+
REDIS_AVAILABLE="false"
211253
fi
212-
else
213-
echo "❌ redis-cli not available - cannot verify Redis connection"
214-
REDIS_AVAILABLE="false"
215254
fi
216255
217256
# Calculate connection time
@@ -236,7 +275,9 @@ runs:
236275
echo " • Cache Hit: $CACHE_HIT"
237276
echo " • Cache Operation Time: ${CACHE_TIME}s"
238277
echo " • Image Size: ${IMAGE_SIZE}MB"
239-
if [[ "$CACHE_HIT" == "true" ]]; then
278+
if [[ "${{ inputs.trust-service-health }}" == "true" ]]; then
279+
echo "🚀 Redis service trusted via GitHub Actions health checks - ultra-fast startup!"
280+
elif [[ "$CACHE_HIT" == "true" ]]; then
240281
echo "🚀 Redis image restored from cache - faster startup achieved!"
241282
else
242283
echo "📥 Redis image pulled from Docker Hub - consider cache warming"

.github/actions/warm-cache/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ inputs:
4242
description: "Comma-separated list of Redis versions to warm"
4343
required: false
4444
default: "7-alpine"
45+
redis-cache-force-pull:
46+
description: "Whether to force pull Redis images even when cached"
47+
required: false
48+
default: "false"
4549

4650
runs:
4751
using: "composite"
@@ -109,7 +113,7 @@ runs:
109113
with:
110114
redis-versions: ${{ inputs.redis-versions }}
111115
runner-os: ${{ inputs.matrix-os }}
112-
force-pull: "true"
116+
force-pull: ${{ inputs.redis-cache-force-pull }}
113117

114118
# ————————————————————————————————————————————————————————————————
115119
# Ensure go.sum exists and download modules

.github/workflows/fortress-benchmarks.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ on:
7373
required: false
7474
type: string
7575
default: "5"
76+
redis-trust-service-health:
77+
description: "Trust GitHub Actions service container health checks"
78+
required: false
79+
type: string
80+
default: "true"
7681
secrets:
7782
github-token:
7883
description: "GitHub token for API access"
@@ -154,6 +159,7 @@ jobs:
154159
redis-host: ${{ inputs.redis-host }}
155160
redis-port: ${{ inputs.redis-port }}
156161
use-cache: "true"
162+
trust-service-health: ${{ inputs.redis-trust-service-health }}
157163

158164
# ————————————————————————————————————————————————————————————————
159165
# Start benchmark timer

0 commit comments

Comments
 (0)