Skip to content

Commit 26cb693

Browse files
authored
Merge pull request #22 from advanced-security/jsinglet/repo-library-issue
adding new option for default codescanning config
2 parents 35baef8 + 4367b9a commit 26cb693

File tree

20 files changed

+511
-38
lines changed

20 files changed

+511
-38
lines changed

.github/workflows/internal-pr-bundle-integration-test-cpp.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,12 @@ jobs:
6666
with:
6767
languages: ${{ matrix.language }}
6868
queries: security-extended
69-
source-root: integration-tests/cpp/src/ # Path containing the example application
7069
tools: ${{ env.QLT_CODEQL_BUNDLE_PATH }}
7170

7271
- name: Autobuild
7372
uses: github/codeql-action/autobuild@v2
7473
with:
75-
working-directory: integration-tests/cpp/src/ # Path containing the example application
74+
working-directory: example/integration-tests/cpp/src/ # Path containing the example application
7675

7776
- name: Perform CodeQL Analysis
7877
id: analysis
@@ -105,4 +104,4 @@ jobs:
105104
shell: bash
106105
run: |
107106
# 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
107+
qlt bundle run validate-integration-tests --expected example/integration-tests/cpp/expected.sarif --actual ${{ steps.analysis.outputs.sarif-output }}/cpp.sarif

.github/workflows/internal-validate-workflow-files.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ jobs:
4747
exit 1
4848
fi
4949
50+
- name: Generate Workflow Files (Bundle Feature)
51+
shell: bash
52+
run: |
53+
if ! qlt bundle init --use-runner ubuntu-latest --language cpp --automation-type actions --development --overwrite-existing ; then
54+
echo "Failed to generate bundle workflow files."
55+
exit 1
56+
fi
57+
58+
5059
- name: Check Git Clean Status
5160
shell: bash
5261
run: |
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
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+
30+
- name: Install QLT
31+
id: install-qlt
32+
uses: ./.github/actions/install-qlt-local
33+
with:
34+
qlt-version: 'latest'
35+
add-to-path: true
36+
37+
38+
- name: Validate QLT Installation
39+
shell: bash
40+
run: |
41+
echo -e "Checking QLT Version:"
42+
echo "QLT Home: ${{ steps.install-qlt.outputs.qlt-home }}"
43+
qlt version
44+
45+
46+
- name: Create Bundle (compiled)
47+
shell: bash
48+
run: |
49+
if ! qlt codeql run install --custom-bundle --base example/ ; then
50+
echo "Failed to generate bundle."
51+
exit 1
52+
fi
53+
54+
# ensure bundle runs
55+
56+
if ! qlt query run install-packs --use-bundle --base example/ ; then
57+
echo "Failed to install query packs with tool."
58+
exit 1
59+
fi
60+
61+
62+
- name: Validate Bundle Existence
63+
shell: bash
64+
run: |
65+
echo "Checking Bundle Existence"
66+
ls -l ${{ env.QLT_CODEQL_HOME }}/../out/
67+
68+
- name: Upload Bundle Used
69+
uses: actions/upload-artifact@v2
70+
with:
71+
name: codeql-bundle.tar.gz
72+
path: |
73+
${{ env.QLT_CODEQL_BUNDLE_PATH }}
74+
if-no-files-found: error
75+
76+
- name: Initialize CodeQL
77+
uses: github/codeql-action/init@v2
78+
with:
79+
languages: ${{ matrix.language }}
80+
tools: ${{ env.QLT_CODEQL_BUNDLE_PATH }}
81+
82+
83+
84+
- name: Autobuild
85+
uses: github/codeql-action/autobuild@v2
86+
with:
87+
working-directory: example/integration-tests/${{ matrix.language }}/src/ # Path containing the example application
88+
89+
90+
91+
- name: Perform CodeQL Analysis
92+
id: analysis
93+
uses: github/codeql-action/analyze@v2
94+
95+
- name: Validate SARIF Location
96+
shell: bash
97+
run: |
98+
# validate we have the actual sarif results
99+
echo "Checking SARIF file location at: ${{ steps.analysis.outputs.sarif-output }}"
100+
ls -l ${{ steps.analysis.outputs.sarif-output }}
101+
102+
- name: Upload SARIF Results
103+
uses: actions/upload-artifact@v2
104+
with:
105+
name: actual.sarif
106+
path: |
107+
${{ steps.analysis.outputs.sarif-output }}/*.sarif
108+
if-no-files-found: error
109+
110+
- name: Validate SARIF Existence
111+
shell: bash
112+
run: |
113+
ls -l ${{ steps.analysis.outputs.sarif-output }}/*.sarif
114+
115+
116+
117+
118+
- name: Validate SARIF Results
119+
shell: bash
120+
run: |
121+
# Compare the expected vs the actual
122+
qlt bundle run validate-integration-tests --expected example/integration-tests/${{ matrix.language }}/expected.sarif --actual ${{ steps.analysis.outputs.sarif-output }}/${{ matrix.language }}.sarif
123+

example/qlt.conf.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
"CodeQLCLIBundle": "codeql-bundle-v2.15.5",
55
"EnableCustomCodeQLBundles": true,
66
"CodeQLStandardLibraryIdent": "codeql-cli_v2.15.5",
7-
"CustomizationPacks" : [
7+
"CodeQLPackConfiguration" : [
88
{
99
"Name": "qlt/cpp-customizations",
10-
"Export" : true
10+
"Bundle" : true
1111
},
1212
{
1313
"Name": "qlt2/stuff2-tests",
14-
"Export" : false
14+
"Bundle" : false,
15+
"ReferencesBundle" : true
1516
}
1617
]
1718
}

src/CodeQLToolkit.Core/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"profiles": {
33
"CodeQLToolkit.Core": {
44
"commandName": "Project",
5-
"commandLineArgs": "--base C:\\Projects\\codeql-development-lifecycle-toolkit\\example bundle set enable-custom-bundles"
5+
"commandLineArgs": "bundle init --use-runner ubuntu-latest --language cpp --automation-type actions --development --overwrite-existing"
66
}
77
}
88
}

src/CodeQLToolkit.Core/ver.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.17
1+
0.0.23

src/CodeQLToolkit.Features/Bundle/Lifecycle/BaseLifecycleTarget.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@ namespace CodeQLToolkit.Features.Bundle.Lifecycle
88
{
99
abstract public class BaseLifecycleTarget : ILifecycleTarget
1010
{
11-
public int NumThreads { get; set; }
1211
public string UseRunner { get; set; }
1312

14-
public string ExtraArgs { get; set; }
15-
16-
17-
1813
}
1914
}

0 commit comments

Comments
 (0)