Skip to content

Commit 8d7a9a7

Browse files
authored
Merge pull request #297 from advanced-security/dd/cds-extractor-windows-debug/1
2 parents 8f4d019 + bb4d45c commit 8d7a9a7

23 files changed

+7055
-6577
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto eol=lf
2+
*.cmd text eol=crlf
3+
*.bat text eol=crlf
Lines changed: 156 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -1,157 +1,156 @@
1-
name: ⚙️ CodeQL - Run Unit Tests (javascript)
2-
3-
4-
on:
5-
push:
6-
branches:
7-
- 'main'
8-
pull_request:
9-
branches:
10-
- 'main'
11-
workflow_dispatch:
12-
13-
permissions:
14-
contents: read
15-
16-
jobs:
17-
create-unit-test-matrix:
18-
name: Create CodeQL Unit Test Matrix
19-
runs-on: ubuntu-latest
20-
outputs:
21-
matrix: ${{ steps.export-unit-test-matrix.outputs.matrix }}
22-
steps:
23-
- name: Checkout repository
24-
uses: actions/checkout@v6
25-
26-
- name: Install QLT
27-
id: install-qlt
28-
uses: advanced-security/codeql-development-toolkit/.github/actions/install-qlt@main
29-
with:
30-
qlt-version: 'latest'
31-
add-to-path: true
32-
33-
- name: Export unit test matrix
34-
id: export-unit-test-matrix
35-
run: |
36-
qlt test run get-matrix --os-version ubuntu-latest
37-
38-
run-test-suites:
39-
name: Run Unit Tests
40-
needs: create-unit-test-matrix
41-
42-
runs-on: ${{ matrix.os }}
43-
strategy:
44-
fail-fast: false
45-
matrix: ${{ fromJSON(needs.create-unit-test-matrix.outputs.matrix) }}
46-
47-
steps:
48-
- name: Checkout repository
49-
uses: actions/checkout@v6
50-
51-
- name: Install QLT
52-
id: install-qlt
53-
uses: advanced-security/codeql-development-toolkit/.github/actions/install-qlt@main
54-
with:
55-
qlt-version: 'latest'
56-
add-to-path: true
57-
58-
- name: Install CodeQL
59-
id: install-codeql
60-
shell: bash
61-
run: |
62-
echo "Installing CodeQL"
63-
qlt codeql run install
64-
echo "-----------------------------"
65-
echo "CodeQL Home: $QLT_CODEQL_HOME"
66-
echo "CodeQL Binary: $QLT_CODEQL_PATH"
67-
68-
- name: Verify Versions of Tooling
69-
shell: bash
70-
run: |
71-
echo -e "Checking CodeQL Version:"
72-
$QLT_CODEQL_PATH --version
73-
74-
echo -e "Checking QLT Version:"
75-
echo "QLT Home: ${{ steps.install-qlt.outputs.qlt-home }}"
76-
qlt version
77-
78-
- name: Install QL Packs
79-
shell: bash
80-
run: |
81-
qlt query run install-packs
82-
83-
- name: Setup Node.js for CDS compilation
84-
uses: actions/setup-node@v6
85-
with:
86-
node-version: '20'
87-
cache: 'npm'
88-
cache-dependency-path: 'extractors/cds/tools/package-lock.json'
89-
90-
- name: Verify Node.js and npm tools
91-
run: |
92-
echo "Node.js version: $(node --version)"
93-
echo "npm version: $(npm --version)"
94-
echo "npx version: $(npx --version)"
95-
# Verify npx can access @sap/cds-dk without installing globally
96-
echo "Testing npx access to @sap/cds-dk..."
97-
npx --yes --package @sap/cds-dk@latest cds --version || echo "CDS will be installed per-project as needed"
98-
99-
# Compile .cds files to .cds.json files using the dedicated test script
100-
- name: Compile CAP CDS files
101-
run: |
102-
# Use the dedicated CDS compilation script that includes proper version resolution
103-
# This script follows the same logic as the CDS extractor's resolveCdsVersions function
104-
./extractors/cds/tools/workflow/cds-compilation-for-actions.sh
105-
106-
- name: Run test suites
107-
id: run-test-suites
108-
env:
109-
RUNNER_OS: ${{ runner.os }}
110-
CODEQL_CLI: ${{ matrix.codeql_cli }}
111-
CODEQL_STDLIB: ${{ matrix.codeql_standard_library }}
112-
CODEQL_STDLIB_IDENT: ${{matrix.codeql_standard_library_ident}}
113-
RUNNER_TMP: ${{ runner.temp }}
114-
LGTM_INDEX_XML_MODE: all
115-
LGTM_INDEX_FILETYPES: ".json:JSON\n.cds:JSON"
116-
117-
shell: bash
118-
run: >
119-
qlt test run execute-unit-tests
120-
--codeql-args "--threads=0 --strict-test-discovery"
121-
--num-threads 2
122-
--language javascript
123-
--runner-os $RUNNER_OS
124-
--work-dir $RUNNER_TMP
125-
126-
- name: Upload test results
127-
uses: actions/upload-artifact@v6
128-
with:
129-
name: test-results-${{ runner.os }}-${{ matrix.codeql_cli }}-${{ matrix.codeql_standard_library_ident }}
130-
path: |
131-
${{ runner.temp }}/test_report_${{ runner.os }}_${{ matrix.codeql_cli }}_${{ matrix.codeql_standard_library_ident }}_slice_*.json
132-
if-no-files-found: error
133-
134-
validate-test-results:
135-
name: Validate test results
136-
needs: [run-test-suites]
137-
runs-on: ubuntu-latest
138-
steps:
139-
140-
- name: Checkout repository
141-
uses: actions/checkout@v6
142-
143-
- name: Install QLT
144-
id: install-qlt
145-
uses: advanced-security/codeql-development-toolkit/.github/actions/install-qlt@main
146-
with:
147-
qlt-version: 'latest'
148-
add-to-path: true
149-
150-
151-
- name: Collect test results
152-
uses: actions/download-artifact@v7
153-
154-
- name: Validate test results
155-
run: |
156-
qlt test run validate-unit-tests --pretty-print --results-directory . >> $GITHUB_STEP_SUMMARY
157-
qlt test run validate-unit-tests --results-directory .
1+
name: QL Unit Tests (Linux)
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
branches:
9+
- 'main'
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
create-unit-test-matrix:
17+
name: Create CodeQL Unit Test Matrix
18+
runs-on: ubuntu-latest
19+
outputs:
20+
matrix: ${{ steps.export-unit-test-matrix.outputs.matrix }}
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v6
24+
25+
- name: Install QLT
26+
id: install-qlt
27+
uses: advanced-security/codeql-development-toolkit/.github/actions/install-qlt@main
28+
with:
29+
qlt-version: 'latest'
30+
add-to-path: true
31+
32+
- name: Export unit test matrix
33+
id: export-unit-test-matrix
34+
run: |
35+
qlt test run get-matrix --os-version ubuntu-latest
36+
37+
run-test-suites:
38+
name: Run Unit Tests
39+
needs: create-unit-test-matrix
40+
41+
runs-on: ${{ matrix.os }}
42+
strategy:
43+
fail-fast: false
44+
matrix: ${{ fromJSON(needs.create-unit-test-matrix.outputs.matrix) }}
45+
46+
steps:
47+
- name: Checkout repository
48+
uses: actions/checkout@v6
49+
50+
- name: Install QLT
51+
id: install-qlt
52+
uses: advanced-security/codeql-development-toolkit/.github/actions/install-qlt@main
53+
with:
54+
qlt-version: 'latest'
55+
add-to-path: true
56+
57+
- name: Install CodeQL
58+
id: install-codeql
59+
shell: bash
60+
run: |
61+
echo "Installing CodeQL"
62+
qlt codeql run install
63+
echo "-----------------------------"
64+
echo "CodeQL Home: $QLT_CODEQL_HOME"
65+
echo "CodeQL Binary: $QLT_CODEQL_PATH"
66+
67+
- name: Verify Versions of Tooling
68+
shell: bash
69+
run: |
70+
echo -e "Checking CodeQL Version:"
71+
$QLT_CODEQL_PATH --version
72+
73+
echo -e "Checking QLT Version:"
74+
echo "QLT Home: ${{ steps.install-qlt.outputs.qlt-home }}"
75+
qlt version
76+
77+
- name: Install QL Packs
78+
shell: bash
79+
run: |
80+
qlt query run install-packs
81+
82+
- name: Setup Node.js for CDS compilation
83+
uses: actions/setup-node@v6
84+
with:
85+
node-version: '20'
86+
cache: 'npm'
87+
cache-dependency-path: 'extractors/cds/tools/package-lock.json'
88+
89+
- name: Verify Node.js and npm tools
90+
run: |
91+
echo "Node.js version: $(node --version)"
92+
echo "npm version: $(npm --version)"
93+
echo "npx version: $(npx --version)"
94+
# Verify npx can access @sap/cds-dk without installing globally
95+
echo "Testing npx access to @sap/cds-dk..."
96+
npx --yes --package @sap/cds-dk@latest cds --version || echo "CDS will be installed per-project as needed"
97+
98+
# Compile .cds files to .cds.json files using the dedicated test script
99+
- name: Compile CAP CDS files
100+
run: |
101+
# Use the dedicated CDS compilation script that includes proper version resolution
102+
# This script follows the same logic as the CDS extractor's resolveCdsVersions function
103+
./extractors/cds/tools/workflow/cds-compilation-for-actions.sh
104+
105+
- name: Run test suites
106+
id: run-test-suites
107+
env:
108+
RUNNER_OS: ${{ runner.os }}
109+
CODEQL_CLI: ${{ matrix.codeql_cli }}
110+
CODEQL_STDLIB: ${{ matrix.codeql_standard_library }}
111+
CODEQL_STDLIB_IDENT: ${{matrix.codeql_standard_library_ident}}
112+
RUNNER_TMP: ${{ runner.temp }}
113+
LGTM_INDEX_XML_MODE: all
114+
LGTM_INDEX_FILETYPES: ".json:JSON\n.cds:JSON"
115+
116+
shell: bash
117+
run: >
118+
qlt test run execute-unit-tests
119+
--codeql-args "--threads=0 --strict-test-discovery"
120+
--num-threads 2
121+
--language javascript
122+
--runner-os $RUNNER_OS
123+
--work-dir $RUNNER_TMP
124+
125+
- name: Upload test results
126+
uses: actions/upload-artifact@v6
127+
with:
128+
name: test-results-${{ runner.os }}-${{ matrix.codeql_cli }}-${{ matrix.codeql_standard_library_ident }}
129+
path: |
130+
${{ runner.temp }}/test_report_${{ runner.os }}_${{ matrix.codeql_cli }}_${{ matrix.codeql_standard_library_ident }}_slice_*.json
131+
if-no-files-found: error
132+
133+
validate-test-results:
134+
name: Validate test results
135+
needs: [run-test-suites]
136+
runs-on: ubuntu-latest
137+
steps:
138+
139+
- name: Checkout repository
140+
uses: actions/checkout@v6
141+
142+
- name: Install QLT
143+
id: install-qlt
144+
uses: advanced-security/codeql-development-toolkit/.github/actions/install-qlt@main
145+
with:
146+
qlt-version: 'latest'
147+
add-to-path: true
148+
149+
150+
- name: Collect test results
151+
uses: actions/download-artifact@v7
152+
153+
- name: Validate test results
154+
run: |
155+
qlt test run validate-unit-tests --pretty-print --results-directory . >> $GITHUB_STEP_SUMMARY
156+
qlt test run validate-unit-tests --results-directory .

0 commit comments

Comments
 (0)