Skip to content

Commit 5fcfd23

Browse files
committed
one workflow
1 parent 5296942 commit 5fcfd23

2 files changed

Lines changed: 69 additions & 93 deletions

File tree

‎.github/workflows/js-sdk-integration.yaml‎

Lines changed: 0 additions & 85 deletions
This file was deleted.

‎.github/workflows/js.yaml‎

Lines changed: 69 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,74 @@ jobs:
4141
name: javascript-sdk-dev-${{ github.run_id }}-${{ matrix.node-version }}-dist
4242
path: js/dist/
4343
retention-days: 1
44-
- name: Trigger js-sdk-integration workflow
45-
if: matrix.node-version == '22' && matrix.os == 'ubuntu-latest'
44+
45+
integration-tests:
46+
needs: build
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Checkout repository
50+
uses: actions/checkout@v4
51+
with:
52+
repository: ${{ github.event.workflow_run.repository.full_name }}
53+
ref: ${{ github.event.workflow_run.head_sha }}
54+
55+
- name: Backup original NodeSDK package.json
56+
working-directory: js/examples/otel
57+
run: cp package.json package.json.bak
58+
59+
- name: Determine artifact name
60+
id: artifact
61+
env:
62+
NODE_VERSION: ${{ matrix.node-version }}
63+
RUN_ID: ${{ inputs.build_run_id }}
64+
run: |
65+
ARTIFACT_NAME="javascript-sdk-dev-${RUN_ID}-22-dist"
66+
echo "name=$ARTIFACT_NAME" >> "$GITHUB_OUTPUT"
67+
68+
- name: Download javascript dist artifact
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: ${{ steps.artifact.outputs.name }}
72+
path: js/artifacts
73+
run-id: ${{ inputs.build_run_id }}
74+
github-token: ${{ secrets.GITHUB_TOKEN }}
75+
76+
- name: Setup Node.js
77+
uses: actions/setup-node@v4
78+
with:
79+
node-version: 22
80+
81+
- name: Install example dependencies
82+
working-directory: js/examples/otel
83+
run: npm install
84+
85+
- name: Run NodeSDK as CJS example
86+
working-directory: js/examples/otel
87+
env:
88+
BRAINTRUST_OTEL_COMPAT: false
89+
BRAINTRUST_API_KEY: ${{ secrets.BRAINTRUST_API_KEY }}
90+
NODE_PATH: ../../artifacts
91+
run: |
92+
node -e "console.log('CJS mode:', typeof require !== 'undefined')"
93+
npm start
94+
95+
- name: Enable ESM for this run
96+
working-directory: js/examples/otel
97+
run: |
98+
jq '. + {"type":"module"}' package.json > package.temp.json
99+
mv package.temp.json package.json
100+
101+
- name: Run NodeSDK as ESM example
102+
working-directory: js/examples/otel
46103
env:
47-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
BRAINTRUST_OTEL_COMPAT: false
105+
BRAINTRUST_API_KEY: ${{ secrets.BRAINTRUST_API_KEY }}
106+
NODE_PATH: ../../artifacts
48107
run: |
49-
curl -X POST \
50-
-H "Accept: application/vnd.github+json" \
51-
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
52-
https://api.github.com/repos/${{ github.repository }}/actions/workflows/js-sdk-integration.yaml/dispatches \
53-
-d '{"ref": "${{ github.event.pull_request.head.ref }}", "inputs": {"build_run_id": "${{ github.run_id }}"}}'
108+
node -e "console.log('ESM mode:', typeof import.meta.url === 'string')"
109+
npm start
110+
111+
- name: Restore original package.json
112+
if: always()
113+
working-directory: js/examples/otel
114+
run: mv package.json.bak package.json

0 commit comments

Comments
 (0)