Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
135 changes: 69 additions & 66 deletions .github/workflows/cds-extractor-dist-bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CDS Extractor Distribution Bundle
on:
push:
branches: [ main ]
paths:
paths:
- 'extractors/cds/**'
pull_request:
branches: [ main ]
Expand All @@ -12,77 +12,80 @@ on:
workflow_dispatch:
# This job can be manually triggered to validate the CDS extractor bundle

permissions:
contents: read

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

steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v6
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 build:validate
- name: Checkout repository
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
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 build:validate

- name: Validate CDS extractor JS bundle and map files
working-directory: extractors/cds/tools
run: |
_bundle_file="dist/cds-extractor.bundle.js"
_bundle_map_file="${_bundle_file}.map"
if [ -f "$_bundle_file" ]; then
echo "✅ Bundle file exists."
else
echo "❌ Bundle file not found."
exit 2
fi
- name: Validate CDS extractor JS bundle and map files
working-directory: extractors/cds/tools
run: |
_bundle_file="dist/cds-extractor.bundle.js"
_bundle_map_file="${_bundle_file}.map"
if [ -f "$_bundle_file" ]; then
echo "✅ Bundle file exists."
else
echo "❌ Bundle file not found."
exit 2
fi

if [ -f "$_bundle_map_file" ]; then
echo "✅ CDS extractor JS bundle source map file exists."
else
echo "❌ CDS extractor JS bundle source map file not found."
exit 3
fi
if [ -f "$_bundle_map_file" ]; then
echo "✅ CDS extractor JS bundle source map file exists."
else
echo "❌ CDS extractor JS bundle source map file not found."
exit 3
fi

# Check if the built bundle and map files differ
# from the versions committed to git.
if git diff --exit-code "$_bundle_file" "$_bundle_map_file"; then
echo "✅ CDS JS bundle and map files match committed versions."
else
echo "❌ CDS JS bundle and/or map file(s) differ from committed version(s)."
echo "The built bundle and/or source map do not match the committed versions."
echo "Please rebuild the bundle and commit the changes:"
echo " cd extractors/cds/tools"
echo " npm install"
echo " npm run build:all"
echo " git add dist/cds-extractor.bundle.*"
echo " git commit -m 'Update CDS extractor dist bundle'"
exit 4
fi
# Check if the built bundle and map files differ
# from the versions committed to git.
if git diff --exit-code "$_bundle_file" "$_bundle_map_file"; then
echo "✅ CDS JS bundle and map files match committed versions."
else
echo "❌ CDS JS bundle and/or map file(s) differ from committed version(s)."
echo "The built bundle and/or source map do not match the committed versions."
echo "Please rebuild the bundle and commit the changes:"
echo " cd extractors/cds/tools"
echo " npm install"
echo " npm run build:all"
echo " git add dist/cds-extractor.bundle.*"
echo " git commit -m 'Update CDS extractor dist bundle'"
exit 4
fi

# Check if bundle file starts with the expected shebang for `node`.
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"
exit 5
fi
# Check if bundle file starts with the expected shebang for `node`.
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"
exit 5
fi
7 changes: 5 additions & 2 deletions .github/workflows/code_scanning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
- cron: '39 12 * * 2'
workflow_dispatch:

permissions:
contents: read

env:
CODEQL_ACTION_DIFF_INFORMED_QUERIES: false

Expand Down Expand Up @@ -39,7 +42,7 @@ jobs:
- name: Extract CodeQL bundle version from qlt.conf.json
run: |
echo "BUNDLE_VERSION=$(jq .CodeQLCLIBundle qlt.conf.json -r)" >> $GITHUB_ENV

- name: Initialize CodeQL
id: initialize-codeql
uses: github/codeql-action/init@v4
Expand All @@ -52,7 +55,7 @@ jobs:
db-location: ${{ runner.temp }}/codeql-database
tools: https://github.com/github/codeql-action/releases/download/${{env.BUNDLE_VERSION}}/codeql-bundle-linux64.tar.gz
debug: true

- name: Run CDS extractor
shell: bash
run: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/codeql-ql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
branches: [ "main" ]
workflow_dispatch:

permissions:
contents: read

jobs:
codeql:
uses: advanced-security/reusable-workflows/.github/workflows/codeql-ql.yml@main
Expand Down
Loading
Loading