Skip to content

Commit e9b316e

Browse files
committed
Update cds-extractor-dist-bundle.yml workflow
1 parent 670de11 commit e9b316e

File tree

1 file changed

+38
-29
lines changed

1 file changed

+38
-29
lines changed

.github/workflows/cds-extractor-dist-bundle.yml

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -42,38 +42,47 @@ jobs:
4242

4343
- name: Build and validate the CDS extractor bundle
4444
working-directory: extractors/cds/tools
45-
run: npm run bundle:validate
46-
47-
- name: Check JS bundle size and properties
45+
run: npm run build:validate
46+
47+
- name: Validate CDS extractor JS bundle and map files
4848
working-directory: extractors/cds/tools
4949
run: |
5050
_bundle_file="dist/cds-extractor.bundle.js"
51-
# Test that bundle exists and get detailed info
51+
_bundle_map_file="${_bundle_file}.map"
5252
if [ -f "$_bundle_file" ]; then
53-
echo "✅ Bundle file exists"
54-
55-
# Check if bundle has shebang
56-
if head -n 1 "${_bundle_file}" | grep -q "#!/usr/bin/env node"; then
57-
echo "✅ Bundle has Node.js shebang"
58-
else
59-
echo "⚠️ Bundle missing Node.js shebang"
60-
fi
61-
62-
# Check if source map exists
63-
if [ -f "${_bundle_file}.map" ]; then
64-
echo "✅ Source map exists"
65-
else
66-
echo "⚠️ Source map not found"
67-
fi
53+
echo "✅ Bundle file exists."
6854
else
69-
echo "❌ Bundle file not found"
70-
exit 1
55+
echo "❌ Bundle file not found."
56+
exit 2
57+
fi
58+
59+
if [ -f "$_bundle_map_file" ]; then
60+
echo "✅ CDS extractor JS bundle source map file exists."
61+
else
62+
echo "❌ CDS extractor JS bundle source map file not found."
63+
exit 3
64+
fi
65+
66+
# Check if the built bundle and map files differ
67+
# from the versions committed to git.
68+
if git diff --exit-code "$_bundle_file" "$_bundle_map_file"; then
69+
echo "✅ CDS JS bundle and map files match committed versions."
70+
else
71+
echo "❌ CDS JS bundle and/or map file(s) differ from committed version(s)."
72+
echo "The built bundle and/or source map do not match the committed versions."
73+
echo "Please rebuild the bundle and commit the changes:"
74+
echo " cd extractors/cds/tools"
75+
echo " npm install"
76+
echo " npm run build:all"
77+
echo " git add dist/cds-extractor.bundle.*"
78+
echo " git commit -m 'Update CDS extractor dist bundle'"
79+
exit 4
80+
fi
81+
82+
# Check if bundle file starts with the expected shebang for `node`.
83+
if head -n 1 "${_bundle_file}" | grep -q "#!/usr/bin/env node"; then
84+
echo "✅ Bundle has Node.js shebang"
85+
else
86+
echo "❌ Bundle missing Node.js shebang"
87+
exit 5
7188
fi
72-
73-
# - name: Upload bundle artifact
74-
# uses: actions/upload-artifact@v4
75-
# with:
76-
# name: cds-extractor-bundle
77-
# path: |
78-
# extractors/cds/tools/dist/cds-extractor.bundle.js
79-
# extractors/cds/tools/dist/cds-extractor.bundle.js.map

0 commit comments

Comments
 (0)