Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/cds-extractor-dist-bundle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: CDS Extractor Distribution Bundle

on:
push:
branches: [ main ]
paths:
- 'extractors/cds/**'
pull_request:
branches: [ main ]
paths:
- 'extractors/cds/**'
workflow_dispatch:
# This job can be manually triggered to validate the CDS extractor bundle

jobs:
bundle-validation:
name: CDS extractor bundle validation
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'extractors/cds/tools/package-lock.json'

- name: Install node dependencies
working-directory: extractors/cds/tools
run: npm ci

- name: Run TS code linter
working-directory: extractors/cds/tools
run: npm run lint

- name: Run TS code unit tests with coverage report
working-directory: extractors/cds/tools
run: npm run test:coverage

- name: Build and validate the CDS extractor bundle
working-directory: extractors/cds/tools
run: npm run bundle:validate

- name: Check JS bundle size and properties
working-directory: extractors/cds/tools
run: |
_bundle_file="dist/cds-extractor.bundle.js"
# Test that bundle exists and get detailed info
if [ -f "$_bundle_file" ]; then
echo "✅ Bundle file exists"

# Check if bundle has shebang
if head -n 1 "${_bundle_file}" | grep -q "#!/usr/bin/env node"; then
echo "✅ Bundle has Node.js shebang"
else
echo "⚠️ Bundle missing Node.js shebang"
fi

# Check if source map exists
if [ -f "${_bundle_file}.map" ]; then
echo "✅ Source map exists"
else
echo "⚠️ Source map not found"
fi
else
echo "❌ Bundle file not found"
exit 1
fi

# - name: Upload bundle artifact
# uses: actions/upload-artifact@v4
# with:
# name: cds-extractor-bundle
# path: |
# extractors/cds/tools/dist/cds-extractor.bundle.js
# extractors/cds/tools/dist/cds-extractor.bundle.js.map
4 changes: 4 additions & 0 deletions extractors/cds/tools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Override .gitignore configs from parent directories in order to
# include the bundled JS code for the CDS extractor.
!dist/

1 change: 1 addition & 0 deletions extractors/cds/tools/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.15.0
Loading