Skip to content

Commit 855e679

Browse files
committed
chore: add flags script
1 parent ddca5a1 commit 855e679

File tree

2 files changed

+66
-40
lines changed

2 files changed

+66
-40
lines changed

.github/workflows/pr-test.yml

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches: [main]
66

77
jobs:
8-
build-and-cache:
8+
compile:
99
strategy:
1010
fail-fast: false
1111
runs-on: ubuntu-latest
@@ -29,14 +29,14 @@ jobs:
2929
- name: Upload Build Artifacts
3030
uses: actions/upload-artifact@v4
3131
with:
32-
name: tests-build-cache-${{ github.run_number }}
32+
name: compile-cache-${{ github.run_number }}
3333
path: .nx
3434
include-hidden-files: true
3535
if-no-files-found: error
3636
retention-days: 1
3737

3838
unit-and-tav-test:
39-
needs: build-and-cache
39+
needs: compile
4040
strategy:
4141
fail-fast: false
4242
matrix:
@@ -181,7 +181,7 @@ jobs:
181181
- name: Download Build Artifacts
182182
uses: actions/download-artifact@v4
183183
with:
184-
name: tests-build-cache-${{ github.run_number }}
184+
name: compile-cache-${{ github.run_number }}
185185
path: .nx
186186
- name: Compile (Delta)
187187
run: npm run compile:ci:affected
@@ -200,6 +200,42 @@ jobs:
200200
!node_modules
201201
**/.nyc_output/**
202202
203+
browser-test:
204+
needs: compile
205+
strategy:
206+
fail-fast: false
207+
matrix:
208+
node: ["22"]
209+
runs-on: ubuntu-latest
210+
env:
211+
NPM_CONFIG_UNSAFE_PERM: true
212+
NODE_OPTIONS: --max-old-space-size=4096
213+
steps:
214+
- name: Checkout
215+
uses: actions/checkout@v4
216+
with:
217+
fetch-depth: 0
218+
- uses: actions/setup-node@v4
219+
with:
220+
node-version: ${{ matrix.node }}
221+
- name: Install
222+
run: npm ci
223+
- name: Download Build Artifacts
224+
uses: actions/download-artifact@v4
225+
with:
226+
name: tests-build-cache-${{ github.run_number }}
227+
path: .nx
228+
- name: Build
229+
run: npm run compile
230+
- name: Unit tests
231+
run: npm run test:browser
232+
- name: Report Coverage
233+
uses: codecov/codecov-action@v5
234+
env:
235+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
236+
with:
237+
verbose: true
238+
203239
test-coverage-report:
204240
runs-on: ubuntu-latest
205241
needs: unit-and-tav-test
@@ -241,39 +277,3 @@ jobs:
241277
with:
242278
verbose: true
243279
dry_run: true
244-
245-
# browser-test:
246-
# needs: build-and-cache
247-
# strategy:
248-
# fail-fast: false
249-
# matrix:
250-
# node: ["22"]
251-
# runs-on: ubuntu-latest
252-
# env:
253-
# NPM_CONFIG_UNSAFE_PERM: true
254-
# NODE_OPTIONS: --max-old-space-size=4096
255-
# steps:
256-
# - name: Checkout
257-
# uses: actions/checkout@v4
258-
# with:
259-
# fetch-depth: 0
260-
# - uses: actions/setup-node@v4
261-
# with:
262-
# node-version: ${{ matrix.node }}
263-
# - name: Install
264-
# run: npm ci
265-
# - name: Download Build Artifacts
266-
# uses: actions/download-artifact@v4
267-
# with:
268-
# name: tests-build-cache-${{ github.run_number }}
269-
# path: .nx
270-
# - name: Build
271-
# run: npm run compile
272-
# - name: Unit tests
273-
# run: npm run test:browser
274-
# - name: Report Coverage
275-
# uses: codecov/codecov-action@v5
276-
# env:
277-
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
278-
# with:
279-
# verbose: true

scripts/codecov-upload-flags.mjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import path from 'path';
2+
import { readFileSync } from 'fs';
3+
import { globSync } from 'glob';
4+
5+
const readPkg = (dir) => JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8'));
6+
7+
const TOP = process.cwd();
8+
const pkgInfo = readPkg(TOP);
9+
const pkgFiles = pkgInfo.workspaces.map((exp) => globSync(path.join(exp, 'package.json')));
10+
const pkgFlags = pkgFiles.flat().map((f) => {
11+
const path = f.replace('package.json', '');
12+
const info = readPkg(path);
13+
const name = info.name;
14+
const flag = name.replace('@opentelemetry/', '');
15+
16+
return { name, flag, len: flag.length, path };
17+
});
18+
19+
// Print the flags
20+
pkgFlags.forEach((pf) => {
21+
console.log(`
22+
${pf.flag}:
23+
paths:
24+
- ${pf.path}
25+
carryforward: true`)
26+
});

0 commit comments

Comments
 (0)