Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

perf(ci): skip static compression in e2e (#89300)

Raúl Negrón-Oterod213500a7c0d
diff --git a/.github/workflows/ci-e2e-playwright.yml b/.github/workflows/ci-e2e-playwright.yml
index fdb74784822d..c2542602639a 100644
--- a/.github/workflows/ci-e2e-playwright.yml
+++ b/.github/workflows/ci-e2e-playwright.yml
@@ -738,11 +738,13 @@ jobs:
pnpm --filter=@posthog/frontend build:products
pnpm --filter=@posthog/frontend build
- - name: Collect static files
+ - name: Collect static files without compression
# The image-bitmap-data-url-worker-*.js.map files are already mirrored
# into frontend/dist/ by copyRRWebWorkerFiles() in frontend/build.mjs
# (see common/esbuilder/utils.mjs), which runs as part of the
# `pnpm --filter=@posthog/frontend build` step above. No extra cp needed.
+ env:
+ STATIC_PRECOMPRESS: '0'
run: python manage.py collectstatic --noinput
- name: Create test database
shell: bash
diff --git a/posthog/settings/web.py b/posthog/settings/web.py
index fe71d7dbf449..779643bda0a0 100644
--- a/posthog/settings/web.py
+++ b/posthog/settings/web.py
@@ -445,21 +445,21 @@ if DEBUG:
# a second source for 1300+ identical assets would make collectstatic warn about
# duplicate destinations for no gain.
STATICFILES_DIRS.append(os.path.join(BASE_DIR, "frontend/public"))
+
+# WhiteNoise serves precompressed files when present, so this only controls collectstatic output.
+if TEST:
+ _staticfiles_storage_backend = "django.contrib.staticfiles.storage.StaticFilesStorage"
+elif get_from_env("STATIC_PRECOMPRESS", True, type_cast=str_to_bool):
+ _staticfiles_storage_backend = "whitenoise.storage.CompressedManifestStaticFilesStorage"
+else:
+ _staticfiles_storage_backend = "whitenoise.storage.ManifestStaticFilesStorage"
+
STORAGES = {
"default": {
"BACKEND": "django.core.files.storage.FileSystemStorage",
},
"staticfiles": {
- # CompressedManifest: collectstatic pre-generates .br and .gz (brotli is
- # already a dependency) so WhiteNoise serves compressed bytes from disk and
- # the envoy edge — which otherwise gzips static per request (Contour's
- # default compression filter) — skips recompression since Content-Encoding
- # is already set. Same Manifest base class: hashed names unchanged.
- "BACKEND": (
- "django.contrib.staticfiles.storage.StaticFilesStorage"
- if TEST
- else "whitenoise.storage.CompressedManifestStaticFilesStorage"
- ),
+ "BACKEND": _staticfiles_storage_backend,
},
}
# Never emit .map.gz/.map.br: the production image deletes *.map after the