Improved devcontainer setup with e2e test mini infra #23
Workflow file for this run
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: e2e tests | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| concurrency: | |
| group: e2e-tests-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| e2e-tests: | |
| name: e2e tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby_version: ["3.4.5"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up `.env` file | |
| run: | | |
| cd .devcontainer | |
| cp .env.example .env | |
| - name: Start mini rails app | |
| run: | | |
| cd .devcontainer | |
| source .env | |
| echo "π Starting Rails mini app..." | |
| docker compose --profile e2e up -d sentry-rails-mini | |
| echo "π Rails mini app container logs:" | |
| docker compose --profile e2e logs sentry-rails-mini | |
| - name: Start mini svelte app | |
| run: | | |
| cd .devcontainer | |
| source .env | |
| echo "π Starting Svelte mini app..." | |
| docker compose --profile e2e up -d sentry-svelte-mini | |
| echo "π Svelte mini app container logs:" | |
| docker compose --profile e2e logs sentry-svelte-mini | |
| - name: Debug environment and container status | |
| run: | | |
| cd .devcontainer | |
| source .env | |
| echo "π Environment variables:" | |
| echo " SENTRY_E2E_RAILS_APP_URL: $SENTRY_E2E_RAILS_APP_URL" | |
| echo " SENTRY_E2E_SVELTE_APP_URL: $SENTRY_E2E_SVELTE_APP_URL" | |
| echo " SENTRY_E2E_RAILS_APP_PORT: $SENTRY_E2E_RAILS_APP_PORT" | |
| echo " SENTRY_E2E_SVELTE_APP_PORT: $SENTRY_E2E_SVELTE_APP_PORT" | |
| echo "" | |
| echo "π Container status:" | |
| docker compose --profile e2e ps | |
| echo "" | |
| echo "π Container network info:" | |
| docker network ls | |
| echo "" | |
| echo "π Recent container logs:" | |
| echo "--- Rails mini app logs ---" | |
| docker compose --profile e2e logs --tail=20 sentry-rails-mini | |
| echo "--- Svelte mini app logs ---" | |
| docker compose --profile e2e logs --tail=20 sentry-svelte-mini | |
| - name: Health check containers | |
| run: | | |
| cd .devcontainer | |
| source .env | |
| echo "π₯ Testing container connectivity..." | |
| # Test Rails app health from within the test container | |
| echo "Testing Rails app health from sentry-test container:" | |
| docker compose --profile e2e run --rm sentry-test curl -v http://sentry-rails-mini:4000/health || echo "β Rails health check failed" | |
| # Test Svelte app health from within the test container | |
| echo "Testing Svelte app health from sentry-test container:" | |
| docker compose --profile e2e run --rm sentry-test curl -v http://sentry-svelte-mini:4001/health || echo "β Svelte health check failed" | |
| # Test DNS resolution from within the test container | |
| echo "Testing DNS resolution from sentry-test container:" | |
| docker compose --profile e2e run --rm sentry-test nslookup sentry-rails-mini || echo "β Rails DNS resolution failed" | |
| docker compose --profile e2e run --rm sentry-test nslookup sentry-svelte-mini || echo "β Svelte DNS resolution failed" | |
| - name: Wait for services to be fully ready | |
| run: | | |
| cd .devcontainer | |
| source .env | |
| echo "β³ Waiting for services to be fully ready..." | |
| # Wait for Rails app to respond with 200 | |
| 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) | |
| echo "β Rails app is ready" | |
| # Wait for Svelte app to respond with 200 | |
| 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) | |
| echo "β Svelte app is ready" | |
| - name: Run e2e tests | |
| run: | | |
| cd .devcontainer | |
| source .env | |
| docker compose --profile e2e run --rm sentry-test bundle exec rake | |
| - name: Stop e2e services | |
| if: always() | |
| run: | | |
| cd .devcontainer | |
| source .env | |
| docker compose --profile e2e down | |
| - name: Upload test artifacts | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: e2e-test-logs-ruby-${{ matrix.ruby_version }} | |
| path: | | |
| log/sentry_debug_events.log | |
| retention-days: 7 |