Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jsinglet committed Jan 12, 2024
1 parent a362800 commit feec8ec
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 10 deletions.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/CodeQLToolkit.Core/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public static async Task<int> Main(string[] args)
// Add global option for the root directory
rootCommand.AddGlobalOption(Globals.BasePathOption);
rootCommand.AddGlobalOption(Globals.AutomationTypeOption);
rootCommand.AddGlobalOption(Globals.Development);

var versionCommand = new Command("version", "Get the current tool version.");
rootCommand.Add(versionCommand);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,33 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
{% endraw %}

{% if dev_mode %}
- name: Install QLT
id: install-qlt
uses: ./.github/actions/install-qlt-local
with:
qlt-version: 'latest'
add-to-path: true
- name: Export unit test matrix
id: export-unit-test-matrix
run: |
qlt test run get-matrix --os-version {{ use_runner }} --base example/

{% else %}
- name: Install QLT
id: install-qlt
uses: ./.github/actions/install-qlt
with:
qlt-version: 'latest'
add-to-path: true
{% endraw %}
- name: Export unit test matrix
id: export-unit-test-matrix
run: |
qlt test run get-matrix --os-version {{ use_runner }}
{% endif %}

{% raw %}
run-test-suites:
name: Run Unit Tests
Expand All @@ -44,14 +59,23 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
{% endraw %}
{% if dev_mode %}
- name: Install QLT
id: install-qlt
uses: ./.github/actions/install-qlt-local
with:
qlt-version: 'latest'
add-to-path: true
{% else %}
- name: Install QLT
id: install-qlt
uses: ./.github/actions/install-qlt
with:
qlt-version: 'latest'
add-to-path: true
{% endif %}
{% raw %}
- name: Install CodeQL
id: install-codeql
uses: ./.github/actions/install-codeql
Expand All @@ -70,12 +94,19 @@ jobs:
echo -e "Checking QLT Version:"
echo "QLT Home: ${{ steps.install-qlt.outputs.qlt-home }}"
qlt version
{% endraw %}
{% if dev_mode %}
- name: Install QL Packs
shell: bash
run: |
qlt query run install-packs --base example/
{% else %}
- name: Install QL Packs
shell: bash
run: |
qlt query run install-packs
{% endif %}
{% raw %}
- name: Run test suites
id: run-test-suites
env:
Expand All @@ -87,12 +118,22 @@ jobs:
shell: bash
run: >
{% endraw %}
{% if dev_mode %}
qlt test run execute-unit-tests
--codeql-args "{{ codeql_args }}"
--num-threads {{ num_threads }}
--language {{ language }}
--runner-os $RUNNER_OS
--work-dir $RUNNER_TMP
--base example/
{% else %}
qlt test run execute-unit-tests
--codeql-args "{{ codeql_args }}"
--num-threads {{ num_threads }}
--language {{ language }}
--runner-os $RUNNER_OS
--work-dir $RUNNER_TMP
{% endif %}
{% raw %}
- name: Upload test results
uses: actions/upload-artifact@v2
Expand All @@ -110,14 +151,23 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
{% endraw %}
{% if dev_mode %}
- name: Install QLT
id: install-qlt
uses: ./.github/actions/install-qlt-local
with:
qlt-version: 'latest'
add-to-path: true
{% else %}
- name: Install QLT
id: install-qlt
uses: ./.github/actions/install-qlt
with:
qlt-version: 'latest'
add-to-path: true
{% endif %}
{% raw %}
- name: Collect test results
uses: actions/download-artifact@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ abstract public class BaseLifecycleTarget : ILifecycleTarget

public string ExtraArgs { get; set; }

public bool DevMode { get; set; }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public override void Run()
numThreads = NumThreads,
useRunner = UseRunner,
language = tmpLanguage,
codeqlArgs = codeqlArgs
codeqlArgs = codeqlArgs,
devMode = DevMode
});

Language = tmpLanguage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void Register(Command parentCommand)



initCommand.SetHandler((basePath, automationType, overwriteExisting, numThreads, useRunner, language, extraArgs) =>
initCommand.SetHandler((devMode, basePath, automationType, overwriteExisting, numThreads, useRunner, language, extraArgs) =>
{
Log<TestLifecycleFeature>.G().LogInformation("Executing init command...");

Expand All @@ -67,9 +67,10 @@ public void Register(Command parentCommand)
featureTarget.UseRunner = useRunner;
featureTarget.Language = language;
featureTarget.ExtraArgs = extraArgs;
featureTarget.DevMode = devMode;
featureTarget.Run();

}, Globals.BasePathOption, Globals.AutomationTypeOption, overwriteExistingOption, numThreadsOption, useRunnerOption, languageOption, extraCodeQLOptions);
}, Globals.Development, Globals.BasePathOption, Globals.AutomationTypeOption, overwriteExistingOption, numThreadsOption, useRunnerOption, languageOption, extraCodeQLOptions);

}

Expand Down
5 changes: 5 additions & 0 deletions src/CodeQLToolkit.Shared/Options/Globals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,10 @@ public class Globals
public static Option<string> AutomationTypeOption { get; } = new Option<string>("--automation-type", () => {
return "actions";
}, "The base path to find the query repository.") { IsRequired = true }.FromAmong(SupportedAutomationTypes);

public static Option<bool> Development { get; } = new Option<bool>("--development", () => {
return false;
}, "Turns on development mode which enables special features used in the development of QLT.")
{ IsRequired = true }.FromAmong(SupportedAutomationTypes);
}
}

0 comments on commit feec8ec

Please sign in to comment.