From c7f72c5aa9523925603a20e270dd439ee4e006d3 Mon Sep 17 00:00:00 2001 From: Taj Date: Fri, 20 Jan 2023 17:13:14 +0000 Subject: [PATCH] Ensure cli using latest version from the supported_cli_versions.json (#1992) --- .github/workflows/bump-cli.yml | 6 +++--- .github/workflows/main.yml | 2 +- extensions/ql-vscode/supported_cli_versions.json | 1 + extensions/ql-vscode/test/vscode-tests/ensureCli.ts | 7 ++++--- scripts/replace-cli-version.sh | 3 +-- supported_cli_versions.json | 8 -------- 6 files changed, 10 insertions(+), 17 deletions(-) create mode 100644 extensions/ql-vscode/supported_cli_versions.json delete mode 100644 supported_cli_versions.json diff --git a/.github/workflows/bump-cli.yml b/.github/workflows/bump-cli.yml index ec02afde7..aa30c9aff 100644 --- a/.github/workflows/bump-cli.yml +++ b/.github/workflows/bump-cli.yml @@ -45,10 +45,10 @@ jobs: - name: Prepend another version if: ${{ inputs.option == 'prepend' }} run: | - cat supported_cli_versions.json | jq '. |= ["${{ inputs.version }}"] + .' > supported_cli_versions_temp.json - mv supported_cli_versions_temp.json supported_cli_versions.json + cat extensions/ql-vscode/supported_cli_versions.json | jq '. |= ["${{ inputs.version }}"] + .' > supported_cli_versions_temp.json + mv supported_cli_versions_temp.json extensions/ql-vscode/supported_cli_versions.json echo "LATEST_VERSION=${{ inputs.version }}" >> $GITHUB_ENV - echo "PREVIOUS_VERSION=`jq -r '.[1]' supported_cli_versions.json`" >> $GITHUB_ENV + echo "PREVIOUS_VERSION=`jq -r '.[1]' extensions/ql-vscode/supported_cli_versions.json`" >> $GITHUB_ENV - name: Commit, Push and Open a PR uses: ./.github/actions/create-pr with: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 383b826e9..75bc523b3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -191,7 +191,7 @@ jobs: uses: actions/checkout@v3 - name: Set the variables id: set-variables - run: echo "cli-versions=$(cat ./supported_cli_versions.json | jq -rc)" >> $GITHUB_OUTPUT + run: echo "cli-versions=$(cat ./extensions/ql-vscode/supported_cli_versions.json | jq -rc)" >> $GITHUB_OUTPUT outputs: cli-versions: ${{ steps.set-variables.outputs.cli-versions }} cli-test: diff --git a/extensions/ql-vscode/supported_cli_versions.json b/extensions/ql-vscode/supported_cli_versions.json new file mode 100644 index 000000000..4519a2f0c --- /dev/null +++ b/extensions/ql-vscode/supported_cli_versions.json @@ -0,0 +1 @@ +["v2.11.6", "v2.7.6", "v2.8.5", "v2.9.4", "v2.10.5", "nightly"] diff --git a/extensions/ql-vscode/test/vscode-tests/ensureCli.ts b/extensions/ql-vscode/test/vscode-tests/ensureCli.ts index bf5930690..b56843d30 100644 --- a/extensions/ql-vscode/test/vscode-tests/ensureCli.ts +++ b/extensions/ql-vscode/test/vscode-tests/ensureCli.ts @@ -6,6 +6,7 @@ import { codeQlLauncherName, } from "../../src/pure/distribution"; import fetch from "node-fetch"; +import supportedCliVersions from "../../supported_cli_versions.json"; /** * This module ensures that the proper CLI is available for tests of the extension. @@ -36,9 +37,9 @@ import fetch from "node-fetch"; const _1MB = 1024 * 1024; const _10MB = _1MB * 10; -// CLI version to test. Hard code the latest as default. And be sure -// to update the env if it is not otherwise set. -const CLI_VERSION = process.env.CLI_VERSION || "v2.11.6"; +// CLI version to test. Use the latest supported version by default. +// And be sure to update the env if it is not otherwise set. +const CLI_VERSION = process.env.CLI_VERSION || supportedCliVersions[0]; process.env.CLI_VERSION = CLI_VERSION; // Base dir where CLIs will be downloaded into diff --git a/scripts/replace-cli-version.sh b/scripts/replace-cli-version.sh index a4a663b1a..03db7fec0 100755 --- a/scripts/replace-cli-version.sh +++ b/scripts/replace-cli-version.sh @@ -9,5 +9,4 @@ PREVIOUS_VERSION=$(echo $VERSIONS | awk '{ print $2 }') echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV echo "PREVIOUS_VERSION=$PREVIOUS_VERSION" >> $GITHUB_ENV -sed -i "s/$PREVIOUS_VERSION/$LATEST_VERSION/g" supported_cli_versions.json -sed -i "s/$PREVIOUS_VERSION/$LATEST_VERSION/g" extensions/ql-vscode/test/vscode-tests/ensureCli.ts +sed -i "s/$PREVIOUS_VERSION/$LATEST_VERSION/g" extensions/ql-vscode/supported_cli_versions.json diff --git a/supported_cli_versions.json b/supported_cli_versions.json deleted file mode 100644 index 9359b4a75..000000000 --- a/supported_cli_versions.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "v2.11.6", - "v2.7.6", - "v2.8.5", - "v2.9.4", - "v2.10.5", - "nightly" -]