Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/install-qlt-local/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/internal-build-release-linux64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/internal-build-release-macos64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/internal-build-release-win64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/internal-pr-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/internal-pr-test-bundle-creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
48 changes: 12 additions & 36 deletions .github/workflows/internal-pr-test-quick-bundle-creation.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ⚙️ Test Bundle Creation (Quick)
name: Test Platform Bundle Selection

on:
push:
Expand All @@ -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, ubuntu-24.04-arm, 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
2 changes: 1 addition & 1 deletion .github/workflows/internal-release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Create Draft Release
shell: pwsh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/internal-validate-workflow-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/run-bundle-integration-tests-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

6 changes: 3 additions & 3 deletions .github/workflows/run-codeql-unit-tests-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -46,7 +46,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v7


- name: Install QLT
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
steps:

- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v7


- name: Install QLT
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate-codeql-queries-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -45,7 +45,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v7



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -149,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 %}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v7
{% endraw %}
{% if dev_mode %}
- name: Install QLT
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
steps:

- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v7
{% endraw %}
{% if dev_mode %}
- name: Install QLT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v7

{% endraw %}
{% if dev_mode %}
Expand Down
20 changes: 10 additions & 10 deletions src/CodeQLToolkit.Shared/CodeQL/CodeQLInstallation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,20 @@ 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))
{
return "osx64";
}

throw new Exception("Unknown platform.");
throw new PlatformNotSupportedException("Unsupported operating system.");
}
}

Expand Down Expand Up @@ -137,9 +142,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");

Expand Down Expand Up @@ -205,10 +207,9 @@ private void CustomBundleInstall()
Directory.CreateDirectory(InstallationDirectory);
}

// Download the platform-independent bundle.
Log<CodeQLInstallation>.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<CodeQLInstallation>.G().LogInformation($"Checking if existing source bundle {downloadFile} is present...");
Expand All @@ -221,7 +222,7 @@ private void CustomBundleInstall()
{
using var client = new WebClient();
string uri = $"https://github.com/github/codeql-action/releases/download/{CLIBundle}/{downloadFile}";
Log<CodeQLInstallation>.G().LogInformation($"Downloading platform-independent bundle from remote URL: {uri}...");
Log<CodeQLInstallation>.G().LogInformation($"Downloading platform-specific bundle from remote URL: {uri}...");
client.DownloadFile(uri, customBundlePath);
}

Expand Down Expand Up @@ -252,8 +253,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)
{
Expand Down
12 changes: 5 additions & 7 deletions src/CodeQLToolkit.Shared/CodeQL/RESOLUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,17 @@ 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 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

Expand Down
Loading
Loading