Skip to content

Commit c5230e9

Browse files
adhorodyskiclaude
andcommitted
ci: collector compliance, nightly matrix, release flow and v0 docs
Layer 5 of the v0 stack (squashed from v0-impl, PR #20): - compliance job: every captured raw request and verify/expected file replayed into otel collector 0.165.0; any non-2xx fails - scheduled.yml: nightly matrix (13 entries) with the mark-nightly status - release.yml + scripts/release-gate.js: publish to `next` after green CI on main; promote to `latest` needs a green nightly - `version` syncs the distro version constants; changeset for 0.3.0 - README, MIGRATION.md, CONTRIBUTING release steps; spec and plan notes Nothing here publishes before the npm environment and NPM_TOKEN exist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 2becf0b commit c5230e9

17 files changed

Lines changed: 1110 additions & 103 deletions

File tree

‎.changeset/config.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
33
"changelog": "@changesets/cli/changelog",
4-
"commit": true,
4+
"commit": false,
55
"fixed": [],
66
"linked": [],
7-
"access": "restricted",
7+
"access": "public",
88
"baseBranch": "main",
99
"updateInternalDependencies": "patch",
1010
"ignore": []

‎.changeset/v0-tracing-rewrite.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"react-native-open-telemetry": minor
3+
---
4+
5+
v0: a rewrite around one trace across JS and native. Native-first init (`RNOtel.start` on Android and iOS) with a JS
6+
fallback (`startReactNativeSdk`), a context patch that carries the active span through `await`, promises and timers,
7+
and `withOtel` helpers for Metro and Vite. Removed (breaking): metrics, fetch instrumentation, session tagging and
8+
the `openTelemetrySDK` init. See MIGRATION.md.

‎.github/workflows/ci.yml‎

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,49 @@ jobs:
461461
if-no-files-found: ignore
462462
include-hidden-files: true # verify/e2e/.e2e is a dot dir
463463

464+
# Task 30: replays every raw request the e2e jobs captured (protobuf and JSON) and every verify/expected file into
465+
# the official OpenTelemetry Collector (pinned; bump deliberately). Fails on a non-2xx or an error log line.
466+
# Needs docker, so it is not part of `bun verify`.
467+
compliance:
468+
needs: [e2e-android-bare, e2e-ios-bare, e2e-android-expo, e2e-ios-expo, e2e-web]
469+
runs-on: ubuntu-latest
470+
timeout-minutes: 10
471+
steps:
472+
- uses: actions/checkout@v4
473+
- uses: oven-sh/setup-bun@v2
474+
with:
475+
bun-version: 1.2.19
476+
- uses: actions/download-artifact@v4
477+
with:
478+
pattern: verify-artifacts-e2e-*
479+
path: e2e-artifacts # one subdirectory per job
480+
- name: Start the Collector
481+
run: |
482+
docker run -d --name otelcol -p 4318:4318 \
483+
-v "$PWD/verify/compliance/collector.yaml:/etc/otelcol/config.yaml:ro" \
484+
otel/opentelemetry-collector:0.165.0 --config /etc/otelcol/config.yaml
485+
for i in $(seq 30); do
486+
code=$(curl -s -o /dev/null -w '%{http_code}' -X POST localhost:4318/v1/traces || true)
487+
[ "$code" != 000 ] && break
488+
sleep 1
489+
done
490+
[ "$code" != 000 ] || { docker logs otelcol; exit 1; }
491+
- name: Replay
492+
run: bun verify/compliance/replay.ts --url http://localhost:4318 --dirs e2e-artifacts
493+
- name: Collector log has no errors
494+
if: always()
495+
run: |
496+
docker logs otelcol > collector.log 2>&1
497+
if grep -P '\terror\t' collector.log; then echo '::error::the Collector logged errors'; exit 1; fi
498+
- uses: actions/upload-artifact@v4
499+
if: always()
500+
with:
501+
name: compliance-collector-log
502+
path: collector.log
503+
if-no-files-found: ignore
504+
464505
budget:
465-
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
506+
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
466507
if: always()
467508
runs-on: ubuntu-latest
468509
timeout-minutes: 5

‎.github/workflows/release.yml‎

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
name: Release
2+
3+
# Two gates, both checked through the GitHub API by scripts/release-gate.js, which fails closed (red, pending, missing
4+
# or an API error all stop the job):
5+
# - publish-next: after CI completes on a `main` push, and only if that commit's CI is green. Changesets opens the
6+
# "version packages" PR while changesets are pending; once it is merged (and CI is green on the merge), it runs
7+
# `changeset publish --tag next` (npm publish --tag next). Nothing ever publishes to `latest` directly.
8+
# - promote (manual, from `main`): moves a published version from `next` to `latest`, only if its release commit
9+
# (tag v<version>) has a green `nightly` status from a successful scheduled.yml run (mark-nightly), and the version
10+
# is not lower than the current `latest`. Run the nightly on that commit first if needed:
11+
# Actions -> Nightly -> Run workflow -> "Use workflow from" tag v<version>.
12+
# Both publishing jobs run in the `npm` environment, which holds NPM_TOKEN (a granular, publish-only token). Setup and
13+
# caveats (the version PR gets no CI): CONTRIBUTING.md "Publishing to npm".
14+
# Real publishing is first verified after merge to `main` (R28); until then only the dry run below has run (from the
15+
# PR, Release run 45353782465).
16+
on:
17+
workflow_run:
18+
workflows: [CI]
19+
types: [completed]
20+
branches: [main]
21+
workflow_dispatch:
22+
inputs:
23+
promote:
24+
description: 'Version to move from `next` to `latest` (e.g. 0.3.0). Empty: nothing to promote.'
25+
type: string
26+
default: ''
27+
dry_run:
28+
description: 'Dry run: evaluate the gates, version and pack; publish and promote nothing'
29+
type: boolean
30+
default: false
31+
32+
permissions:
33+
contents: read
34+
35+
# per event: a dry run or a promote never queues behind or replaces a pending publish-next
36+
concurrency:
37+
group: release-${{ github.event_name }}
38+
cancel-in-progress: false
39+
40+
env:
41+
PACKAGE: react-native-open-telemetry
42+
# A commit whose CI is red (a v0-impl PR run): the dry run proves the CI gate refuses it, live against the API.
43+
KNOWN_RED_SHA: 78482b19a4537be8f05306744729b5a6db8b0d10
44+
# A commit whose CI is green: the positive control, so the refusal above is not a gate that always fails.
45+
KNOWN_GREEN_SHA: d6d1af161ea6a6a1ee587aa858304f3aa6f2e5b3
46+
47+
jobs:
48+
dry-run:
49+
if: github.event_name == 'workflow_dispatch' && inputs.dry_run
50+
runs-on: ubuntu-latest
51+
timeout-minutes: 20
52+
permissions:
53+
contents: read
54+
actions: read
55+
statuses: read
56+
env:
57+
GH_TOKEN: ${{ github.token }}
58+
steps:
59+
- uses: actions/checkout@v4
60+
with:
61+
fetch-depth: 0 # all branches: changeset status compares against origin/main
62+
- uses: actions/setup-node@v4
63+
with:
64+
node-version: '24'
65+
- uses: oven-sh/setup-bun@v2
66+
with:
67+
bun-version: 1.2.19
68+
- run: node scripts/release-gate.js --self-test
69+
- name: The CI gate refuses a red commit and passes a green one
70+
run: |
71+
if node scripts/release-gate.js ci "$KNOWN_RED_SHA"; then echo "::error::CI gate passed a red commit"; exit 1; fi
72+
node scripts/release-gate.js ci "$KNOWN_GREEN_SHA"
73+
- name: The promote gate refuses a commit without a green nightly
74+
run: |
75+
if node scripts/release-gate.js nightly "$KNOWN_RED_SHA"; then echo "::error::nightly gate passed"; exit 1; fi
76+
- run: bun install --frozen-lockfile
77+
- run: bun run prepare
78+
- run: bunx changeset status --verbose --since=origin/main
79+
- name: Version (what the version PR would contain)
80+
run: bun run version && git status --short && git diff -- package.json src/sdk/config.ts ios/RNOtel/RNOtel.swift
81+
# `changeset publish` has no dry-run flag, so the dry run packs exactly what it would publish, with its dist-tag
82+
- run: npm publish --dry-run --tag next --ignore-scripts
83+
84+
publish-next:
85+
if: >-
86+
github.event_name == 'workflow_run' && github.event.workflow_run.event == 'push' &&
87+
github.event.workflow_run.conclusion == 'success'
88+
runs-on: ubuntu-latest
89+
timeout-minutes: 30
90+
environment: npm
91+
permissions:
92+
contents: write # the version PR branch and the v<version> tag
93+
pull-requests: write # the version PR
94+
actions: read # the CI gate
95+
id-token: write # npm provenance
96+
env:
97+
SHA: ${{ github.event.workflow_run.head_sha }}
98+
GH_TOKEN: ${{ github.token }}
99+
steps:
100+
- uses: actions/checkout@v4
101+
with:
102+
ref: ${{ github.event.workflow_run.head_sha }}
103+
fetch-depth: 0
104+
- uses: actions/setup-node@v4
105+
with:
106+
node-version: '24'
107+
# the event says success; re-check through the API so a re-run or a stale event cannot publish a red commit
108+
- run: node scripts/release-gate.js ci "$SHA"
109+
- uses: oven-sh/setup-bun@v2
110+
with:
111+
bun-version: 1.2.19
112+
- run: bun install --frozen-lockfile
113+
- uses: changesets/action@v1
114+
with:
115+
version: bun run version
116+
publish: bun run release
117+
title: 'chore: version packages'
118+
commit: 'chore: version packages'
119+
createGithubReleases: false # `latest` is promote's call, not the publish's
120+
env:
121+
GITHUB_TOKEN: ${{ github.token }}
122+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
123+
NPM_CONFIG_PROVENANCE: 'true'
124+
125+
promote:
126+
if: >-
127+
github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' &&
128+
inputs.promote != '' && !inputs.dry_run
129+
runs-on: ubuntu-latest
130+
timeout-minutes: 10
131+
environment: npm
132+
permissions:
133+
contents: read
134+
statuses: read # the nightly gate: the status
135+
actions: read # the nightly gate: the scheduled.yml run it links
136+
env:
137+
VERSION: ${{ inputs.promote }}
138+
GH_TOKEN: ${{ github.token }}
139+
steps:
140+
- uses: actions/checkout@v4
141+
with:
142+
fetch-depth: 0
143+
- uses: actions/setup-node@v4
144+
with:
145+
node-version: '24'
146+
registry-url: https://registry.npmjs.org
147+
- name: Resolve the release commit
148+
run: |
149+
# x.y.z only: a prerelease never becomes `latest`, and sort -V orders plain versions correctly
150+
[[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "::error::not a release version: $VERSION"; exit 1; }
151+
sha=$(git rev-list -n 1 "v$VERSION") # fails the step when the tag is missing
152+
echo "SHA=$sha" >> "$GITHUB_ENV"
153+
test "$(npm view "$PACKAGE@$VERSION" version)" = "$VERSION"
154+
latest=$(npm view "$PACKAGE" dist-tags.latest)
155+
if [ "$(printf '%s\n' "$latest" "$VERSION" | sort -V | tail -n 1)" != "$VERSION" ]; then
156+
echo "::error::$VERSION is lower than latest $latest"; exit 1
157+
fi
158+
- run: node scripts/release-gate.js nightly "$SHA"
159+
- run: npm dist-tag add "$PACKAGE@$VERSION" latest
160+
env:
161+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)