feat(data-collection): Port Rails log subscriber #1392
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: | |
| permissions: | |
| contents: read | |
| packages: read | |
| concurrency: | |
| group: e2e-tests-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| e2e-tests: | |
| name: e2e tests (ruby ${{ matrix.ruby.flavor }}, ${{ matrix.adapter }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 8 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby: | |
| - version: "3.4.9" | |
| flavor: "3.4" | |
| - version: "4.0.3" | |
| flavor: "4.0" | |
| adapter: | |
| - async | |
| - inline | |
| - sidekiq | |
| - resque | |
| - delayed_job | |
| - solid_queue | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Read devcontainer version | |
| id: devcontainer-version | |
| run: echo "version=$(cat .devcontainer/VERSION)" >> $GITHUB_OUTPUT | |
| - name: Set up `.env` file | |
| run: | | |
| cd .devcontainer | |
| cp .env.example .env | |
| echo "SENTRY_E2E_ACTIVE_JOB_ADAPTER=${{ matrix.adapter }}" >> .env | |
| - name: Log in to GHCR | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pull test container image | |
| run: docker pull ghcr.io/getsentry/sentry-ruby-devcontainer-${{ matrix.ruby.flavor }}:${{ steps.devcontainer-version.outputs.version }} | |
| - name: Prepare docker resources | |
| run: | | |
| bundle_volume="sentry-ruby-e2e-bundle-${{ github.run_id }}-${{ matrix.ruby.flavor }}-${{ matrix.adapter }}" | |
| test_container="sentry-ruby-e2e-test-${{ github.run_id }}-${{ matrix.ruby.flavor }}-${{ matrix.adapter }}" | |
| echo "E2E_BUNDLE_VOLUME=${bundle_volume}" >> "$GITHUB_ENV" | |
| echo "E2E_TEST_CONTAINER=${test_container}" >> "$GITHUB_ENV" | |
| docker volume create "${bundle_volume}" | |
| - name: Restore node_modules cache | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: spec/apps/svelte-mini/node_modules | |
| key: ${{ runner.os }}-${{ runner.arch }}-node-modules-${{ hashFiles('spec/apps/svelte-mini/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ runner.arch }}-node-modules- | |
| - name: Set up test container | |
| run: | | |
| docker run --rm \ | |
| --env-file .devcontainer/.env \ | |
| --env BUNDLE_PATH=/home/sentry/bundle \ | |
| --env MISE_RUBY_VERSION=${{ matrix.ruby.version }} \ | |
| --volume "${PWD}:/workspaces/sentry-ruby" \ | |
| --volume "${E2E_BUNDLE_VOLUME}:/home/sentry/bundle" \ | |
| "ghcr.io/getsentry/sentry-ruby-devcontainer-${{ matrix.ruby.flavor }}:${{ steps.devcontainer-version.outputs.version }}" \ | |
| .devcontainer/ci-run .devcontainer/setup --only .,spec/apps/rails-mini | |
| - name: Start test services | |
| run: | | |
| docker run -d \ | |
| --name "${E2E_TEST_CONTAINER}" \ | |
| --publish 4000:4000 \ | |
| --publish 4001:4001 \ | |
| --env-file .devcontainer/.env \ | |
| --env BUNDLE_PATH=/home/sentry/bundle \ | |
| --env MISE_RUBY_VERSION=${{ matrix.ruby.version }} \ | |
| --volume "${PWD}:/workspaces/sentry-ruby" \ | |
| --volume "${E2E_BUNDLE_VOLUME}:/home/sentry/bundle" \ | |
| "ghcr.io/getsentry/sentry-ruby-devcontainer-${{ matrix.ruby.flavor }}:${{ steps.devcontainer-version.outputs.version }}" \ | |
| .devcontainer/ci-run mise run e2e:serve | |
| # Poll from the runner host, not a container action: the apps' ports are | |
| # published to the host (`--publish`), so `localhost` here reaches them, | |
| # whereas a Docker container action's `localhost` is its own container. | |
| - name: "Wait for rails-mini app to be ready" | |
| run: | | |
| for _ in $(seq 1 180); do | |
| if curl -sf http://localhost:4000/health >/dev/null; then | |
| echo "rails-mini is ready" | |
| exit 0 | |
| fi | |
| sleep 1 | |
| done | |
| echo "❌ rails-mini did not become ready in time" >&2 | |
| docker logs "${E2E_TEST_CONTAINER}" 2>&1 | tail -n 200 || true | |
| exit 1 | |
| - name: "Wait for svelte-mini app to be ready" | |
| run: | | |
| for _ in $(seq 1 180); do | |
| if curl -sf http://localhost:4001/health >/dev/null; then | |
| echo "svelte-mini is ready" | |
| exit 0 | |
| fi | |
| sleep 1 | |
| done | |
| echo "❌ svelte-mini did not become ready in time" >&2 | |
| docker logs "${E2E_TEST_CONTAINER}" 2>&1 | tail -n 200 || true | |
| exit 1 | |
| - name: Run e2e tests via sentry-test | |
| run: | | |
| docker exec "${E2E_TEST_CONTAINER}" bundle exec rake | |
| - name: Dump service logs | |
| if: failure() | |
| run: | | |
| echo "===== docker ps -a =====" | |
| docker ps -a | |
| echo "===== test container logs =====" | |
| docker logs "${E2E_TEST_CONTAINER}" 2>&1 || true | |
| - name: Stop e2e services | |
| if: always() | |
| run: | | |
| docker rm -f "${E2E_TEST_CONTAINER}" 2>/dev/null || true | |
| docker volume rm "${E2E_BUNDLE_VOLUME}" 2>/dev/null || true | |
| - name: Upload test artifacts | |
| if: failure() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: e2e-test-logs-ruby-${{ matrix.ruby.version }}-${{ matrix.adapter }} | |
| path: | | |
| log/sentry_debug_events.log | |
| retention-days: 7 |