Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": true,
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
Expand Down
8 changes: 8 additions & 0 deletions .changeset/v0-tracing-rewrite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"react-native-open-telemetry": minor
---

v0: a rewrite around one trace across JS and native. Native-first init (`RNOtel.start` on Android and iOS) with a JS
fallback (`startReactNativeSdk`), a context patch that carries the active span through `await`, promises and timers,
and `withOtel` helpers for Metro and Vite. Removed (breaking): metrics, fetch instrumentation, session tagging and
the `openTelemetrySDK` init. See MIGRATION.md.
43 changes: 42 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,49 @@ jobs:
if-no-files-found: ignore
include-hidden-files: true # verify/e2e/.e2e is a dot dir

# Task 30: replays every raw request the e2e jobs captured (protobuf and JSON) and every verify/expected file into
# the official OpenTelemetry Collector (pinned; bump deliberately). Fails on a non-2xx or an error log line.
# Needs docker, so it is not part of `bun verify`.
compliance:
needs: [e2e-android-bare, e2e-ios-bare, e2e-android-expo, e2e-ios-expo, e2e-web]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.19
- uses: actions/download-artifact@v4
with:
pattern: verify-artifacts-e2e-*
path: e2e-artifacts # one subdirectory per job
- name: Start the Collector
run: |
docker run -d --name otelcol -p 4318:4318 \
-v "$PWD/verify/compliance/collector.yaml:/etc/otelcol/config.yaml:ro" \
otel/opentelemetry-collector:0.165.0 --config /etc/otelcol/config.yaml
for i in $(seq 30); do
code=$(curl -s -o /dev/null -w '%{http_code}' -X POST localhost:4318/v1/traces || true)
[ "$code" != 000 ] && break
sleep 1
done
[ "$code" != 000 ] || { docker logs otelcol; exit 1; }
- name: Replay
run: bun verify/compliance/replay.ts --url http://localhost:4318 --dirs e2e-artifacts
- name: Collector log has no errors
if: always()
run: |
docker logs otelcol > collector.log 2>&1
if grep -P '\terror\t' collector.log; then echo '::error::the Collector logged errors'; exit 1; fi
- uses: actions/upload-artifact@v4
if: always()
with:
name: compliance-collector-log
path: collector.log
if-no-files-found: ignore

budget:
needs: [static-fast, fast-swift, e2e-android-bare, e2e-ios-bare, e2e-android-expo, e2e-ios-expo, e2e-web] # every other job; extend when jobs are added
needs: [static-fast, fast-swift, e2e-android-bare, e2e-ios-bare, e2e-android-expo, e2e-ios-expo, e2e-web, compliance] # every other job; extend when jobs are added
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
Expand Down
161 changes: 161 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
name: Release

# Two gates, both checked through the GitHub API by scripts/release-gate.js, which fails closed (red, pending, missing
# or an API error all stop the job):
# - publish-next: after CI completes on a `main` push, and only if that commit's CI is green. Changesets opens the
# "version packages" PR while changesets are pending; once it is merged (and CI is green on the merge), it runs
# `changeset publish --tag next` (npm publish --tag next). Nothing ever publishes to `latest` directly.
# - promote (manual, from `main`): moves a published version from `next` to `latest`, only if its release commit
# (tag v<version>) has a green `nightly` status from a successful scheduled.yml run (mark-nightly), and the version
# is not lower than the current `latest`. Run the nightly on that commit first if needed:
# Actions -> Nightly -> Run workflow -> "Use workflow from" tag v<version>.
# Both publishing jobs run in the `npm` environment, which holds NPM_TOKEN (a granular, publish-only token). Setup and
# caveats (the version PR gets no CI): CONTRIBUTING.md "Publishing to npm".
# Real publishing is first verified after merge to `main` (R28); until then only the dry run below has run (from the
# PR, Release run 45353782465).
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
workflow_dispatch:
inputs:
promote:
description: 'Version to move from `next` to `latest` (e.g. 0.3.0). Empty: nothing to promote.'
type: string
default: ''
dry_run:
description: 'Dry run: evaluate the gates, version and pack; publish and promote nothing'
type: boolean
default: false

permissions:
contents: read

# per event: a dry run or a promote never queues behind or replaces a pending publish-next
concurrency:
group: release-${{ github.event_name }}
cancel-in-progress: false

env:
PACKAGE: react-native-open-telemetry
# A commit whose CI is red (a v0-impl PR run): the dry run proves the CI gate refuses it, live against the API.
KNOWN_RED_SHA: 78482b19a4537be8f05306744729b5a6db8b0d10
# A commit whose CI is green: the positive control, so the refusal above is not a gate that always fails.
KNOWN_GREEN_SHA: d6d1af161ea6a6a1ee587aa858304f3aa6f2e5b3

jobs:
dry-run:
if: github.event_name == 'workflow_dispatch' && inputs.dry_run
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
actions: read
statuses: read
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # all branches: changeset status compares against origin/main
- uses: actions/setup-node@v4
with:
node-version: '24'
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.19
- run: node scripts/release-gate.js --self-test
- name: The CI gate refuses a red commit and passes a green one
run: |
if node scripts/release-gate.js ci "$KNOWN_RED_SHA"; then echo "::error::CI gate passed a red commit"; exit 1; fi
node scripts/release-gate.js ci "$KNOWN_GREEN_SHA"
- name: The promote gate refuses a commit without a green nightly
run: |
if node scripts/release-gate.js nightly "$KNOWN_RED_SHA"; then echo "::error::nightly gate passed"; exit 1; fi
- run: bun install --frozen-lockfile
- run: bun run prepare
- run: bunx changeset status --verbose --since=origin/main
- name: Version (what the version PR would contain)
run: bun run version && git status --short && git diff -- package.json src/sdk/config.ts ios/RNOtel/RNOtel.swift
# `changeset publish` has no dry-run flag, so the dry run packs exactly what it would publish, with its dist-tag
- run: npm publish --dry-run --tag next --ignore-scripts

publish-next:
if: >-
github.event_name == 'workflow_run' && github.event.workflow_run.event == 'push' &&
github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
timeout-minutes: 30
environment: npm
permissions:
contents: write # the version PR branch and the v<version> tag
pull-requests: write # the version PR
actions: read # the CI gate
id-token: write # npm provenance
env:
SHA: ${{ github.event.workflow_run.head_sha }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '24'
# the event says success; re-check through the API so a re-run or a stale event cannot publish a red commit
- run: node scripts/release-gate.js ci "$SHA"
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.19
- run: bun install --frozen-lockfile
- uses: changesets/action@v1
with:
version: bun run version
publish: bun run release
title: 'chore: version packages'
commit: 'chore: version packages'
createGithubReleases: false # `latest` is promote's call, not the publish's
env:
GITHUB_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: 'true'

promote:
if: >-
github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' &&
inputs.promote != '' && !inputs.dry_run
runs-on: ubuntu-latest
timeout-minutes: 10
environment: npm
permissions:
contents: read
statuses: read # the nightly gate: the status
actions: read # the nightly gate: the scheduled.yml run it links
env:
VERSION: ${{ inputs.promote }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '24'
registry-url: https://registry.npmjs.org
- name: Resolve the release commit
run: |
# x.y.z only: a prerelease never becomes `latest`, and sort -V orders plain versions correctly
[[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "::error::not a release version: $VERSION"; exit 1; }
sha=$(git rev-list -n 1 "v$VERSION") # fails the step when the tag is missing
echo "SHA=$sha" >> "$GITHUB_ENV"
test "$(npm view "$PACKAGE@$VERSION" version)" = "$VERSION"
latest=$(npm view "$PACKAGE" dist-tags.latest)
if [ "$(printf '%s\n' "$latest" "$VERSION" | sort -V | tail -n 1)" != "$VERSION" ]; then
echo "::error::$VERSION is lower than latest $latest"; exit 1
fi
- run: node scripts/release-gate.js nightly "$SHA"
- run: npm dist-tag add "$PACKAGE@$VERSION" latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading
Loading