Skip to content

Commit 862895c

Browse files
committed
test workflow for bundle integration test
1 parent b575893 commit 862895c

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: ⚙️ Integration Test Bundle (CPP)
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
workflow_dispatch:
11+
12+
jobs:
13+
integration-test:
14+
name: Run Bundle Integration Test
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 --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 ; 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: Upload Bundle Used
65+
uses: actions/upload-artifact@v2
66+
with:
67+
name: codeql-bundle.tar.gz
68+
path: |
69+
${{ env.QLT_CODEQL_BUNDLE_PATH }}
70+
if-no-files-found: error
71+
72+
- name: Initialize CodeQL
73+
uses: github/codeql-action/init@v2
74+
with:
75+
languages: ${{ matrix.language }}
76+
tools: ${{ env.QLT_CODEQL_BUNDLE_PATH }}
77+
78+
- name: Autobuild
79+
uses: github/codeql-action/autobuild@v2
80+
with:
81+
working-directory: integration-tests/${{ matrix.language }}/src/ # Path containing the example application
82+
83+
- name: Perform CodeQL Analysis
84+
id: analysis
85+
uses: github/codeql-action/analyze@v2
86+
87+
- name: Validate SARIF Location
88+
shell: bash
89+
run: |
90+
# validate we have the actual sarif results
91+
echo "Checking SARIF file location at: ${{ steps.analysis.outputs.sarif-output }}"
92+
ls -l ${{ steps.analysis.outputs.sarif-output }}
93+
94+
- name: Upload SARIF Results
95+
uses: actions/upload-artifact@v2
96+
with:
97+
name: actual.sarif
98+
path: |
99+
${{ steps.analysis.outputs.sarif-output }}/*.sarif
100+
if-no-files-found: error
101+
102+
- name: Validate SARIF Existence
103+
shell: bash
104+
run: |
105+
ls -l ${{ steps.analysis.outputs.sarif-output }}/*.sarif
106+
107+
- name: Validate SARIF Results
108+
shell: bash
109+
run: |
110+
# Compare the expected vs the actual
111+
qlt bundle run validate-integration-tests --expected integration-tests/${{ matrix.language }}/expected.sarif --actual ${{ steps.analysis.outputs.sarif-output }}/${{ matrix.language }}.sarif

0 commit comments

Comments
 (0)