@@ -3,7 +3,7 @@ name: CDS Extractor Distribution Bundle
33on :
44 push :
55 branches : [ main ]
6- paths :
6+ paths :
77 - ' extractors/cds/**'
88 pull_request :
99 branches : [ main ]
1212 workflow_dispatch :
1313 # This job can be manually triggered to validate the CDS extractor bundle
1414
15+ permissions :
16+ contents : read
17+
1518jobs :
1619 bundle-validation :
1720 name : CDS extractor bundle validation
1821 runs-on : ubuntu-latest
19-
22+
2023 steps :
21- - name : Checkout repository
22- uses : actions/checkout@v5
23-
24- - name : Setup Node.js
25- uses : actions/setup-node@v6
26- with :
27- node-version : ' 20'
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 with coverage report
40- working-directory : extractors/cds/tools
41- run : npm run test:coverage
42-
43- - name : Build and validate the CDS extractor bundle
44- working-directory : extractors/cds/tools
45- run : npm run build:validate
24+ - name : Checkout repository
25+ uses : actions/checkout@v6
26+
27+ - name : Setup Node.js
28+ uses : actions/setup-node@v6
29+ with :
30+ node-version : ' 20'
31+ cache : ' npm'
32+ cache-dependency-path : ' extractors/cds/tools/package-lock.json'
33+
34+ - name : Install node dependencies
35+ working-directory : extractors/cds/tools
36+ run : npm ci
37+
38+ - name : Run TS code linter
39+ working-directory : extractors/cds/tools
40+ run : npm run lint
41+
42+ - name : Run TS code unit tests with coverage report
43+ working-directory : extractors/cds/tools
44+ run : npm run test:coverage
45+
46+ - name : Build and validate the CDS extractor bundle
47+ working-directory : extractors/cds/tools
48+ run : npm run build:validate
4649
47- - name : Validate CDS extractor JS bundle and map files
48- working-directory : extractors/cds/tools
49- run : |
50- _bundle_file="dist/cds-extractor.bundle.js"
51- _bundle_map_file="${_bundle_file}.map"
52- if [ -f "$_bundle_file" ]; then
53- echo "✅ Bundle file exists."
54- else
55- echo "❌ Bundle file not found."
56- exit 2
57- fi
50+ - name : Validate CDS extractor JS bundle and map files
51+ working-directory : extractors/cds/tools
52+ run : |
53+ _bundle_file="dist/cds-extractor.bundle.js"
54+ _bundle_map_file="${_bundle_file}.map"
55+ if [ -f "$_bundle_file" ]; then
56+ echo "✅ Bundle file exists."
57+ else
58+ echo "❌ Bundle file not found."
59+ exit 2
60+ fi
5861
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
62+ if [ -f "$_bundle_map_file" ]; then
63+ echo "✅ CDS extractor JS bundle source map file exists."
64+ else
65+ echo "❌ CDS extractor JS bundle source map file not found."
66+ exit 3
67+ fi
6568
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
69+ # Check if the built bundle and map files differ
70+ # from the versions committed to git.
71+ if git diff --exit-code "$_bundle_file" "$_bundle_map_file"; then
72+ echo "✅ CDS JS bundle and map files match committed versions."
73+ else
74+ echo "❌ CDS JS bundle and/or map file(s) differ from committed version(s)."
75+ echo "The built bundle and/or source map do not match the committed versions."
76+ echo "Please rebuild the bundle and commit the changes:"
77+ echo " cd extractors/cds/tools"
78+ echo " npm install"
79+ echo " npm run build:all"
80+ echo " git add dist/cds-extractor.bundle.*"
81+ echo " git commit -m 'Update CDS extractor dist bundle'"
82+ exit 4
83+ fi
8184
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
88- fi
85+ # Check if bundle file starts with the expected shebang for `node`.
86+ if head -n 1 "${_bundle_file}" | grep -q "#!/usr/bin/env node"; then
87+ echo "✅ Bundle has Node.js shebang"
88+ else
89+ echo "❌ Bundle missing Node.js shebang"
90+ exit 5
91+ fi
0 commit comments