1+ name : ⚙️ Integration Test Bundle on PR (CPP)
2+
3+ on :
4+ push :
5+ branches :
6+ - ' main'
7+ pull_request :
8+ branches :
9+ - ' main'
10+ workflow_dispatch :
11+
12+ jobs :
13+ analyze :
14+ name : Analyze
15+ runs-on : ubuntu-latest
16+ permissions :
17+ actions : read
18+ contents : read
19+ security-events : write
20+ strategy :
21+ fail-fast : false
22+ matrix :
23+ language : [ 'cpp' ]
24+
25+ steps :
26+ - name : Checkout repository
27+ uses : actions/checkout@v4
28+
29+ - name : Install QLT
30+ id : install-qlt
31+ uses : ./.github/actions/install-qlt-local
32+ with :
33+ qlt-version : ' latest'
34+ add-to-path : true
35+
36+ - name : Validate QLT Installation
37+ shell : bash
38+ run : |
39+ echo -e "Checking QLT Version:"
40+ echo "QLT Home: ${{ steps.install-qlt.outputs.qlt-home }}"
41+ qlt version
42+
43+ - name : Create Bundle (compiled)
44+ shell : bash
45+ run : |
46+ if ! qlt codeql run install --base example/ --custom-bundle ; then
47+ echo "Failed to generate bundle."
48+ exit 1
49+ fi
50+
51+ # ensure bundle runs
52+
53+ if ! qlt query run install-packs --use-bundle --base example/ ; then
54+ echo "Failed to install query packs with tool."
55+ exit 1
56+ fi
57+
58+ - name : Validate Bundle Existence
59+ shell : bash
60+ run : |
61+ echo "Checking Bundle Existence"
62+ ls -l ${{ env.QLT_CODEQL_HOME }}/../out/
63+
64+ - name : Initialize CodeQL
65+ uses : github/codeql-action/init@v2
66+ with :
67+ languages : ${{ matrix.language }}
68+ queries : security-extended
69+ source-root : integration-tests/cpp/src/ # Path containing the example application
70+ tools : ${{ env.QLT_CODEQL_BUNDLE_PATH }}
71+
72+ - name : Autobuild
73+ uses : github/codeql-action/autobuild@v2
74+ with :
75+ working-directory : integration-tests/cpp/src/ # Path containing the example application
76+
77+ - name : Perform CodeQL Analysis
78+ id : analysis
79+ uses : github/codeql-action/analyze@v2
80+
81+ - name : Validate SARIF Location
82+ shell : bash
83+ run : |
84+ # validate we have the actual sarif results
85+ echo "Checking SARIF file location at: ${{ steps.analysis.outputs.sarif-output }}"
86+ ls -l ${{ steps.analysis.outputs.sarif-output }}
87+
88+ - name : Upload SARIF Results
89+ uses : actions/upload-artifact@v2
90+ with :
91+ name : actual.sarif
92+ path : |
93+ ${{ steps.analysis.outputs.sarif-output }}/*.sarif
94+ if-no-files-found : error
95+
96+ - name : Upload Bundle Used
97+ uses : actions/upload-artifact@v2
98+ with :
99+ name : codeql-bundle.tar.gz
100+ path : |
101+ ${{ env.QLT_CODEQL_BUNDLE_PATH }}
102+ if-no-files-found : error
103+
104+ - name : Validate SARIF Results
105+ shell : bash
106+ run : |
107+ # Compare the expected vs the actual
108+ qlt bundle run validate-integration-tests --expected integration-tests/cpp/expected.sarif --actual ${{ steps.analysis.outputs.sarif-output }}/cpp.sarif
0 commit comments