|
| 1 | +name: e2e tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + pull_request: |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: e2e-tests-${{ github.head_ref || github.run_id }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + e2e-tests: |
| 16 | + name: e2e tests |
| 17 | + runs-on: ubuntu-latest |
| 18 | + timeout-minutes: 5 |
| 19 | + |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + ruby_version: ["3.4.5"] |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout code |
| 27 | + uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - name: Set up `.env` file |
| 30 | + run: | |
| 31 | + cd .devcontainer |
| 32 | + cp .env.example .env |
| 33 | +
|
| 34 | + - name: Start mini rails app |
| 35 | + run: | |
| 36 | + cd .devcontainer |
| 37 | + source .env |
| 38 | + echo "🚀 Starting Rails mini app..." |
| 39 | + docker compose --profile e2e up -d sentry-rails-mini |
| 40 | + echo "📋 Rails mini app container logs:" |
| 41 | + docker compose --profile e2e logs sentry-rails-mini |
| 42 | +
|
| 43 | + - name: Start mini svelte app |
| 44 | + run: | |
| 45 | + cd .devcontainer |
| 46 | + source .env |
| 47 | + echo "🚀 Starting Svelte mini app..." |
| 48 | + docker compose --profile e2e up -d sentry-svelte-mini |
| 49 | + echo "📋 Svelte mini app container logs:" |
| 50 | + docker compose --profile e2e logs sentry-svelte-mini |
| 51 | +
|
| 52 | + - name: Debug environment and container status |
| 53 | + run: | |
| 54 | + cd .devcontainer |
| 55 | + source .env |
| 56 | + echo "🔍 Environment variables:" |
| 57 | + echo " SENTRY_E2E_RAILS_APP_URL: $SENTRY_E2E_RAILS_APP_URL" |
| 58 | + echo " SENTRY_E2E_SVELTE_APP_URL: $SENTRY_E2E_SVELTE_APP_URL" |
| 59 | + echo " SENTRY_E2E_RAILS_APP_PORT: $SENTRY_E2E_RAILS_APP_PORT" |
| 60 | + echo " SENTRY_E2E_SVELTE_APP_PORT: $SENTRY_E2E_SVELTE_APP_PORT" |
| 61 | + echo "" |
| 62 | + echo "📊 Container status:" |
| 63 | + docker compose --profile e2e ps |
| 64 | + echo "" |
| 65 | + echo "🌐 Container network info:" |
| 66 | + docker network ls |
| 67 | + echo "" |
| 68 | + echo "📋 Recent container logs:" |
| 69 | + echo "--- Rails mini app logs ---" |
| 70 | + docker compose --profile e2e logs --tail=20 sentry-rails-mini |
| 71 | + echo "--- Svelte mini app logs ---" |
| 72 | + docker compose --profile e2e logs --tail=20 sentry-svelte-mini |
| 73 | +
|
| 74 | + - name: Health check containers |
| 75 | + run: | |
| 76 | + cd .devcontainer |
| 77 | + source .env |
| 78 | + echo "🏥 Testing container connectivity..." |
| 79 | +
|
| 80 | + # Test Rails app health from within the test container |
| 81 | + echo "Testing Rails app health from sentry-test container:" |
| 82 | + docker compose --profile e2e run --rm sentry-test curl -v http://sentry-rails-mini:4000/health || echo "❌ Rails health check failed" |
| 83 | +
|
| 84 | + # Test Svelte app health from within the test container |
| 85 | + echo "Testing Svelte app health from sentry-test container:" |
| 86 | + docker compose --profile e2e run --rm sentry-test curl -v http://sentry-svelte-mini:4001/health || echo "❌ Svelte health check failed" |
| 87 | +
|
| 88 | + # Test DNS resolution from within the test container |
| 89 | + echo "Testing DNS resolution from sentry-test container:" |
| 90 | + docker compose --profile e2e run --rm sentry-test nslookup sentry-rails-mini || echo "❌ Rails DNS resolution failed" |
| 91 | + docker compose --profile e2e run --rm sentry-test nslookup sentry-svelte-mini || echo "❌ Svelte DNS resolution failed" |
| 92 | +
|
| 93 | + - name: Wait for services to be fully ready |
| 94 | + run: | |
| 95 | + cd .devcontainer |
| 96 | + source .env |
| 97 | + echo "⏳ Waiting for services to be fully ready..." |
| 98 | +
|
| 99 | + # Wait for Rails app to respond with 200 |
| 100 | + timeout 60 bash -c 'until docker compose --profile e2e run --rm sentry-test curl -s -o /dev/null -w "%{http_code}" http://sentry-rails-mini:4000/health | grep -q "200"; do echo "Waiting for Rails app..."; sleep 2; done' || (echo "❌ Rails app failed to become ready" && exit 1) |
| 101 | + echo "✅ Rails app is ready" |
| 102 | +
|
| 103 | + # Wait for Svelte app to respond with 200 |
| 104 | + timeout 60 bash -c 'until docker compose --profile e2e run --rm sentry-test curl -s -o /dev/null -w "%{http_code}" http://sentry-svelte-mini:4001/health | grep -q "200"; do echo "Waiting for Svelte app..."; sleep 2; done' || (echo "❌ Svelte app failed to become ready" && exit 1) |
| 105 | + echo "✅ Svelte app is ready" |
| 106 | +
|
| 107 | + - name: Run e2e tests |
| 108 | + run: | |
| 109 | + cd .devcontainer |
| 110 | + source .env |
| 111 | + docker compose --profile e2e run --rm sentry-test bundle exec rake |
| 112 | +
|
| 113 | + - name: Stop e2e services |
| 114 | + if: always() |
| 115 | + run: | |
| 116 | + cd .devcontainer |
| 117 | + source .env |
| 118 | + docker compose --profile e2e down |
| 119 | +
|
| 120 | + - name: Upload test artifacts |
| 121 | + if: failure() |
| 122 | + uses: actions/upload-artifact@v4 |
| 123 | + with: |
| 124 | + name: e2e-test-logs-ruby-${{ matrix.ruby_version }} |
| 125 | + path: | |
| 126 | + log/sentry_debug_events.log |
| 127 | + retention-days: 7 |
0 commit comments