Improved devcontainer setup with e2e test mini infra #36
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: Build sentry-test-services | |
| run: | | |
| docker compose \ | |
| --file .devcontainer/docker-compose.yml \ | |
| --env-file .devcontainer/.env \ | |
| build sentry-test-services | |
| - name: Start test services | |
| run: | | |
| docker compose \ | |
| --file .devcontainer/docker-compose.yml \ | |
| --env-file .devcontainer/.env \ | |
| up -d sentry-test-services | |
| - 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 90 bash -c 'until docker compose --profile e2e run --rm sentry-test curl -s -o /dev/null -w "%{http_code}" http://sentry-test-services: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 90 bash -c 'until docker compose --profile e2e run --rm sentry-test curl -s -o /dev/null -w "%{http_code}" http://sentry-test-services: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: Build sentry-test | |
| run: | | |
| docker compose \ | |
| --file .devcontainer/docker-compose.yml \ | |
| --env-file .devcontainer/.env \ | |
| build sentry-test | |
| - name: Run e2e tests via sentry-test | |
| run: | | |
| docker compose \ | |
| --file .devcontainer/docker-compose.yml \ | |
| --env-file .devcontainer/.env \ | |
| 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 | |
| - # Temp fix | |
| # https://github.com/docker/build-push-action/issues/252 | |
| # https://github.com/moby/buildkit/issues/1896 | |
| name: Move cache | |
| run: | | |
| rm -rf ${{ runner.temp }}/.buildx-cache | |
| mv ${{ runner.temp }}/.buildx-cache-new ${{ runner.temp }}/.buildx-cache |