From 274a5e7d935bdef8c259767ecdf2bb21f92b1094 Mon Sep 17 00:00:00 2001 From: Mauro Baluda Date: Thu, 24 Sep 2026 15:07:12 +0200 Subject: [PATCH 1/4] Use platform-specific CodeQL bundles Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- ...nternal-pr-bundle-integration-test-cpp.yml | 5 +- ...internal-pr-test-quick-bundle-creation.yml | 48 +++++-------------- .../run-bundle-integration-tests-cpp.yml | 6 +-- .../CodeQL/Commands/Targets/InstallCommand.cs | 3 -- .../run-bundle-integration-tests.liquid | 5 +- .../CodeQL/CodeQLInstallation.cs | 11 ++--- src/CodeQLToolkit.Shared/CodeQL/RESOLUTION.md | 11 ++--- .../CodeQL/CodeQLInstallationTests.cs | 27 +++++++++++ 8 files changed, 49 insertions(+), 67 deletions(-) create mode 100644 test/CodeQLToolkit.Shared.Tests/CodeQL/CodeQLInstallationTests.cs diff --git a/.github/workflows/internal-pr-bundle-integration-test-cpp.yml b/.github/workflows/internal-pr-bundle-integration-test-cpp.yml index f732af3..1563bde 100644 --- a/.github/workflows/internal-pr-bundle-integration-test-cpp.yml +++ b/.github/workflows/internal-pr-bundle-integration-test-cpp.yml @@ -96,10 +96,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: codeql-bundles - path: | - ${{ env.QLT_CODEQL_BUNDLE_PATH_LINUX64 }} - ${{ env.QLT_CODEQL_BUNDLE_PATH_WIN64 }} - ${{ env.QLT_CODEQL_BUNDLE_PATH_OSX64 }} + path: ${{ env.QLT_CODEQL_BUNDLE_PATH }} if-no-files-found: error compression-level: 0 diff --git a/.github/workflows/internal-pr-test-quick-bundle-creation.yml b/.github/workflows/internal-pr-test-quick-bundle-creation.yml index 34e81cb..6f538d9 100644 --- a/.github/workflows/internal-pr-test-quick-bundle-creation.yml +++ b/.github/workflows/internal-pr-test-quick-bundle-creation.yml @@ -1,4 +1,4 @@ -name: ⚙️ Test Bundle Creation (Quick) +name: Test Platform Bundle Selection on: push: @@ -10,40 +10,16 @@ on: workflow_dispatch: jobs: - test-bundle-creation: - name: Test Bundle Creation - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 + test-platform-bundle: + name: Test Platform Bundle (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-15] - - name: Install QLT - id: install-qlt - uses: ./.github/actions/install-qlt-local + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-dotnet@v6 with: - qlt-version: 'latest' - add-to-path: true - - - name: Validate QLT Installation - shell: bash - run: | - echo -e "Checking QLT Version:" - echo "QLT Home: ${{ steps.install-qlt.outputs.qlt-home }}" - qlt version - - - name: Create Bundle (quick) - shell: bash - run: | - if ! qlt codeql run install --base example/ --quick-bundle ; then - echo "Failed to generate bundle." - exit 1 - fi - - # ensure bundle runs - - if ! qlt query run install-packs --use-bundle --base example/ ; then - echo "Failed to install query packs with tool." - exit 1 - fi - - + dotnet-version: 6.0.x + - run: dotnet test test/CodeQLToolkit.Shared.Tests/CodeQLToolkit.Shared.Tests.csproj diff --git a/.github/workflows/run-bundle-integration-tests-cpp.yml b/.github/workflows/run-bundle-integration-tests-cpp.yml index 6e051a6..cb05beb 100644 --- a/.github/workflows/run-bundle-integration-tests-cpp.yml +++ b/.github/workflows/run-bundle-integration-tests-cpp.yml @@ -68,10 +68,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: codeql-bundles - path: | - ${{ env.QLT_CODEQL_BUNDLE_PATH_LINUX64 }} - ${{ env.QLT_CODEQL_BUNDLE_PATH_WIN64 }} - ${{ env.QLT_CODEQL_BUNDLE_PATH_OSX64 }} + path: ${{ env.QLT_CODEQL_BUNDLE_PATH }} if-no-files-found: error compression-level: 0 @@ -122,4 +119,3 @@ jobs: run: | # Compare the expected vs the actual qlt bundle run validate-integration-tests --expected example/integration-tests/${{ matrix.language }}/expected.sarif --actual ${{ steps.analysis.outputs.sarif-output }}/${{ matrix.language }}.sarif - diff --git a/src/CodeQLToolkit.Features/CodeQL/Commands/Targets/InstallCommand.cs b/src/CodeQLToolkit.Features/CodeQL/Commands/Targets/InstallCommand.cs index f076448..3f51761 100644 --- a/src/CodeQLToolkit.Features/CodeQL/Commands/Targets/InstallCommand.cs +++ b/src/CodeQLToolkit.Features/CodeQL/Commands/Targets/InstallCommand.cs @@ -100,9 +100,6 @@ public override void Run() if (CustomBundles || QuickBundles) { SetEnvironmentVariableMultiTarget("QLT_CODEQL_BUNDLE_PATH", installation.CustomBundleOutputBundleCurrentPlatform); - SetEnvironmentVariableMultiTarget("QLT_CODEQL_BUNDLE_PATH_WIN64", installation.CustomBundleOutputBundleWindows); - SetEnvironmentVariableMultiTarget("QLT_CODEQL_BUNDLE_PATH_OSX64", installation.CustomBundleOutputBundleOSX); - SetEnvironmentVariableMultiTarget("QLT_CODEQL_BUNDLE_PATH_LINUX64", installation.CustomBundleOutputBundleLinux); } } diff --git a/src/CodeQLToolkit.Features/Templates/Bundle/Actions/run-bundle-integration-tests.liquid b/src/CodeQLToolkit.Features/Templates/Bundle/Actions/run-bundle-integration-tests.liquid index fd2c109..d7e0215 100644 --- a/src/CodeQLToolkit.Features/Templates/Bundle/Actions/run-bundle-integration-tests.liquid +++ b/src/CodeQLToolkit.Features/Templates/Bundle/Actions/run-bundle-integration-tests.liquid @@ -89,10 +89,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: codeql-bundles - path: | - ${{ env.QLT_CODEQL_BUNDLE_PATH_LINUX64 }} - ${{ env.QLT_CODEQL_BUNDLE_PATH_WIN64 }} - ${{ env.QLT_CODEQL_BUNDLE_PATH_OSX64 }} + path: ${{ env.QLT_CODEQL_BUNDLE_PATH }} if-no-files-found: error compression-level: 0 diff --git a/src/CodeQLToolkit.Shared/CodeQL/CodeQLInstallation.cs b/src/CodeQLToolkit.Shared/CodeQL/CodeQLInstallation.cs index d92346d..05c2642 100644 --- a/src/CodeQLToolkit.Shared/CodeQL/CodeQLInstallation.cs +++ b/src/CodeQLToolkit.Shared/CodeQL/CodeQLInstallation.cs @@ -137,9 +137,6 @@ public void Install() } public string CustomBundleOutputBundleCurrentPlatform => Path.Combine(CustomBundleOutputDirectory, $"codeql-bundle-{PlatformID}.tar.gz"); - public string CustomBundleOutputBundleLinux => Path.Combine(CustomBundleOutputDirectory, "codeql-bundle-linux64.tar.gz"); - public string CustomBundleOutputBundleWindows => Path.Combine(CustomBundleOutputDirectory, "codeql-bundle-win64.tar.gz"); - public string CustomBundleOutputBundleOSX => Path.Combine(CustomBundleOutputDirectory, "codeql-bundle-osx64.tar.gz"); public string CustomBundleOutputDirectory => Path.Combine(InstallationDirectory, "out"); @@ -205,10 +202,9 @@ private void CustomBundleInstall() Directory.CreateDirectory(InstallationDirectory); } - // Download the platform-independent bundle. Log.G().LogInformation($"Downloading CodeQL base bundle..."); - var downloadFile = $"codeql-bundle.tar.gz"; + var downloadFile = $"codeql-bundle-{PlatformID}.tar.gz"; var customBundlePath = Path.Combine(InstallationDirectory, downloadFile); Log.G().LogInformation($"Checking if existing source bundle {downloadFile} is present..."); @@ -221,7 +217,7 @@ private void CustomBundleInstall() { using var client = new WebClient(); string uri = $"https://github.com/github/codeql-action/releases/download/{CLIBundle}/{downloadFile}"; - Log.G().LogInformation($"Downloading platform-independent bundle from remote URL: {uri}..."); + Log.G().LogInformation($"Downloading platform-specific bundle from remote URL: {uri}..."); client.DownloadFile(uri, customBundlePath); } @@ -252,8 +248,7 @@ private void CustomBundleInstall() var packsToExport = CodeQLPackConfiguration.Where(p => p.Bundle == true).Select(p => p.Name).ToArray(); var packs = string.Join(" ", packsToExport); - // Run the bundling tool to create the platform-specific custom bundles from the platform-independent bundle - var bundleArgs = $"--log DEBUG -a qlt.conf.json -p win64 -p osx64 -p linux64 -b {customBundlePath} -o {CustomBundleOutputDirectory} -w {workingDirectory} {packs}"; + var bundleArgs = $"--log DEBUG -a qlt.conf.json -p {PlatformID} -b {customBundlePath} -o {CustomBundleOutputDirectory} -w {workingDirectory} {packs}"; if (QuickBundle) { diff --git a/src/CodeQLToolkit.Shared/CodeQL/RESOLUTION.md b/src/CodeQLToolkit.Shared/CodeQL/RESOLUTION.md index 0d1b4ca..e37cbbc 100644 --- a/src/CodeQLToolkit.Shared/CodeQL/RESOLUTION.md +++ b/src/CodeQLToolkit.Shared/CodeQL/RESOLUTION.md @@ -45,19 +45,16 @@ For a normal installation, the mapping of these values is as follows: For a bundle installation the mapping is as follows: -- `CodeQLCLIBundle` - The bundle downloaded from `github/codeql-action/releases` to base the bundle on. +- `CodeQLCLIBundle` - The `github/codeql-action` bundle release tag to base the bundle on. QLT downloads the platform-specific source bundle for the current host. In all cases, two environment variables are set after a run: - `QLT_CODEQL_PATH` - The path to the CodeQL binary. (Always set) - `QLT_CODEQL_HOME` - The root installation of CodeQL. (Always set) -When using custom bundles, four additional environmental variables are set after a run: -- `QLT_CODEQL_BUNDLE_PATH` - The path to the current platform bundle created by QLT. (Set when using custom bundles) -- `QLT_CODEQL_BUNDLE_PATH_WIN64` - The path to the Windows bundle created by QLT. (Set when using custom bundles) -- `QLT_CODEQL_BUNDLE_PATH_LINUX64` - The path to the Linux bundle created by QLT. (Set when using custom bundles) -- `QLT_CODEQL_BUNDLE_PATH_OSX64` - The path to the MacOS bundle created by QLT. (Set when using custom bundles) +When using custom bundles, one additional environment variable is set after a run: +- `QLT_CODEQL_BUNDLE_PATH` - The path to the current platform bundle created by QLT. -The environmental variable `QLT_CODE_BUNDLE_PATH` will map to one of the three other bundle variables. +Each invocation creates a bundle only for its current platform. Run QLT on each target operating system when Linux, Windows, and macOS bundles are all required. ## Idents within the Installation Directory diff --git a/test/CodeQLToolkit.Shared.Tests/CodeQL/CodeQLInstallationTests.cs b/test/CodeQLToolkit.Shared.Tests/CodeQL/CodeQLInstallationTests.cs new file mode 100644 index 0000000..9570fc6 --- /dev/null +++ b/test/CodeQLToolkit.Shared.Tests/CodeQL/CodeQLInstallationTests.cs @@ -0,0 +1,27 @@ +using System.Runtime.InteropServices; +using CodeQLToolkit.Shared.CodeQL; + +namespace CodeQLToolkit.Shared.Tests.CodeQL +{ + public class CodeQLInstallationTests + { + [Test] + public void UsesCurrentPlatformBundle() + { + var expectedPlatform = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + ? "win64" + : RuntimeInformation.IsOSPlatform(OSPlatform.Linux) + ? "linux64" + : "osx64"; + var installation = new CodeQLInstallation + { + CLIBundle = "test", + EnableCustomCodeQLBundles = true + }; + + Assert.That( + Path.GetFileName(installation.CustomBundleOutputBundleCurrentPlatform), + Is.EqualTo($"codeql-bundle-{expectedPlatform}.tar.gz")); + } + } +} From 934bfa611b65be07cbaabcc8da235a3ca4305d6a Mon Sep 17 00:00:00 2001 From: Mauro Baluda Date: Thu, 24 Sep 2026 16:21:38 +0200 Subject: [PATCH 2/4] Fix generated workflow formatting Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Bundle/Actions/run-bundle-integration-tests.liquid | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/CodeQLToolkit.Features/Templates/Bundle/Actions/run-bundle-integration-tests.liquid b/src/CodeQLToolkit.Features/Templates/Bundle/Actions/run-bundle-integration-tests.liquid index d7e0215..596fb9d 100644 --- a/src/CodeQLToolkit.Features/Templates/Bundle/Actions/run-bundle-integration-tests.liquid +++ b/src/CodeQLToolkit.Features/Templates/Bundle/Actions/run-bundle-integration-tests.liquid @@ -146,14 +146,12 @@ jobs: shell: bash run: | # Compare the expected vs the actual - qlt bundle run validate-integration-tests --expected example/integration-tests/${{ matrix.language }}/expected.sarif --actual ${{ steps.analysis.outputs.sarif-output }}/${{ matrix.language }}.sarif -{% endraw %} + qlt bundle run validate-integration-tests --expected example/integration-tests/${{ matrix.language }}/expected.sarif --actual ${{ steps.analysis.outputs.sarif-output }}/${{ matrix.language }}.sarif {% endraw %} {% else %} {% raw %} - name: Validate SARIF Results shell: bash run: | # Compare the expected vs the actual - qlt bundle run validate-integration-tests --expected integration-tests/${{ matrix.language }}/expected.sarif --actual ${{ steps.analysis.outputs.sarif-output }}/${{ matrix.language }}.sarif -{% endraw %} + qlt bundle run validate-integration-tests --expected integration-tests/${{ matrix.language }}/expected.sarif --actual ${{ steps.analysis.outputs.sarif-output }}/${{ matrix.language }}.sarif {% endraw %} {% endif %} \ No newline at end of file From f4a7ded500c74a47b80a0f5964ab87c34574aaf0 Mon Sep 17 00:00:00 2001 From: Mauro Baluda Date: Fri, 25 Sep 2026 01:16:33 +0200 Subject: [PATCH 3/4] Update workflows and scripts for CodeQL bundle version 0.6.0 and upgrade action versions --- .github/actions/install-qlt-local/action.yml | 4 ++-- .github/workflows/internal-build-release-linux64.yml | 6 +++--- .github/workflows/internal-build-release-macos64.yml | 6 +++--- .github/workflows/internal-build-release-win64.yml | 6 +++--- .github/workflows/internal-pr-build-linux.yml | 4 ++-- .github/workflows/internal-pr-test-bundle-creation.yml | 2 +- .../workflows/internal-pr-test-quick-bundle-creation.yml | 2 +- .github/workflows/internal-release-build.yml | 2 +- .github/workflows/internal-validate-workflow-files.yml | 2 +- .github/workflows/run-codeql-unit-tests-cpp.yml | 6 +++--- .github/workflows/validate-codeql-queries-cpp.yml | 4 ++-- developer_guide.md | 2 +- .../Templates/Test/Actions/run-unit-tests.liquid | 6 +++--- .../Validation/Actions/validate-query-metadata.liquid | 4 ++-- src/CodeQLToolkit.Shared/CodeQL/CodeQLInstallation.cs | 9 +++++++-- src/CodeQLToolkit.Shared/CodeQL/RESOLUTION.md | 3 ++- .../CodeQL/CodeQLInstallationTests.cs | 7 ++++++- 17 files changed, 43 insertions(+), 32 deletions(-) diff --git a/.github/actions/install-qlt-local/action.yml b/.github/actions/install-qlt-local/action.yml index efefa10..23fda23 100644 --- a/.github/actions/install-qlt-local/action.yml +++ b/.github/actions/install-qlt-local/action.yml @@ -24,7 +24,7 @@ runs: using: composite steps: - name: Setup .NET - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v6 with: dotnet-version: 6.0.x @@ -60,7 +60,7 @@ runs: pip install -U pyinstaller # run the packaging - ./scripts/build_codeql_bundle_dist.ps1 -Version 0.5.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Release/net6.0/publish/linux-x64/tools/ + ./scripts/build_codeql_bundle_dist.ps1 -Version 0.6.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Release/net6.0/publish/linux-x64/tools/ env: GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/internal-build-release-linux64.yml b/.github/workflows/internal-build-release-linux64.yml index 7434572..364c0ca 100644 --- a/.github/workflows/internal-build-release-linux64.yml +++ b/.github/workflows/internal-build-release-linux64.yml @@ -15,9 +15,9 @@ jobs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Setup .NET - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v6 with: dotnet-version: 6.0.x - name: Restore dependencies @@ -50,7 +50,7 @@ jobs: pip install -U pyinstaller # run the packaging - ./scripts/build_codeql_bundle_dist.ps1 -Version 0.5.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Release/net6.0/publish/linux-x64/tools/ + ./scripts/build_codeql_bundle_dist.ps1 -Version 0.6.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Release/net6.0/publish/linux-x64/tools/ env: GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/internal-build-release-macos64.yml b/.github/workflows/internal-build-release-macos64.yml index 4f98924..1754321 100644 --- a/.github/workflows/internal-build-release-macos64.yml +++ b/.github/workflows/internal-build-release-macos64.yml @@ -14,9 +14,9 @@ jobs: runs-on: macos-15 # note this is arm64 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Setup .NET - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v6 with: dotnet-version: 6.0.x - name: Restore dependencies @@ -48,7 +48,7 @@ jobs: pip install -U pyinstaller # run the packaging - ./scripts/build_codeql_bundle_dist.ps1 -Version 0.5.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Release/net6.0/publish/macos-arm64/tools/ + ./scripts/build_codeql_bundle_dist.ps1 -Version 0.6.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Release/net6.0/publish/macos-arm64/tools/ env: GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/internal-build-release-win64.yml b/.github/workflows/internal-build-release-win64.yml index 4596f93..bfa25ca 100644 --- a/.github/workflows/internal-build-release-win64.yml +++ b/.github/workflows/internal-build-release-win64.yml @@ -14,9 +14,9 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Setup .NET - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v6 with: dotnet-version: 6.0.x - name: Restore dependencies @@ -45,7 +45,7 @@ jobs: pip install -U pyinstaller # run the packaging - .\scripts\build_codeql_bundle_dist.ps1 -Version 0.5.0 -WorkDirectory dist -DestinationDirectory .\src\CodeQLToolkit.Core\bin\Release\net6.0\publish\windows-x64\tools\ + .\scripts\build_codeql_bundle_dist.ps1 -Version 0.6.0 -WorkDirectory dist -DestinationDirectory .\src\CodeQLToolkit.Core\bin\Release\net6.0\publish\windows-x64\tools\ env: GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/internal-pr-build-linux.yml b/.github/workflows/internal-pr-build-linux.yml index d0b917a..7c31e50 100644 --- a/.github/workflows/internal-pr-build-linux.yml +++ b/.github/workflows/internal-pr-build-linux.yml @@ -11,10 +11,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Setup .NET - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v6 with: dotnet-version: 6.0.x diff --git a/.github/workflows/internal-pr-test-bundle-creation.yml b/.github/workflows/internal-pr-test-bundle-creation.yml index e8d7b20..a3a8a55 100644 --- a/.github/workflows/internal-pr-test-bundle-creation.yml +++ b/.github/workflows/internal-pr-test-bundle-creation.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v7 - name: Install QLT id: install-qlt diff --git a/.github/workflows/internal-pr-test-quick-bundle-creation.yml b/.github/workflows/internal-pr-test-quick-bundle-creation.yml index 6f538d9..5d00c15 100644 --- a/.github/workflows/internal-pr-test-quick-bundle-creation.yml +++ b/.github/workflows/internal-pr-test-quick-bundle-creation.yml @@ -15,7 +15,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-15] + os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-15] steps: - uses: actions/checkout@v7 diff --git a/.github/workflows/internal-release-build.yml b/.github/workflows/internal-release-build.yml index f925209..79124f3 100644 --- a/.github/workflows/internal-release-build.yml +++ b/.github/workflows/internal-release-build.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Create Draft Release shell: pwsh diff --git a/.github/workflows/internal-validate-workflow-files.yml b/.github/workflows/internal-validate-workflow-files.yml index 46ee9d1..882f35f 100644 --- a/.github/workflows/internal-validate-workflow-files.yml +++ b/.github/workflows/internal-validate-workflow-files.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v7 - name: Install QLT id: install-qlt diff --git a/.github/workflows/run-codeql-unit-tests-cpp.yml b/.github/workflows/run-codeql-unit-tests-cpp.yml index 6d493df..e8df31a 100644 --- a/.github/workflows/run-codeql-unit-tests-cpp.yml +++ b/.github/workflows/run-codeql-unit-tests-cpp.yml @@ -19,7 +19,7 @@ jobs: matrix: ${{ steps.export-unit-test-matrix.outputs.matrix }} steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v7 - name: Install QLT @@ -46,7 +46,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v7 - name: Install QLT @@ -120,7 +120,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v7 - name: Install QLT diff --git a/.github/workflows/validate-codeql-queries-cpp.yml b/.github/workflows/validate-codeql-queries-cpp.yml index 8c0a6b8..93bef6a 100644 --- a/.github/workflows/validate-codeql-queries-cpp.yml +++ b/.github/workflows/validate-codeql-queries-cpp.yml @@ -18,7 +18,7 @@ jobs: matrix: ${{ steps.export-test-matrix.outputs.matrix }} steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v7 - name: Install QLT @@ -45,7 +45,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v7 diff --git a/developer_guide.md b/developer_guide.md index 11fe0f7..7b5d0bc 100644 --- a/developer_guide.md +++ b/developer_guide.md @@ -15,7 +15,7 @@ Note that we keep recent copies of tools (for local debugging purposes) in the ` **CodeQL Bundle** ``` -./scripts/build_codeql_bundle_dist.ps1 -Version 0.5.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Debug/net6.0/tools +./scripts/build_codeql_bundle_dist.ps1 -Version 0.6.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Debug/net6.0/tools ``` diff --git a/src/CodeQLToolkit.Features/Templates/Test/Actions/run-unit-tests.liquid b/src/CodeQLToolkit.Features/Templates/Test/Actions/run-unit-tests.liquid index ab6a936..51481e4 100644 --- a/src/CodeQLToolkit.Features/Templates/Test/Actions/run-unit-tests.liquid +++ b/src/CodeQLToolkit.Features/Templates/Test/Actions/run-unit-tests.liquid @@ -19,7 +19,7 @@ jobs: matrix: ${{ steps.export-unit-test-matrix.outputs.matrix }} steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v7 {% endraw %} {% if dev_mode %} - name: Install QLT @@ -58,7 +58,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v7 {% endraw %} {% if dev_mode %} - name: Install QLT @@ -151,7 +151,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v7 {% endraw %} {% if dev_mode %} - name: Install QLT diff --git a/src/CodeQLToolkit.Features/Templates/Validation/Actions/validate-query-metadata.liquid b/src/CodeQLToolkit.Features/Templates/Validation/Actions/validate-query-metadata.liquid index 234b5e4..31f7ff3 100644 --- a/src/CodeQLToolkit.Features/Templates/Validation/Actions/validate-query-metadata.liquid +++ b/src/CodeQLToolkit.Features/Templates/Validation/Actions/validate-query-metadata.liquid @@ -18,7 +18,7 @@ jobs: matrix: ${{ steps.export-test-matrix.outputs.matrix }} steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v7 {% endraw %} {% if dev_mode %} - name: Install QLT @@ -57,7 +57,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v7 {% endraw %} {% if dev_mode %} diff --git a/src/CodeQLToolkit.Shared/CodeQL/CodeQLInstallation.cs b/src/CodeQLToolkit.Shared/CodeQL/CodeQLInstallation.cs index 05c2642..0401c90 100644 --- a/src/CodeQLToolkit.Shared/CodeQL/CodeQLInstallation.cs +++ b/src/CodeQLToolkit.Shared/CodeQL/CodeQLInstallation.cs @@ -96,7 +96,12 @@ public string PlatformID if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { - return "linux64"; + return RuntimeInformation.OSArchitecture switch + { + Architecture.X64 => "linux64", + Architecture.Arm64 => "linux-arm64", + _ => throw new PlatformNotSupportedException($"Unsupported Linux architecture: {RuntimeInformation.OSArchitecture}.") + }; } if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) @@ -104,7 +109,7 @@ public string PlatformID return "osx64"; } - throw new Exception("Unknown platform."); + throw new PlatformNotSupportedException("Unsupported operating system."); } } diff --git a/src/CodeQLToolkit.Shared/CodeQL/RESOLUTION.md b/src/CodeQLToolkit.Shared/CodeQL/RESOLUTION.md index e37cbbc..8ff916d 100644 --- a/src/CodeQLToolkit.Shared/CodeQL/RESOLUTION.md +++ b/src/CodeQLToolkit.Shared/CodeQL/RESOLUTION.md @@ -54,7 +54,8 @@ In all cases, two environment variables are set after a run: When using custom bundles, one additional environment variable is set after a run: - `QLT_CODEQL_BUNDLE_PATH` - The path to the current platform bundle created by QLT. -Each invocation creates a bundle only for its current platform. Run QLT on each target operating system when Linux, Windows, and macOS bundles are all required. +Each invocation creates a bundle only for its current platform. Run QLT on each target platform when Linux x64, Linux ARM64, Windows, and macOS bundles are required. +Linux ARM64 requires CodeQL CLI and bundle version 2.27.0 or later. ## Idents within the Installation Directory diff --git a/test/CodeQLToolkit.Shared.Tests/CodeQL/CodeQLInstallationTests.cs b/test/CodeQLToolkit.Shared.Tests/CodeQL/CodeQLInstallationTests.cs index 9570fc6..a5b0d0e 100644 --- a/test/CodeQLToolkit.Shared.Tests/CodeQL/CodeQLInstallationTests.cs +++ b/test/CodeQLToolkit.Shared.Tests/CodeQL/CodeQLInstallationTests.cs @@ -11,7 +11,12 @@ public void UsesCurrentPlatformBundle() var expectedPlatform = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "win64" : RuntimeInformation.IsOSPlatform(OSPlatform.Linux) - ? "linux64" + ? RuntimeInformation.OSArchitecture switch + { + Architecture.X64 => "linux64", + Architecture.Arm64 => "linux-arm64", + _ => throw new PlatformNotSupportedException($"Unsupported Linux architecture: {RuntimeInformation.OSArchitecture}.") + } : "osx64"; var installation = new CodeQLInstallation { From de1fb95cf90484299fd403f3f9d5ae55a90cdcbe Mon Sep 17 00:00:00 2001 From: Mauro Baluda Date: Fri, 25 Sep 2026 01:19:02 +0200 Subject: [PATCH 4/4] Use released CodeQL bundle tool Keep packaging on codeql-bundle 0.5.0 until 0.6.0 is published. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/actions/install-qlt-local/action.yml | 2 +- .github/workflows/internal-build-release-linux64.yml | 2 +- .github/workflows/internal-build-release-macos64.yml | 2 +- .github/workflows/internal-build-release-win64.yml | 2 +- developer_guide.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/install-qlt-local/action.yml b/.github/actions/install-qlt-local/action.yml index 23fda23..1612f17 100644 --- a/.github/actions/install-qlt-local/action.yml +++ b/.github/actions/install-qlt-local/action.yml @@ -60,7 +60,7 @@ runs: pip install -U pyinstaller # run the packaging - ./scripts/build_codeql_bundle_dist.ps1 -Version 0.6.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Release/net6.0/publish/linux-x64/tools/ + ./scripts/build_codeql_bundle_dist.ps1 -Version 0.5.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Release/net6.0/publish/linux-x64/tools/ env: GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/internal-build-release-linux64.yml b/.github/workflows/internal-build-release-linux64.yml index 364c0ca..c0c121a 100644 --- a/.github/workflows/internal-build-release-linux64.yml +++ b/.github/workflows/internal-build-release-linux64.yml @@ -50,7 +50,7 @@ jobs: pip install -U pyinstaller # run the packaging - ./scripts/build_codeql_bundle_dist.ps1 -Version 0.6.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Release/net6.0/publish/linux-x64/tools/ + ./scripts/build_codeql_bundle_dist.ps1 -Version 0.5.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Release/net6.0/publish/linux-x64/tools/ env: GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/internal-build-release-macos64.yml b/.github/workflows/internal-build-release-macos64.yml index 1754321..2ebea8e 100644 --- a/.github/workflows/internal-build-release-macos64.yml +++ b/.github/workflows/internal-build-release-macos64.yml @@ -48,7 +48,7 @@ jobs: pip install -U pyinstaller # run the packaging - ./scripts/build_codeql_bundle_dist.ps1 -Version 0.6.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Release/net6.0/publish/macos-arm64/tools/ + ./scripts/build_codeql_bundle_dist.ps1 -Version 0.5.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Release/net6.0/publish/macos-arm64/tools/ env: GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/internal-build-release-win64.yml b/.github/workflows/internal-build-release-win64.yml index bfa25ca..26fc9ea 100644 --- a/.github/workflows/internal-build-release-win64.yml +++ b/.github/workflows/internal-build-release-win64.yml @@ -45,7 +45,7 @@ jobs: pip install -U pyinstaller # run the packaging - .\scripts\build_codeql_bundle_dist.ps1 -Version 0.6.0 -WorkDirectory dist -DestinationDirectory .\src\CodeQLToolkit.Core\bin\Release\net6.0\publish\windows-x64\tools\ + .\scripts\build_codeql_bundle_dist.ps1 -Version 0.5.0 -WorkDirectory dist -DestinationDirectory .\src\CodeQLToolkit.Core\bin\Release\net6.0\publish\windows-x64\tools\ env: GH_TOKEN: ${{ github.token }} diff --git a/developer_guide.md b/developer_guide.md index 7b5d0bc..11fe0f7 100644 --- a/developer_guide.md +++ b/developer_guide.md @@ -15,7 +15,7 @@ Note that we keep recent copies of tools (for local debugging purposes) in the ` **CodeQL Bundle** ``` -./scripts/build_codeql_bundle_dist.ps1 -Version 0.6.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Debug/net6.0/tools +./scripts/build_codeql_bundle_dist.ps1 -Version 0.5.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Debug/net6.0/tools ```