Skip to content

Commit 1098f4c

Browse files
committed
Add actions workflow for CDS extractor dist bundle
Adds a GitHub Actions workflow for "CDS Extractor Distribution Bundle" in order to integrate the linting, unit testing, compiling, and bundling of CDS extractor TS code into a single NodeJS-compatible bundle.
1 parent 02b9735 commit 1098f4c

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: CDS Extractor Distribution Bundle
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'extractors/cds/**'
8+
pull_request:
9+
branches: [ main ]
10+
paths:
11+
- 'extractors/cds/**'
12+
workflow_dispatch:
13+
# This job can be manually triggered to validate the CDS extractor bundle
14+
15+
jobs:
16+
bundle-validation:
17+
name: CDS extractor bundle validation
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '18'
28+
cache: 'npm'
29+
cache-dependency-path: 'extractors/cds/tools/package-lock.json'
30+
31+
- name: Install node dependencies
32+
working-directory: extractors/cds/tools
33+
run: npm ci
34+
35+
- name: Run TS code linter
36+
working-directory: extractors/cds/tools
37+
run: npm run lint
38+
39+
- name: Run TS code unit tests
40+
working-directory: extractors/cds/tools
41+
run: npm run test
42+
43+
- name: Compile TS code to create minified JS bundle
44+
working-directory: extractors/cds/tools
45+
run: npm run bundle
46+
47+
- name: Validate JS bundle
48+
working-directory: extractors/cds/tools
49+
run: npm run bundle:validate
50+
51+
- name: Check JS bundle size and properties
52+
working-directory: extractors/cds/tools
53+
run: |
54+
_bundle_file="dist/cds-extractor.bundle.js"
55+
# Test that bundle exists and get detailed info
56+
if [ -f "$_bundle_file" ]; then
57+
echo "✅ Bundle file exists"
58+
59+
# Check if bundle has shebang
60+
if head -n 1 "${_bundle_file}" | grep -q "#!/usr/bin/env node"; then
61+
echo "✅ Bundle has Node.js shebang"
62+
else
63+
echo "⚠️ Bundle missing Node.js shebang"
64+
fi
65+
66+
# Check if source map exists
67+
if [ -f "${_bundle_file}.map" ]; then
68+
echo "✅ Source map exists"
69+
else
70+
echo "⚠️ Source map not found"
71+
fi
72+
else
73+
echo "❌ Bundle file not found"
74+
exit 1
75+
fi
76+
77+
# - name: Upload bundle artifact
78+
# uses: actions/upload-artifact@v4
79+
# with:
80+
# name: cds-extractor-bundle
81+
# path: |
82+
# extractors/cds/tools/dist/cds-extractor.bundle.js
83+
# extractors/cds/tools/dist/cds-extractor.bundle.js.map

0 commit comments

Comments
 (0)