Skip to content

[build-tools] Add eas/posthog_upload_sourcemaps workflow function#3947

Open
gwdp wants to merge 1 commit into
gwdp/eng-21551-posthog-wait-for-metricfrom
gwdp/eng-21551-posthog-upload-sourcemaps
Open

[build-tools] Add eas/posthog_upload_sourcemaps workflow function#3947
gwdp wants to merge 1 commit into
gwdp/eng-21551-posthog-wait-for-metricfrom
gwdp/eng-21551-posthog-upload-sourcemaps

Conversation

@gwdp

@gwdp gwdp commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Why

Upload your app's source maps to PostHog from a workflow, so error-tracking stack traces are readable instead of minified. For EAS Update and custom builds, where the automatic build-time upload doesn't run.

How

Adds eas/posthog_upload_sourcemaps. Runs @posthog/cli hermes upload against a directory (default dist) with the connect step's POSTHOG_CLI_* creds. Chunk IDs are injected at bundle time by PostHog's Expo metro config (getPostHogExpoConfig), so this step just ships what's already in the export.

ignore_error (default false) fails the step on an upload error; set it true to warn and continue.
(This is the outlier of the posthog functions, but felt the right call, defaults to fail; Lmk if different thoughts)

Test Plan

CI passes. Ran it live against coin-flip with the metro config in place: expo export --source-maps then this step uploaded the Hermes map to PostHog (Found 1 maps to upload, 1 upload keys). Test workflow below covers the happy path plus a forced failure and an ignored one.

Test workflow
name: PostHog source map upload test

jobs:
  upload_sourcemaps:
    environment: production
    steps:
      - uses: eas/checkout
      - run: npm ci
      - run: npx expo export --source-maps --platform ios
      - uses: eas/posthog_upload_sourcemaps
        with:
          directory: dist

  upload_failure:
    environment: production
    steps:
      - uses: eas/posthog_upload_sourcemaps
        with:
          directory: does-not-exist

  ignored_failure:
    environment: production
    steps:
      - uses: eas/posthog_upload_sourcemaps
        with:
          directory: does-not-exist
          ignore_error: true
Screenshot 2026-07-03 at 2 15 05 PM Screenshot 2026-07-03 at 2 15 15 PM Screenshot 2026-07-03 at 2 17 52 PM Screenshot 2026-07-03 at 2 17 56 PM Screenshot 2026-07-03 at 2 18 29 PM

@linear-code

linear-code Bot commented Jul 3, 2026

Copy link
Copy Markdown

ENG-21551

gwdp commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.44%. Comparing base (f630079) to head (eb91e64).

Additional details and impacted files
@@                            Coverage Diff                             @@
##           gwdp/eng-21551-posthog-wait-for-metric    #3947      +/-   ##
==========================================================================
+ Coverage                                   59.42%   59.44%   +0.03%     
==========================================================================
  Files                                         939      940       +1     
  Lines                                       41316    41337      +21     
  Branches                                     8704     8705       +1     
==========================================================================
+ Hits                                        24547    24568      +21     
  Misses                                      16674    16674              
  Partials                                       95       95              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-upload-sourcemaps branch from f34df26 to b6df873 Compare July 3, 2026 21:09
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-upload-sourcemaps branch from b6df873 to eb91e64 Compare July 3, 2026 21:40
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-metric branch from a8e1b57 to f630079 Compare July 3, 2026 21:40
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

@gwdp gwdp requested a review from sjchmiela July 3, 2026 21:46
@gwdp gwdp marked this pull request as ready for review July 3, 2026 21:46
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
**/* @douglowder

Generated by CodeMention

Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant