Adds Sentry error tracking, performance monitoring, and session replay: - Environment-based sampling: production 10%, preview/dev 100% - Session replay with full privacy masking (text, media, inputs) - Hashed MXID as anonymous user ID with homeserver tag - Error rate limiting (50 events/session) to protect quota Performance spans and metrics across all critical paths: auth login, message send, timeline jump-load, per-event decryption, sliding sync cycles, key backup, store wipe, UTD failures, sync degradation, background notification clients, media uploads. Developer settings panel (Settings → General → Diagnostics & Privacy): error reporting toggle, session replay opt-in, breadcrumb category controls, debug log export. Crash page shows Sentry event ID with one-click feedback dialog. Bug report modal sends structured reports to Sentry feedback API with optional debug log attachment. CI: Sentry env vars injected into preview (100% sampling) and production (10% sampling) builds. Source maps uploaded via @sentry/vite-plugin.
105 lines
3.6 KiB
YAML
105 lines
3.6 KiB
YAML
name: Cloudflare Infra
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'infra/web/**'
|
|
- '.github/workflows/cloudflare-web-deploy.yml'
|
|
- '.github/actions/prepare-tofu/**'
|
|
- '.github/actions/setup/**'
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
git_tag:
|
|
description: 'Git tag to deploy (e.g. v1.2.3). Leave empty to deploy current HEAD.'
|
|
required: false
|
|
type: string
|
|
|
|
env:
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.TF_CLOUDFLARE_API_TOKEN }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
TF_VAR_workers_message: ${{ github.event_name == 'pull_request' && github.event.pull_request.title || github.event.head_commit.message || github.sha }}
|
|
TF_VAR_account_id: ${{ secrets.TF_VAR_ACCOUNT_ID }}
|
|
TF_VAR_zone_id: ${{ secrets.TF_VAR_ZONE_ID }}
|
|
TF_HTTP_ADDRESS: ${{ secrets.TF_HTTP_ADDRESS }}
|
|
TF_HTTP_LOCK_ADDRESS: ${{ secrets.TF_HTTP_LOCK_ADDRESS }}
|
|
TF_HTTP_UNLOCK_ADDRESS: ${{ secrets.TF_HTTP_UNLOCK_ADDRESS }}
|
|
TF_HTTP_USERNAME: ${{ secrets.TF_HTTP_USERNAME }}
|
|
TF_HTTP_PASSWORD: ${{ secrets.TF_HTTP_PASSWORD }}
|
|
TF_HTTP_LOCK_METHOD: 'POST'
|
|
TF_HTTP_UNLOCK_METHOD: 'DELETE'
|
|
TF_HTTP_RETRY_WAIT_MIN: '5'
|
|
|
|
concurrency:
|
|
group: cloudflare-infra
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
plan:
|
|
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
defaults:
|
|
run:
|
|
working-directory: infra/web
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Prepare OpenTofu deployment
|
|
uses: ./.github/actions/prepare-tofu
|
|
with:
|
|
is_release_tag: ${{ startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && inputs.git_tag != '') }}
|
|
env:
|
|
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
|
|
VITE_SENTRY_ENVIRONMENT: production
|
|
VITE_APP_VERSION: ${{ github.ref_name }}
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
|
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
|
|
|
- name: Comment PR plan
|
|
uses: dflook/tofu-plan@3f5dc358343fb58cd60f83b019e810315aa8258f # v2.2.3
|
|
with:
|
|
path: infra/web
|
|
label: production
|
|
|
|
apply:
|
|
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || github.event_name == 'workflow_dispatch'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
defaults:
|
|
run:
|
|
working-directory: infra/web
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.git_tag || '' }}
|
|
|
|
- name: Prepare OpenTofu deployment
|
|
uses: ./.github/actions/prepare-tofu
|
|
with:
|
|
is_release_tag: ${{ startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && inputs.git_tag != '') }}
|
|
env:
|
|
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
|
|
VITE_SENTRY_ENVIRONMENT: production
|
|
VITE_APP_VERSION: ${{ github.ref_name }}
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
|
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
|
|
|
- name: Plan infrastructure
|
|
run: tofu plan -input=false -no-color
|
|
|
|
- name: Apply infrastructure
|
|
run: tofu apply -input=false -auto-approve
|