11name : " Zstandard bundle"
2- description : " Tests using a CodeQL Bundle compressed using Zstandard "
2+ description : " Tests the feature flag that downloads a Zstandard-compressed CodeQL Bundle by default "
33versions :
44 - linked
55operatingSystems :
66 - ubuntu
77env :
88 CODEQL_ACTION_ZSTD_BUNDLE : true
99steps :
10+ - name : Remove CodeQL from toolcache
11+ run : |
12+ rm -rf $RUNNER_TOOL_CACHE/CodeQL
1013 - id : init
1114 uses : ./../action/init
1215 with :
@@ -17,3 +20,44 @@ steps:
1720 shell : bash
1821 run : ./build.sh
1922 - uses : ./../action/analyze
23+ with :
24+ output : ${{ runner.temp }}/results
25+ upload-database : false
26+ - name : Upload SARIF
27+ uses : actions/upload-artifact@v3
28+ with :
29+ name : zstd-bundle.sarif
30+ path : ${{ runner.temp }}/results/cpp.sarif
31+ retention-days : 7
32+ - name : Check diagnostic with expected tools URL appears in SARIF
33+ uses : actions/github-script@v7
34+ env :
35+ SARIF_PATH : ${{ runner.temp }}/results/cpp.sarif
36+ with :
37+ script : |
38+ const fs = require('fs');
39+
40+ const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
41+ const run = sarif.runs[0];
42+
43+ const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
44+ const downloadTelemetryNotifications = toolExecutionNotifications.filter(n =>
45+ n.descriptor.id === 'codeql-action/bundle-download-telemetry'
46+ );
47+ if (downloadTelemetryNotifications.length !== 1) {
48+ core.setFailed(
49+ 'Expected exactly one reporting descriptor in the ' +
50+ `'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
51+ `${downloadTelemetryNotifications.length}. All notification reporting descriptors: ` +
52+ `${JSON.stringify(toolExecutionNotifications)}.`
53+ );
54+ }
55+
56+ const toolsUrl = downloadTelemetryNotifications[0].properties.attributes.toolsUrl;
57+ console.log(`Found tools URL: ${toolsUrl}`);
58+
59+ if (!toolsUrl.endsWith('.tar.zst')) {
60+ core.setFailed(
61+ `Expected the tools URL to be a .tar.zst file, but found ${toolsUrl}.`
62+ );
63+ }
0 commit comments