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.

chore(ci): cut no-signal trunk uploads, gate rust and storybook (#90158)

Georges-Antoine Assi7c310b6f5173
diff --git a/.github/workflows/ci-ai.yml b/.github/workflows/ci-ai.yml
index eed531dd9feb..182a0505a09e 100644
--- a/.github/workflows/ci-ai.yml
+++ b/.github/workflows/ci-ai.yml
@@ -7,9 +7,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true # We only want one AI CI run per PR concurrently
-env:
- RUNS_ON_INTERNAL_PR: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false }}
-
jobs:
eval:
timeout-minutes: 45
@@ -205,17 +202,3 @@ jobs:
with:
name: junit-results-ai-evals
path: eval-artifacts/*/junit.xml
-
- # Upload results to Trunk for flaky-test detection. Non-gating (continue-on-error),
- # so a Trunk outage never fails the job. Runs the token only on internal PRs
- # and master, never on fork PRs or Dependabot, which have no secret.
- # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
- # this upload skips.
- - name: Upload test results to Trunk
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
- continue-on-error: true
- uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
- with:
- junit-paths: eval-artifacts/*/junit.xml
- org-slug: posthog-inc
- token: ${{ secrets.TRUNK_API_TOKEN }}
diff --git a/.github/workflows/ci-dagster.yml b/.github/workflows/ci-dagster.yml
index 07161835d28c..b37a80f2eabb 100644
--- a/.github/workflows/ci-dagster.yml
+++ b/.github/workflows/ci-dagster.yml
@@ -36,7 +36,6 @@ env:
DISPLAY: ':99.0'
# this is a fake key so this workflow can run for external contributors as they do not have access to secrets (that we don't need here)
OIDC_RSA_PRIVATE_KEY: ${{ vars.OIDC_RSA_FAKE_PRIVATE_KEY }}
- RUNS_ON_INTERNAL_PR: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false }}
jobs:
# Verify the path filter below stays in sync with what dagster files
@@ -707,20 +706,6 @@ jobs:
name: junit-results-dagster-${{ matrix.group }}
path: junit-*.xml
- # Upload results to Trunk for flaky-test detection. Non-gating (continue-on-error),
- # so a Trunk outage never fails the job. Runs the token only on internal PRs
- # and master, never on fork PRs or Dependabot, which have no secret.
- # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
- # this upload skips.
- - name: Upload test results to Trunk
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
- continue-on-error: true
- uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
- with:
- junit-paths: junit-dagster-${{ matrix.group }}.xml
- org-slug: posthog-inc
- token: ${{ secrets.TRUNK_API_TOKEN }}
-
- name: Upload updated timing data as artifacts
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
if: ${{ github.ref == 'refs/heads/master' && always() }}
diff --git a/.github/workflows/ci-llm-gateway.yml b/.github/workflows/ci-llm-gateway.yml
index 461b3bdb336a..9e11539d5af2 100644
--- a/.github/workflows/ci-llm-gateway.yml
+++ b/.github/workflows/ci-llm-gateway.yml
@@ -22,9 +22,6 @@ permissions:
contents: read
pull-requests: read
-env:
- RUNS_ON_INTERNAL_PR: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false }}
-
jobs:
changes:
runs-on: ubuntu-latest
@@ -83,9 +80,6 @@ jobs:
- name: Run tests
id: run-tests
- # continue-on-error so the quarantine gate below is the verdict — it passes when
- # every failure is an already-quarantined flake, fails otherwise.
- continue-on-error: true
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
@@ -103,30 +97,6 @@ jobs:
name: junit-results-llm-gateway
path: services/llm-gateway/junit.xml
- # Best-effort Trunk upload (continue-on-error); the "Fail on test failure" step below is
- # the verdict, so a Trunk outage can't red a passing job. Internal PRs only (needs the
- # secret).
- # TRUNK_UPLOAD_ENABLED is the master kill-switch: when it is not 'true' this gate
- # skips, so nothing uploads and no known flakes are quarantined. TRUNK_QUARANTINE_ENABLED
- # splits the two — it defaults off, so set it to 'true' to let the verdict step below mask
- # known flakes; otherwise any real failure reds the job (quarantining needs upload on too).
- - name: Quarantine gate
- id: quarantine_gate
- continue-on-error: true
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
- uses: ./.github/actions/trunk-quarantine-gate
- with:
- junit-paths: services/llm-gateway/junit.xml
- previous-step-outcome: ${{ steps.run-tests.outcome }}
- token: ${{ secrets.TRUNK_API_TOKEN }}
-
- # Verdict: red a real failure the gate didn't clear as a quarantined flake. != 'success'
- # also covers the skipped gate on fork/Dependabot.
- - name: Fail on test failure
- if: ${{ !cancelled() && steps.run-tests.outcome == 'failure' && (vars.TRUNK_QUARANTINE_ENABLED != 'true' || steps.quarantine_gate.outcome != 'success') }}
- shell: bash
- run: exit 1
-
# Single required status check for branch protection. Add future LLM
# services test jobs to `needs` here rather than reconfiguring GitHub.
llm_services_tests:
diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml
index ea444f5e8e00..1e80ffa00b73 100644
--- a/.github/workflows/ci-python.yml
+++ b/.github/workflows/ci-python.yml
@@ -14,9 +14,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
-env:
- RUNS_ON_INTERNAL_PR: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false }}
-
jobs:
# Job to decide if we should run python ci
# See .github/actions/paths-filter/README.md for filter semantics
@@ -253,20 +250,6 @@ jobs:
name: junit-results-dependency-detection
path: junit-dependency-detection.xml
- # Upload results to Trunk for flaky-test detection. Non-gating (continue-on-error),
- # so a Trunk outage never fails the job. Runs the token only on internal PRs
- # and master, never on fork PRs or Dependabot, which have no secret.
- # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
- # this upload skips.
- - name: Upload test results to Trunk
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
- continue-on-error: true
- uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
- with:
- junit-paths: junit-*.xml
- org-slug: posthog-inc
- token: ${{ secrets.TRUNK_API_TOKEN }}
-
# - name: Check if "taxonomy.json/taxonomy.tsx" is up to date
# if: needs.changes.outputs.python == 'true'
# shell: bash
diff --git a/.github/workflows/ci-rust.yml b/.github/workflows/ci-rust.yml
index 166186d83961..2a78d3e3b5cb 100644
--- a/.github/workflows/ci-rust.yml
+++ b/.github/workflows/ci-rust.yml
@@ -454,17 +454,22 @@ jobs:
run: cargo binstall --no-confirm --force [email protected]
- name: Run cargo test
+ id: run-tests
+ # continue-on-error so the quarantine gate below is the verdict — it passes when
+ # every failure is an already-quarantined flake, fails otherwise.
+ continue-on-error: true
env:
RUST_BACKTRACE: 1
# Set up dual database environment for feature-flags service
PERSONS_READ_DATABASE_URL: ${{ contains(format(' {0} ', matrix.packages), ' feature-flags ') && 'postgres://posthog:posthog@localhost:5432/posthog_persons' || '' }}
PERSONS_WRITE_DATABASE_URL: ${{ contains(format(' {0} ', matrix.packages), ' feature-flags ') && 'postgres://posthog:posthog@localhost:5432/posthog_persons' || '' }}
run: |
- # nextest (instead of plain `cargo test`) emits JUnit XML for the Trunk upload
- # below. It does not run doctests, so those keep running via `cargo test --doc`.
+ # nextest (instead of plain `cargo test`) emits JUnit XML for the Trunk quarantine
+ # gate below. It does not run doctests; those run in their own step, outside the
+ # gate, because they emit no JUnit and so could never be cleared as quarantined.
# --no-tests=pass matches `cargo test` semantics for packages/filters with no tests.
# Each run overwrites target/nextest/ci/junit.xml, so stash it per package —
- # even on failure, so the failing results still reach Trunk before we exit.
+ # even on failure, so the failing results still reach Trunk.
run_nextest() {
local junit_name=$1
shift
@@ -475,6 +480,10 @@ jobs:
fi
return $rc
}
+ # Keep testing the remaining packages after a failure: the gate masks a shard
+ # only from its JUnit files, so every package must contribute its results —
+ # an early exit would let a masked failure skip the packages behind it.
+ overall_rc=0
for pkg in ${{ matrix.packages }}; do
echo "::group::Testing $pkg"
# Free cgroups, overlayfs, and network namespaces from previous testcontainers
@@ -485,14 +494,9 @@ jobs:
extra_args="--test-threads=4"
fi
if [ "$pkg" = "cohort-seeder" ] && [ -f cohort-seeder/Cargo.toml ] && grep -q '^pg-test-support[[:space:]]*=' cohort-seeder/Cargo.toml; then
- DATABASE_URL='postgres://posthog:posthog@localhost:5432/test_posthog' run_nextest "$pkg" -p "$pkg" --features pg-test-support $extra_args
+ DATABASE_URL='postgres://posthog:posthog@localhost:5432/test_posthog' run_nextest "$pkg" -p "$pkg" --features pg-test-support $extra_args || overall_rc=1
else
- run_nextest "$pkg" -p "$pkg" $extra_args
- fi
- # nextest skips doctests; run them only for packages with a lib target
- # (`cargo test --doc` errors on bin-only packages).
- if cargo metadata --no-deps --format-version 1 | jq -e --arg p "$pkg" '[.packages[] | select(.name == $p) | .targets[] | select(.kind | index("lib"))] | length > 0' >/dev/null; then
- cargo test --doc -p "$pkg"
+ run_nextest "$pkg" -p "$pkg" $extra_args || overall_rc=1
fi
# Error-tracking rate-limiter e2e tests are #[ignore]'d (they need a real Redis
# via testcontainers/Docker, absent in some environments). This job has Docker,
@@ -500,7 +504,7 @@ jobs:
# `rate_limiting` filter matches nothing on branches without these tests, so it
# stays safe for unrebased PRs.
if [ "$pkg" = "cymbal" ]; then
- run_nextest cymbal-ignored -p cymbal -E 'test(rate_limiting)' --run-ignored only --test-threads=1
+ run_nextest cymbal-ignored -p cymbal -E 'test(rate_limiting)' --run-ignored only --test-threads=1 || overall_rc=1
fi
# usage-ingestion's e2e tests are #[ignore]'d (they need Kafka and ClickHouse).
# This job has both, on the suffixed schema `setup_test_environment` created.
@@ -510,25 +514,52 @@ jobs:
USAGE_INGESTION_E2E_CLICKHOUSE_DATABASE=posthog_test \
USAGE_INGESTION_E2E_TOPIC=clickhouse_billing_usage_records_test \
USAGE_INGESTION_E2E_LOAD_REQUESTS=2000 \
- run_nextest usage-ingestion-ignored -p usage-ingestion --run-ignored only --test-threads=1
+ run_nextest usage-ingestion-ignored -p usage-ingestion --run-ignored only --test-threads=1 || overall_rc=1
fi
echo "::endgroup::"
done
+ exit $overall_rc
- # Upload results to Trunk for flaky-test detection. Non-gating (continue-on-error),
- # so a Trunk outage never fails the job. Runs the token only on internal PRs
- # and master, never on fork PRs or Dependabot, which have no secret.
- # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
- # this upload skips.
- - name: Upload test results to Trunk
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
+ # Doctests fail the job directly: they emit no JUnit, so the quarantine gate
+ # below can neither see nor mask them.
+ - name: Run doctests
+ env:
+ RUST_BACKTRACE: 1
+ PERSONS_READ_DATABASE_URL: ${{ contains(format(' {0} ', matrix.packages), ' feature-flags ') && 'postgres://posthog:posthog@localhost:5432/posthog_persons' || '' }}
+ PERSONS_WRITE_DATABASE_URL: ${{ contains(format(' {0} ', matrix.packages), ' feature-flags ') && 'postgres://posthog:posthog@localhost:5432/posthog_persons' || '' }}
+ run: |
+ for pkg in ${{ matrix.packages }}; do
+ # nextest skips doctests; run them only for packages with a lib target
+ # (`cargo test --doc` errors on bin-only packages).
+ if cargo metadata --no-deps --format-version 1 | jq -e --arg p "$pkg" '[.packages[] | select(.name == $p) | .targets[] | select(.kind | index("lib"))] | length > 0' >/dev/null; then
+ cargo test --doc -p "$pkg"
+ fi
+ done
+
+ # Best-effort Trunk upload (continue-on-error); the "Fail on test failure" step below is
+ # the verdict, so a Trunk outage can't red a passing job. Internal PRs only (needs the
+ # secret).
+ # TRUNK_UPLOAD_ENABLED is the master kill-switch: when it is not 'true' this gate
+ # skips, so nothing uploads and no known flakes are quarantined. TRUNK_QUARANTINE_ENABLED
+ # splits the two — it defaults off, so set it to 'true' to let the verdict step below mask
+ # known flakes; otherwise any real failure reds the job (quarantining needs upload on too).
+ - name: Quarantine gate
+ id: quarantine_gate
continue-on-error: true
- uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
+ if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
+ uses: ./.github/actions/trunk-quarantine-gate
with:
junit-paths: rust/junit-nextest-*.xml
- org-slug: posthog-inc
+ previous-step-outcome: ${{ steps.run-tests.outcome }}
token: ${{ secrets.TRUNK_API_TOKEN }}
+ # Verdict: red a real failure the gate didn't clear as a quarantined flake. != 'success'
+ # also covers the skipped gate on fork/Dependabot.
+ - name: Fail on test failure
+ if: ${{ !cancelled() && steps.run-tests.outcome == 'failure' && (vars.TRUNK_QUARANTINE_ENABLED != 'true' || steps.quarantine_gate.outcome != 'success') }}
+ shell: bash
+ run: exit 1
+
# Spawns a real personhog stack (replica, writer, leaders, leader-mode
# routers) against dockerized Postgres/Kafka/etcd and asserts that every
# write acked by the leader path is visible afterwards — in strong reads
diff --git a/.github/workflows/ci-storybook.yml b/.github/workflows/ci-storybook.yml
index c25ab090a809..7244581235ba 100644
--- a/.github/workflows/ci-storybook.yml
+++ b/.github/workflows/ci-storybook.yml
@@ -22,6 +22,9 @@ concurrency:
permissions:
contents: read
+env:
+ RUNS_ON_INTERNAL_PR: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false }}
+
jobs:
# Job to decide if we should run storybook ci
# See .github/actions/paths-filter/README.md for filter semantics
@@ -533,6 +536,9 @@ jobs:
# Capture-only: VR is the gate for visual changes, jest just captures screenshots
- name: Run @storybook/test-runner
id: test-runner
+ # continue-on-error so the quarantine gate below is the verdict — it passes when
+ # every failure is an already-quarantined flake, fails otherwise.
+ continue-on-error: true
shell: bash
env:
HOME: /root
@@ -592,6 +598,34 @@ jobs:
if-no-files-found: ignore
retention-days: 1
+ # Best-effort Trunk upload (continue-on-error); the "Fail on test-runner failure" step
+ # below is the verdict, so a Trunk outage can't red a passing shard. Internal PRs only
+ # (needs the secret).
+ # TRUNK_UPLOAD_ENABLED is the master kill-switch: when it is not 'true' this gate
+ # skips, so nothing uploads and no known flakes are quarantined. TRUNK_QUARANTINE_ENABLED
+ # splits the two — it defaults off, so set it to 'true' to let the verdict step below mask
+ # known flakes; otherwise any real failure reds the job (quarantining needs upload on too).
+ # chromium and webkit run the same stories, so each browser uploads under its own Trunk
+ # variant — one test id for both browsers would make a browser-specific failure look
+ # like a flake.
+ - name: Quarantine gate
+ id: quarantine_gate
+ continue-on-error: true
+ if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
+ uses: ./.github/actions/trunk-quarantine-gate
+ with:
+ junit-paths: common/storybook/junit.xml
+ variant: ${{ matrix.browser }}
+ previous-step-outcome: ${{ steps.test-runner.outcome }}
+ token: ${{ secrets.TRUNK_API_TOKEN }}
+
+ # Verdict: red a real failure the gate didn't clear as a quarantined flake. != 'success'
+ # also covers the skipped gate on fork/Dependabot.
+ - name: Fail on test-runner failure
+ if: ${{ !cancelled() && steps.test-runner.outcome == 'failure' && (vars.TRUNK_QUARANTINE_ENABLED != 'true' || steps.quarantine_gate.outcome != 'success') }}
+ shell: bash
+ run: exit 1
+
# Verify changed story files are stable by re-running them multiple times.
# Catches flaky snapshots before they land on master.
flake-verification:
@@ -1110,47 +1144,3 @@ jobs:
EOF
echo "SELECTION_METRICS: $(echo "$RESULT" | jq -c '{mode, reason, total: .total_story_count}')"
fi
-
- trunk-upload:
- name: Upload test results to Trunk
- # visual-regression shards already emit and upload junit-results-storybook-* artifacts;
- # this feeds them to Trunk (flaky-test detection) once. Trusted non-pull_request events
- # only (master push), so the secret token never runs in a PR-controlled context; the
- # uploader is a pinned external action, not a local one.
- needs: [visual-regression]
- runs-on: ubuntu-latest
- continue-on-error: true
- timeout-minutes: 10
- # Avoid spinning a runner when visual-regression was skipped, while still
- # uploading failed-test results (the flake signal Trunk needs) on master push.
- # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
- # this job skips, so no results upload.
- if: always() && github.repository == 'PostHog/posthog' && github.event_name != 'pull_request' && needs.visual-regression.result != 'skipped' && vars.TRUNK_UPLOAD_ENABLED == 'true'
- steps:
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- with:
- fetch-depth: 1
- persist-credentials: false
- - name: Download JUnit artifacts
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v6.0.0
- continue-on-error: true
- with:
- path: ./junit-artifacts
- pattern: junit-results-storybook-*
- # chromium and webkit run the same stories, so a single upload would give one test id
- # both browsers' outcomes and a browser-specific failure would look like a flake.
- # Upload each browser under its own Trunk variant to keep their histories distinct.
- - name: Upload chromium results to Trunk
- uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
- with:
- junit-paths: junit-artifacts/junit-results-storybook-chromium-*/*.xml
- org-slug: posthog-inc
- variant: chromium
- token: ${{ secrets.TRUNK_API_TOKEN }}
- - name: Upload webkit results to Trunk
- uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
- with:
- junit-paths: junit-artifacts/junit-results-storybook-webkit-*/*.xml
- org-slug: posthog-inc
- variant: webkit
- token: ${{ secrets.TRUNK_API_TOKEN }}
diff --git a/.github/workflows/desktop-ci.yml b/.github/workflows/desktop-ci.yml
index 4786628828e5..e8f8ad6b9435 100644
--- a/.github/workflows/desktop-ci.yml
+++ b/.github/workflows/desktop-ci.yml
@@ -49,7 +49,6 @@ jobs:
GH_APP_POSTHOG_PATHS_FILTER_PRIVATE_KEY: ${{ secrets.GH_APP_POSTHOG_PATHS_FILTER_PRIVATE_KEY }}
POSTHOG_CODE_E2E_GATEWAY_PERSONAL_API_KEY: ${{ secrets.POSTHOG_CODE_E2E_GATEWAY_PERSONAL_API_KEY }}
POSTHOG_CODE_E2E_GATEWAY_URL: ${{ secrets.POSTHOG_CODE_E2E_GATEWAY_URL }}
- TRUNK_API_TOKEN: ${{ secrets.TRUNK_API_TOKEN }}
# Desktop counterpart of the migration/service separation check (see the
# script header for why). Lives here rather than pr-housekeeping so the
diff --git a/.github/workflows/desktop-test.yml b/.github/workflows/desktop-test.yml
index 385df7c84c75..ca64c2bfcb2d 100644
--- a/.github/workflows/desktop-test.yml
+++ b/.github/workflows/desktop-test.yml
@@ -11,8 +11,6 @@ on:
required: false
POSTHOG_CODE_E2E_GATEWAY_URL:
required: false
- TRUNK_API_TOKEN:
- required: false
push:
branches: [master]
paths:
@@ -23,9 +21,6 @@ concurrency:
group: desktop-test-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
-env:
- RUNS_ON_INTERNAL_PR: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false }}
-
jobs:
changes:
runs-on: ubuntu-latest
@@ -129,38 +124,8 @@ jobs:
- name: Run tests
id: run-tests
- # continue-on-error so the quarantine gate below is the verdict — it passes when
- # every failure is an already-quarantined flake, fails otherwise.
- continue-on-error: true
run: pnpm test
- # Best-effort Trunk upload (continue-on-error); the "Fail on test failure" step below is
- # the verdict, so a Trunk outage can't red a passing job. Internal PRs only (needs the
- # secret).
- # TRUNK_UPLOAD_ENABLED is the master kill-switch: when it is not 'true' this gate
- # skips, so nothing uploads and no known flakes are quarantined. TRUNK_QUARANTINE_ENABLED
- # splits the two — it defaults off, so set it to 'true' to let the verdict step below mask
- # known flakes; otherwise any real failure reds the job (quarantining needs upload on too).
- - name: Quarantine gate
- id: quarantine_gate
- continue-on-error: true
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
- uses: ./.github/actions/trunk-quarantine-gate
- with:
- # Scope to each package root. A bare **/junit.xml glob descends into
- # node_modules, where pnpm symlinks workspace packages, and uploads
- # every report many times over.
- junit-paths: 'products/desktop/apps/*/junit.xml,products/desktop/packages/*/junit.xml'
- previous-step-outcome: ${{ steps.run-tests.outcome }}
- token: ${{ secrets.TRUNK_API_TOKEN }}
-
- # Verdict: red a real failure the gate didn't clear as a quarantined flake. != 'success'
- # also covers the skipped gate on fork/Dependabot.
- - name: Fail on test failure
- if: ${{ !cancelled() && steps.run-tests.outcome == 'failure' && (vars.TRUNK_QUARANTINE_ENABLED != 'true' || steps.quarantine_gate.outcome != 'success') }}
- shell: bash
- run: exit 1
-
integration-test:
needs: changes
# Fail closed: if change detection itself failed, run instead of skipping.
@@ -240,30 +205,13 @@ jobs:
- name: Run E2E smoke tests
id: run-e2e
- # continue-on-error so the quarantine gate below is the verdict — it passes when
- # every failure is an already-quarantined flake, fails otherwise.
+ # continue-on-error so the web host below still runs and the "Fail on E2E failure"
+ # step at the end is the verdict for both hosts.
continue-on-error: true
run: pnpm --filter code run test:e2e
env:
CI: true
- # Best-effort Trunk upload (continue-on-error); the "Fail on E2E failure" step below is
- # the verdict, so a Trunk outage can't red a passing job. Internal PRs only (needs the
- # secret).
- # TRUNK_UPLOAD_ENABLED is the master kill-switch: when it is not 'true' this gate
- # skips, so nothing uploads and no known flakes are quarantined. TRUNK_QUARANTINE_ENABLED
- # splits the two — it defaults off, so set it to 'true' to let the verdict step below mask
- # known flakes; otherwise any real failure reds the job (quarantining needs upload on too).
- - name: Quarantine gate
- id: quarantine_gate
- continue-on-error: true
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
- uses: ./.github/actions/trunk-quarantine-gate
- with:
- junit-paths: 'products/desktop/apps/code/tests/e2e/junit.xml'
- previous-step-outcome: ${{ steps.run-e2e.outcome }}
- token: ${{ secrets.TRUNK_API_TOKEN }}
-
- name: Upload Playwright report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
# Keys off the step outcome, not failure(): the test step is continue-on-error, so a
@@ -285,16 +233,6 @@ jobs:
env:
CI: true
- - name: Quarantine gate (web)
- id: quarantine_gate_web
- continue-on-error: true
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
- uses: ./.github/actions/trunk-quarantine-gate
- with:
- junit-paths: 'products/desktop/apps/web/tests/e2e/junit.xml'
- previous-step-outcome: ${{ steps.run-web-e2e.outcome }}
- token: ${{ secrets.TRUNK_API_TOKEN }}
-
- name: Upload web Playwright report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() && steps.run-web-e2e.outcome == 'failure' }}
@@ -303,11 +241,9 @@ jobs:
path: products/desktop/apps/web/playwright-report/
retention-days: 7
- # Verdict: red a real failure neither gate cleared as a quarantined flake. != 'success'
- # also covers a skipped gate on fork/Dependabot. Both hosts report independently, so
- # either one failing is enough to red the job.
+ # Both hosts report independently, so either one failing is enough to red the job.
- name: Fail on E2E failure
- if: ${{ !cancelled() && ((steps.run-e2e.outcome == 'failure' && (vars.TRUNK_QUARANTINE_ENABLED != 'true' || steps.quarantine_gate.outcome != 'success')) || (steps.run-web-e2e.outcome == 'failure' && (vars.TRUNK_QUARANTINE_ENABLED != 'true' || steps.quarantine_gate_web.outcome != 'success'))) }}
+ if: ${{ !cancelled() && (steps.run-e2e.outcome == 'failure' || steps.run-web-e2e.outcome == 'failure') }}
shell: bash
run: exit 1