Skip to content

Commit bee7d81

Browse files
Merge branch 'main' into robertbrignull/AlertTable-decompose
2 parents af1af07 + 3094405 commit bee7d81

File tree

6 files changed

+124
-53
lines changed

6 files changed

+124
-53
lines changed

.github/workflows/cli-test.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Run CLI tests
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
pull_request:
7+
types: [opened, synchronize, reopened, ready_for_review]
8+
paths:
9+
- extensions/ql-vscode/src/codeql-cli/**
10+
- extensions/ql-vscode/src/language-support/**
11+
- extensions/ql-vscode/src/query-server/**
12+
13+
jobs:
14+
find-nightly:
15+
name: Find Nightly Release
16+
runs-on: ubuntu-latest
17+
outputs:
18+
url: ${{ steps.get-url.outputs.nightly-url }}
19+
steps:
20+
- name: Get Nightly Release URL
21+
id: get-url
22+
env:
23+
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
24+
shell: bash
25+
# This workflow step gets an unstable testing version of the CodeQL CLI. It should not be used outside of these tests.
26+
run: |
27+
LATEST=`gh api repos/dsp-testing/codeql-cli-nightlies/releases --jq '.[].tag_name' --method GET --raw-field 'per_page=1'`
28+
echo "nightly-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$LATEST" >> "$GITHUB_OUTPUT"
29+
30+
set-matrix:
31+
name: Set Matrix for cli-test
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v3
36+
- name: Set the variables
37+
id: set-variables
38+
run: echo "cli-versions=$(cat ./extensions/ql-vscode/supported_cli_versions.json | jq -rc)" >> $GITHUB_OUTPUT
39+
outputs:
40+
cli-versions: ${{ steps.set-variables.outputs.cli-versions }}
41+
42+
cli-test:
43+
name: CLI Test
44+
runs-on: ${{ matrix.os }}
45+
needs: [find-nightly, set-matrix]
46+
timeout-minutes: 30
47+
strategy:
48+
matrix:
49+
os: [ubuntu-latest, windows-latest]
50+
version: ${{ fromJson(needs.set-matrix.outputs.cli-versions) }}
51+
fail-fast: false
52+
env:
53+
CLI_VERSION: ${{ matrix.version }}
54+
NIGHTLY_URL: ${{ needs.find-nightly.outputs.url }}
55+
TEST_CODEQL_PATH: '${{ github.workspace }}/codeql'
56+
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v3
60+
61+
- uses: actions/setup-node@v3
62+
with:
63+
node-version: '16.17.1'
64+
cache: 'npm'
65+
cache-dependency-path: extensions/ql-vscode/package-lock.json
66+
67+
- name: Install dependencies
68+
working-directory: extensions/ql-vscode
69+
run: |
70+
npm ci
71+
shell: bash
72+
73+
- name: Build
74+
working-directory: extensions/ql-vscode
75+
run: |
76+
npm run build
77+
shell: bash
78+
79+
- name: Decide on ref of CodeQL repo
80+
id: choose-ref
81+
shell: bash
82+
run: |
83+
if [[ "${{ matrix.version }}" == "nightly" ]]
84+
then
85+
REF="codeql-cli/latest"
86+
else
87+
REF="codeql-cli/${{ matrix.version }}"
88+
fi
89+
echo "ref=$REF" >> "$GITHUB_OUTPUT"
90+
91+
- name: Checkout QL
92+
uses: actions/checkout@v3
93+
with:
94+
repository: github/codeql
95+
ref: ${{ steps.choose-ref.outputs.ref }}
96+
path: codeql
97+
98+
- name: Run CLI tests (Linux)
99+
working-directory: extensions/ql-vscode
100+
if: matrix.os == 'ubuntu-latest'
101+
run: |
102+
unset DBUS_SESSION_BUS_ADDRESS
103+
/usr/bin/xvfb-run npm run test:cli-integration
104+
105+
- name: Run CLI tests (Windows)
106+
working-directory: extensions/ql-vscode
107+
if: matrix.os == 'windows-latest'
108+
run: |
109+
npm run test:cli-integration

.github/workflows/main.yml

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,6 @@ jobs:
5353
name: vscode-codeql-extension
5454
path: artifacts
5555

56-
find-nightly:
57-
name: Find Nightly Release
58-
runs-on: ubuntu-latest
59-
outputs:
60-
url: ${{ steps.get-url.outputs.nightly-url }}
61-
steps:
62-
- name: Get Nightly Release URL
63-
id: get-url
64-
env:
65-
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
66-
shell: bash
67-
# This workflow step gets an unstable testing version of the CodeQL CLI. It should not be used outside of these tests.
68-
run: |
69-
LATEST=`gh api repos/dsp-testing/codeql-cli-nightlies/releases --jq '.[].tag_name' --method GET --raw-field 'per_page=1'`
70-
echo "nightly-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$LATEST" >> "$GITHUB_OUTPUT"
71-
7256
lint:
7357
name: Lint
7458
runs-on: ubuntu-latest
@@ -198,31 +182,31 @@ jobs:
198182
run: |
199183
npm run test:vscode-integration
200184
201-
set-matrix:
202-
name: Set Matrix for cli-test
185+
get-latest-cli-version:
186+
name: Get latest CLI version
203187
runs-on: ubuntu-latest
204188
steps:
205189
- name: Checkout
206190
uses: actions/checkout@v3
207-
- name: Set the variables
208-
id: set-variables
209-
run: echo "cli-versions=$(cat ./extensions/ql-vscode/supported_cli_versions.json | jq -rc)" >> $GITHUB_OUTPUT
191+
- name: Set the variable
192+
id: set-variable
193+
run: |
194+
echo "cli-version=$(cat ./extensions/ql-vscode/supported_cli_versions.json | jq -rc '.[0]')" >> $GITHUB_OUTPUT
195+
echo "$cli-version"
210196
outputs:
211-
cli-versions: ${{ steps.set-variables.outputs.cli-versions }}
197+
cli-version: ${{ steps.set-variable.outputs.cli-version }}
212198

213199
cli-test:
214200
name: CLI Test
215201
runs-on: ${{ matrix.os }}
216-
needs: [find-nightly, set-matrix]
202+
needs: [get-latest-cli-version]
217203
timeout-minutes: 30
218204
strategy:
219205
matrix:
220206
os: [ubuntu-latest, windows-latest]
221-
version: ${{ fromJson(needs.set-matrix.outputs.cli-versions) }}
222207
fail-fast: false
223208
env:
224-
CLI_VERSION: ${{ matrix.version }}
225-
NIGHTLY_URL: ${{ needs.find-nightly.outputs.url }}
209+
CLI_VERSION: ${{ needs.get-latest-cli-version.outputs.cli-version }}
226210
TEST_CODEQL_PATH: '${{ github.workspace }}/codeql'
227211

228212
steps:
@@ -247,23 +231,11 @@ jobs:
247231
npm run build
248232
shell: bash
249233

250-
- name: Decide on ref of CodeQL repo
251-
id: choose-ref
252-
shell: bash
253-
run: |
254-
if [[ "${{ matrix.version }}" == "nightly" ]]
255-
then
256-
REF="codeql-cli/latest"
257-
else
258-
REF="codeql-cli/${{ matrix.version }}"
259-
fi
260-
echo "ref=$REF" >> "$GITHUB_OUTPUT"
261-
262234
- name: Checkout QL
263235
uses: actions/checkout@v3
264236
with:
265237
repository: github/codeql
266-
ref: ${{ steps.choose-ref.outputs.ref }}
238+
ref: 'codeql-cli/${{ needs.get-latest-cli-version.outputs.cli-version }}'
267239
path: codeql
268240

269241
- name: Run CLI tests (Linux)

docs/releasing.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Releasing (write access required)
22

3+
1. Run the ["Run CLI tests" workflow](https://github.com/github/vscode-codeql/actions/workflows/cli-test.yml) and make sure the tests are green. If there were no merges between the time the workflow ran (it runs daily), and the release, you can skip this step.
34
1. Double-check the `CHANGELOG.md` contains all desired change comments and has the version to be released with date at the top.
45
* Go through all recent PRs and make sure they are properly accounted for.
56
* Make sure all changelog entries have links back to their PR(s) if appropriate.

extensions/ql-vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1763,7 +1763,7 @@
17631763
{
17641764
"id": "codeQLModelDetails",
17651765
"name": "CodeQL Model Details",
1766-
"when": "config.codeQL.canary && config.codeQL.dataExtensions.modelDetailsView && codeql.dataExtensionsEditorOpen"
1766+
"when": "config.codeQL.canary && codeql.dataExtensionsEditorOpen"
17671767
}
17681768
]
17691769
},

extensions/ql-vscode/src/config.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -713,11 +713,6 @@ const EXTENSIONS_DIRECTORY = new Setting(
713713
"extensionsDirectory",
714714
DATA_EXTENSIONS,
715715
);
716-
const MODEL_DETAILS_VIEW = new Setting("modelDetailsView", DATA_EXTENSIONS);
717-
718-
export function showModelDetailsView(): boolean {
719-
return !!MODEL_DETAILS_VIEW.getValue<boolean>();
720-
}
721716

722717
export function showLlmGeneration(): boolean {
723718
return !!LLM_GENERATION.getValue<boolean>();

extensions/ql-vscode/src/data-extensions-editor/data-extensions-editor-view.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@ import { readQueryResults, runQuery } from "./external-api-usage-query";
3232
import { ExternalApiUsage, Usage } from "./external-api-usage";
3333
import { ModeledMethod } from "./modeled-method";
3434
import { ExtensionPack } from "./shared/extension-pack";
35-
import {
36-
enableFrameworkMode,
37-
showLlmGeneration,
38-
showModelDetailsView,
39-
} from "../config";
35+
import { enableFrameworkMode, showLlmGeneration } from "../config";
4036
import { Mode } from "./shared/mode";
4137
import { loadModeledMethods, saveModeledMethods } from "./modeled-method-fs";
4238
import { join } from "path";
@@ -280,9 +276,7 @@ export class DataExtensionsEditorView extends AbstractWebview<
280276
}
281277

282278
protected async handleJumpToUsage(usage: Usage) {
283-
if (showModelDetailsView()) {
284-
await this.revealItemInDetailsPanel(usage);
285-
}
279+
await this.revealItemInDetailsPanel(usage);
286280
await showResolvableLocation(usage.url, this.databaseItem, this.app.logger);
287281
}
288282

0 commit comments

Comments
 (0)