Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
pull_request:
branches: [ main ]

permissions:
contents: read

env:
GO_VERSION: '^1.23.5'

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/cli-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ env:

permissions:
contents: write
packages: write

jobs:
prepare:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
# Install golangci-lint for Go code linting
- name: Install golangci-lint
uses: golangci/golangci-lint-action@v8
continue-on-error: true
with:
version: latest

Expand Down Expand Up @@ -102,4 +103,4 @@ jobs:
go env GOVERSION
go env GOROOT
go env GOPATH
echo "All tools installed successfully!"
echo "All tools installed successfully!"
135 changes: 131 additions & 4 deletions .github/workflows/examples-ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: Examples CI

permissions:
contents: read

on:
push:
branches: [ main ]
Expand Down Expand Up @@ -31,6 +28,10 @@ jobs:
- multi-tenant-app
- instance-aware-db
- verbose-debug
- feature-flag-proxy
- testing-scenarios
- observer-pattern
- health-aware-reverse-proxy
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -152,7 +153,133 @@ jobs:

kill $PID 2>/dev/null || true

elif [ "${{ matrix.example }}" = "reverse-proxy" ] || [ "${{ matrix.example }}" = "http-client" ] || [ "${{ matrix.example }}" = "advanced-logging" ] || [ "${{ matrix.example }}" = "verbose-debug" ] || [ "${{ matrix.example }}" = "instance-aware-db" ]; then
elif [ "${{ matrix.example }}" = "testing-scenarios" ]; then
# Testing scenarios example has comprehensive validation scripts
echo "🧪 Testing testing-scenarios with validation scripts..."

# Make scripts executable
chmod +x *.sh

# Run the demo script (includes comprehensive testing)
echo "Running demo.sh for rapid validation..."
if timeout 60s ./demo.sh; then
echo "✅ testing-scenarios demo script passed"
else
echo "❌ testing-scenarios demo script failed"
exit 1
fi

# Run health check validation
echo "Running health check validation..."
if timeout 30s ./test-health-checks.sh; then
echo "✅ testing-scenarios health check validation passed"
else
echo "❌ testing-scenarios health check validation failed"
exit 1
fi

# Run feature flag testing
echo "Running feature flag validation..."
if timeout 30s ./test-feature-flags.sh; then
echo "✅ testing-scenarios feature flag validation passed"
else
echo "❌ testing-scenarios feature flag validation failed"
exit 1
fi
elif [ "${{ matrix.example }}" = "health-aware-reverse-proxy" ]; then
# Health-aware reverse proxy needs comprehensive circuit breaker testing
echo "🔄 Testing health-aware-reverse-proxy with circuit breaker validation..."

# Make test script executable
chmod +x test-circuit-breakers.sh

# Start the application in background
timeout 60s ./example > app.log 2>&1 &
PID=$!
sleep 8 # Allow time for mock backends to start

# Check if process is still running
if ! kill -0 $PID 2>/dev/null; then
echo "❌ health-aware-reverse-proxy crashed during startup"
cat app.log
exit 1
fi

# Test basic health endpoint (accepts both 200 and 503 status codes)
echo "Testing basic health endpoint..."
health_response=$(curl -s -w "HTTP_CODE:%{http_code}" http://localhost:8080/health)
http_code=$(echo "$health_response" | grep -o "HTTP_CODE:[0-9]*" | cut -d: -f2)
if [ "$http_code" = "200" ] || [ "$http_code" = "503" ]; then
echo "✅ health-aware-reverse-proxy health endpoint responding (HTTP $http_code)"
else
echo "❌ health-aware-reverse-proxy health endpoint returned unexpected status: HTTP $http_code"
echo "Response: $health_response"
kill $PID 2>/dev/null || true
exit 1
fi

# Test that unreachable backend triggers circuit breaker (simplified test)
echo "Testing circuit breaker functionality..."
# Make 3 requests to unreachable API to trigger circuit breaker
for i in {1..3}; do
curl -s http://localhost:8080/api/unreachable > /dev/null || true
done

# Wait a moment for circuit breaker to update
sleep 2

# Check that health status reflects circuit breaker state
health_response=$(curl -s http://localhost:8080/health)
if echo "$health_response" | grep -q '"circuit_open_count":[1-9]'; then
echo "✅ health-aware-reverse-proxy circuit breaker properly triggered"
else
echo "⚠️ Circuit breaker may not have triggered as expected (this could be timing-related)"
echo "Health response: $health_response"
# Don't fail here as this could be timing-sensitive in CI
fi

kill $PID 2>/dev/null || true

elif [ "${{ matrix.example }}" = "observer-pattern" ]; then
# Observer pattern example needs to complete its demo and show success message
echo "🔍 Testing observer-pattern example completion..."

# Run the observer pattern demo and capture output
timeout 30s ./example > app.log 2>&1
EXIT_CODE=$?

# Check if the demo completed successfully
if [ $EXIT_CODE -eq 0 ] && grep -q "Observer Pattern Demo completed successfully" app.log; then
echo "✅ observer-pattern demo completed successfully"

# Verify key events were logged
if grep -q "module.registered" app.log && grep -q "service.registered" app.log; then
echo "✅ observer-pattern logged expected lifecycle events"
else
echo "❌ observer-pattern missing expected lifecycle events"
echo "📋 Application logs:"
cat app.log
exit 1
fi

# Verify CloudEvents functionality was tested
if grep -q "CloudEvent emitted successfully" app.log; then
echo "✅ observer-pattern CloudEvents functionality verified"
else
echo "❌ observer-pattern CloudEvents functionality not verified"
echo "📋 Application logs:"
cat app.log
exit 1
fi

else
echo "❌ observer-pattern demo failed to complete successfully"
echo "📋 Application logs:"
cat app.log
exit 1
fi

elif [ "${{ matrix.example }}" = "reverse-proxy" ] || [ "${{ matrix.example }}" = "http-client" ] || [ "${{ matrix.example }}" = "advanced-logging" ] || [ "${{ matrix.example }}" = "verbose-debug" ] || [ "${{ matrix.example }}" = "instance-aware-db" ] || [ "${{ matrix.example }}" = "feature-flag-proxy" ]; then
# These apps just need to start without immediate errors
timeout 5s ./example &
PID=$!
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/module-release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
name: Module Release
run-name: Module Release for ${{ inputs.module || github.event.inputs.module }} - ${{ inputs.releaseType || github.event.inputs.releaseType }}
permissions:
contents: write
pull-requests: read
issues: read
packages: write

on:
workflow_dispatch:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/modules-ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: Modules CI

permissions:
contents: read

on:
push:
branches: [ main ]
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/release-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
#
# Use this workflow when you want to release everything that has changed.
# Use individual workflows (release.yml, module-release.yml) for specific releases.
#

name: Release All Components with Changes
run-name: Release All Components with Changes
permissions:
contents: write
actions: write
packages: write
issues: read
pull-requests: read

on:
workflow_dispatch:
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Release
run-name: Release ${{ github.event.inputs.version || github.event.inputs.releaseType }}

permissions:
contents: write
packages: write
issues: read
pull-requests: read

on:
workflow_dispatch:
inputs:
Expand Down
Loading