1414 workflow_dispatch :
1515
1616env :
17- CODEQL_VERSION : 2.20.4
18-
17+ CODEQL_VERSION : 2.21.2
18+
1919jobs :
2020 build :
2121 runs-on : windows-latest
@@ -65,17 +65,17 @@ jobs:
6565 - name : Build all Windows queries
6666 shell : cmd
6767 run : .\codeql-cli\codeql.cmd query compile --check-only .\src
68-
68+
6969 test-query-health :
7070 runs-on : windows-latest
7171 needs : build
7272 permissions :
7373 contents : read
7474 packages : write
75+ id-token : write
7576 env :
76- CONNECTION_STRING : ${{ secrets.CONNECTION_STRING }}
77+ ACCOUNT_NAME : ${{ secrets.ACCOUNT_NAME }}
7778 SHARE_NAME : ${{ secrets.SHARE_NAME }}
78- CONTAINER_NAME : ${{ secrets.CONTAINER_NAME }}
7979 steps :
8080 - name : Enable long git paths
8181 shell : cmd
@@ -108,14 +108,33 @@ jobs:
108108 pip install -r .\src\drivers\test\requirements.txt
109109 - name : Add msbuild to PATH
110110 uses : microsoft/setup-msbuild@v2
111+ - name : Azure Login
112+ uses : azure/login@v2
113+ with :
114+ client-id : ${{ secrets.AZURE_CLIENT_ID }}
115+ tenant-id : ${{ secrets.AZURE_TENANT_ID }}
116+ subscription-id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
117+ enable-AzPSSession : true
118+ - name : Download previous results
119+ uses : azure/powershell@v2
120+ with :
121+ azPSVersion : latest
122+ inlineScript : |
123+ $context = New-AzStorageContext -StorageAccountName "$env:ACCOUNT_NAME" -UseConnectedAccount -EnableFileBackupRequestIntent
124+ $destination = "azure-detailedfunctiontestresults.xlsx"
125+ Get-AzStorageFileContent -ShareName "$env:SHARE_NAME" -Path "detailedfunctiontestresults.xlsx" -Destination $destination -Context $context
111126 - name : Run test script
112127 shell : pwsh
113- if : ${{ env.CONNECTION_STRING != '' }}
114- run : python src\drivers\test\build_create_analyze_test.py --codeql_path .\codeql-cli\codeql.exe --no_build --compare_results --connection_string "$env:CONNECTION_STRING" --share_name "$env:SHARE_NAME" --container_name "$env:CONTAINER_NAME" -v
115- - name : Run test script without compare
116- shell : pwsh
117- if : ${{ env.CONNECTION_STRING == '' }}
118- run : python src\drivers\test\build_create_analyze_test.py --codeql_path .\codeql-cli\codeql.exe --no_build -v
128+ run : python src\drivers\test\build_create_analyze_test.py --codeql_path .\codeql-cli\codeql.exe --no_build --compare_results -v
129+ - name : Upload result diff
130+ if : ${{ hashFiles('diffdetailedfunctiontestresults.xlsx') != '' }} # Only upload if there are changes
131+ uses : azure/powershell@v2
132+ with :
133+ azPSVersion : latest
134+ inlineScript : |
135+ $context = New-AzStorageContext -StorageAccountName "$env:ACCOUNT_NAME" -UseConnectedAccount -EnableFileBackupRequestIntent
136+ Set-AzStorageFileContent -ShareName "$env:SHARE_NAME" -Source "diffdetailedfunctiontestresults.xlsx" -Path "health-diffdetailedfunctiontestresults.xlsx" -Context $context
137+ exit 1
119138
120139
121140 test-codeql-latest-vs-current :
@@ -126,15 +145,11 @@ jobs:
126145 permissions :
127146 contents : read
128147 packages : write
148+ id-token : write
129149 env :
130- CONNECTION_STRING : ${{ secrets.CONNECTION_STRING }}
150+ ACCOUNT_NAME : ${{ secrets.ACCOUNT_NAME }}
131151 SHARE_NAME : ${{ secrets.SHARE_NAME }}
132- CONTAINER_NAME : ${{ secrets.CONTAINER_NAME }}
133152 steps :
134- - name : Check Env
135- shell : pwsh
136- if : ${{ env.CONNECTION_STRING == '' }}
137- run : exit 1
138153 - name : Check Prev Job
139154 if : ${{ needs.test-query-health.result == 'failure' }}
140155 shell : pwsh
@@ -148,11 +163,13 @@ jobs:
148163 path : .
149164 fetch-depth : 0
150165 - name : CodeQL Download
151- run :
152- $latest=(((Invoke-WebRequest -Uri https://github.com/github/codeql-cli-binaries/releases/latest).links.href | Where-Object{$_ -like "/github/codeql-cli-binaries/releases/tag/v*"}[0]) -split "/")[-1];
153- Invoke-WebRequest -Uri "https://github.com/github/codeql-cli-binaries/releases/download/$latest/codeql-win64.zip" -OutFile codeql-win64.zip;
154- Expand-Archive -Path codeql-win64.zip -DestinationPath .\codeql-zip -Force;
166+ run : |
167+ $latest=(((Invoke-WebRequest -Uri https://github.com/github/codeql-cli-binaries/releases/latest).links.href | Where-Object{$_ -like "/github/codeql-cli-binaries/releases/tag/v*"}[0]) -split "/")[-1]
168+ Invoke-WebRequest -Uri "https://github.com/github/codeql-cli-binaries/releases/download/$latest/codeql-win64.zip" -OutFile codeql-win64.zip
169+ Expand-Archive -Path codeql-win64.zip -DestinationPath .\codeql-zip -Force
155170 Move-Item -Path .\codeql-zip\codeql -Destination .\codeql-cli\
171+ New-Item LatestVersion -ItemType "Directory"
172+ New-Item LatestVersion/$latest
156173 - name : Install CodeQL pack dependencies
157174 shell : cmd
158175 run : |
@@ -171,9 +188,40 @@ jobs:
171188 pip install -r .\src\drivers\test\requirements.txt
172189 - name : Add msbuild to PATH
173190 uses : microsoft/setup-msbuild@v2
191+ - name : Azure Login
192+ uses : azure/login@v2
193+ with :
194+ client-id : ${{ secrets.AZURE_CLIENT_ID }}
195+ tenant-id : ${{ secrets.AZURE_TENANT_ID }}
196+ subscription-id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
197+ enable-AzPSSession : true
198+ - name : Download previous results
199+ uses : azure/powershell@v2
200+ with :
201+ azPSVersion : latest
202+ inlineScript : |
203+ $context = New-AzStorageContext -StorageAccountName "$env:ACCOUNT_NAME" -UseConnectedAccount -EnableFileBackupRequestIntent
204+ $destination = "azure-detailedfunctiontestresults.xlsx"
205+ Get-AzStorageFileContent -ShareName "$env:SHARE_NAME" -Path "detailedfunctiontestresults.xlsx" -Destination $destination -Context $context
174206 - name : Run test script
175207 shell : pwsh
176- run : python src\drivers\test\build_create_analyze_test.py --codeql_path .\codeql-cli\codeql.exe --no_build --compare_results --connection_string "$env:CONNECTION_STRING" --share_name "$env:SHARE_NAME" -v
208+ run : python src\drivers\test\build_create_analyze_test.py --codeql_path .\codeql-cli\codeql.exe --no_build --compare_results -v
209+ - name : Upload result diff
210+ if : ${{ hashFiles('diffdetailedfunctiontestresults.xlsx') != '' }} # Only upload if there are changes
211+ uses : azure/powershell@v2
212+ with :
213+ azPSVersion : latest
214+ inlineScript : |
215+ $context = New-AzStorageContext -StorageAccountName "$env:ACCOUNT_NAME" -UseConnectedAccount -EnableFileBackupRequestIntent
216+ Set-AzStorageFileContent -ShareName "$env:SHARE_NAME" -Source "diffdetailedfunctiontestresults.xlsx" -Path "version-diffdetailedfunctiontestresults.xlsx" -Context $context
217+ exit 1
218+ - name : Save Latest Version
219+ if : ${{ hashFiles('diffdetailedfunctiontestresults.xlsx') == '' }} # Only if there were no differences
220+ uses : actions/upload-artifact@v4
221+ with :
222+ name : latest-codeql-results
223+ path : |
224+ LatestVersion\*
177225
178226 test-pack-version-update :
179227 runs-on : windows-latest
@@ -198,7 +246,7 @@ jobs:
198246 $qlpack_diff = git diff HEAD~1:src/qlpack.yml src/qlpack.yml;
199247 $rec_diff = git diff HEAD~1:src/windows-driver-suites/recommended.qls src/windows-driver-suites/recommended.qls;
200248 $mf_diff = git diff HEAD~1:src/windows-driver-suites/mustfix.qls src/windows-driver-suites/mustfix.qls;
201- if (!$qlpack_diff -and ($rec_diff -or $mf_diff)) { "Query suite file updated without updating qlpack version"; exit 1 }
249+ if (!$qlpack_diff -and ($rec_diff -or $mf_diff)) { "Query suite file updated without updating qlpack version"; exit 2 }
202250
203251 $last_qlpack_commit = git log -n 1 --pretty=format:%H -- src/qlpack.yml;
204252 $qlpack_changes =git show $last_qlpack_commit -- .\src\qlpack.yml;
@@ -209,13 +257,14 @@ jobs:
209257 $commits_since_mf_change = [int](git rev-list --count HEAD...$last_mf_commit);
210258 $commits_since_rec_change = [int](git rev-list --count HEAD...$last_rec_commit);
211259
212- if ($commits_since_qlpack_change -gt $commits_since_mf_change) { "Mustfix query suite file modified without updating version"; exit 1 };
213- if ($commits_since_qlpack_change -gt $commits_since_rec_change) {"Recommended query suite file modified without updating version"; exit 1 };
260+ if ($commits_since_qlpack_change -gt $commits_since_mf_change) { "Mustfix query suite file modified without updating version"; exit 3 };
261+ if ($commits_since_qlpack_change -gt $commits_since_rec_change) {"Recommended query suite file modified without updating version"; exit 4 };
214262
215- try{$old_qlpack_version = [version]($qlpack_changes -match "-version").Substring(10);} catch {"Changed qlpack.yml without updating version"; exit 1 }
216- try{$new_qlpack_version = [version]($qlpack_changes -match "\+version").Substring(10);} catch {"Changed qlpack.yml without updating version"; exit 1 }
217- if ($new_qlpack_version -gt $old_qlpack_version) { exit 0 } else { "qlpack.yml version not incremented. Previously updated to version $old_qlpack_version, current version $new_qlpack_version"; exit 1 }
218-
263+ if($qlpack_changes -contains "version"){
264+ try{$old_qlpack_version = [version]($qlpack_changes -match "-version").Substring(10);} catch {"Changed qlpack.yml without updating version"; exit 5 }
265+ try{$new_qlpack_version = [version]($qlpack_changes -match "\+version").Substring(10);} catch {"Changed qlpack.yml without updating version"; exit 6 }
266+ if ($new_qlpack_version -gt $old_qlpack_version) { exit 0 } else { "qlpack.yml version not incremented. Previously updated to version $old_qlpack_version, current version $new_qlpack_version"; exit 7 }
267+ }
219268 test-create-dvl :
220269 runs-on : windows-latest
221270 needs : build
0 commit comments