Skip to content

Commit feec8ec

Browse files
committed
checkpoint
1 parent a362800 commit feec8ec

File tree

10 files changed

+70
-10
lines changed

10 files changed

+70
-10
lines changed

src/CodeQLToolkit.Core/Main.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public static async Task<int> Main(string[] args)
2727
// Add global option for the root directory
2828
rootCommand.AddGlobalOption(Globals.BasePathOption);
2929
rootCommand.AddGlobalOption(Globals.AutomationTypeOption);
30+
rootCommand.AddGlobalOption(Globals.Development);
3031

3132
var versionCommand = new Command("version", "Get the current tool version.");
3233
rootCommand.Add(versionCommand);

src/CodeQLToolkit.Features/Templates/Test/Actions/run-unit-tests.liquid

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,33 @@ jobs:
1919
steps:
2020
- name: Checkout repository
2121
uses: actions/checkout@v3
22+
{% endraw %}
2223

24+
{% if dev_mode %}
25+
- name: Install QLT
26+
id: install-qlt
27+
uses: ./.github/actions/install-qlt-local
28+
with:
29+
qlt-version: 'latest'
30+
add-to-path: true
31+
- name: Export unit test matrix
32+
id: export-unit-test-matrix
33+
run: |
34+
qlt test run get-matrix --os-version {{ use_runner }} --base example/
35+
36+
{% else %}
2337
- name: Install QLT
2438
id: install-qlt
2539
uses: ./.github/actions/install-qlt
2640
with:
2741
qlt-version: 'latest'
2842
add-to-path: true
29-
{% endraw %}
3043
- name: Export unit test matrix
3144
id: export-unit-test-matrix
3245
run: |
3346
qlt test run get-matrix --os-version {{ use_runner }}
47+
{% endif %}
48+
3449
{% raw %}
3550
run-test-suites:
3651
name: Run Unit Tests
@@ -44,14 +59,23 @@ jobs:
4459
steps:
4560
- name: Checkout repository
4661
uses: actions/checkout@v3
47-
62+
{% endraw %}
63+
{% if dev_mode %}
64+
- name: Install QLT
65+
id: install-qlt
66+
uses: ./.github/actions/install-qlt-local
67+
with:
68+
qlt-version: 'latest'
69+
add-to-path: true
70+
{% else %}
4871
- name: Install QLT
4972
id: install-qlt
5073
uses: ./.github/actions/install-qlt
5174
with:
5275
qlt-version: 'latest'
5376
add-to-path: true
54-
77+
{% endif %}
78+
{% raw %}
5579
- name: Install CodeQL
5680
id: install-codeql
5781
uses: ./.github/actions/install-codeql
@@ -70,12 +94,19 @@ jobs:
7094
echo -e "Checking QLT Version:"
7195
echo "QLT Home: ${{ steps.install-qlt.outputs.qlt-home }}"
7296
qlt version
73-
97+
{% endraw %}
98+
{% if dev_mode %}
99+
- name: Install QL Packs
100+
shell: bash
101+
run: |
102+
qlt query run install-packs --base example/
103+
{% else %}
74104
- name: Install QL Packs
75105
shell: bash
76106
run: |
77107
qlt query run install-packs
78-
108+
{% endif %}
109+
{% raw %}
79110
- name: Run test suites
80111
id: run-test-suites
81112
env:
@@ -87,12 +118,22 @@ jobs:
87118
shell: bash
88119
run: >
89120
{% endraw %}
121+
{% if dev_mode %}
90122
qlt test run execute-unit-tests
91123
--codeql-args "{{ codeql_args }}"
92124
--num-threads {{ num_threads }}
93125
--language {{ language }}
94126
--runner-os $RUNNER_OS
95127
--work-dir $RUNNER_TMP
128+
--base example/
129+
{% else %}
130+
qlt test run execute-unit-tests
131+
--codeql-args "{{ codeql_args }}"
132+
--num-threads {{ num_threads }}
133+
--language {{ language }}
134+
--runner-os $RUNNER_OS
135+
--work-dir $RUNNER_TMP
136+
{% endif %}
96137
{% raw %}
97138
- name: Upload test results
98139
uses: actions/upload-artifact@v2
@@ -110,14 +151,23 @@ jobs:
110151
111152
- name: Checkout repository
112153
uses: actions/checkout@v3
113-
154+
{% endraw %}
155+
{% if dev_mode %}
156+
- name: Install QLT
157+
id: install-qlt
158+
uses: ./.github/actions/install-qlt-local
159+
with:
160+
qlt-version: 'latest'
161+
add-to-path: true
162+
{% else %}
114163
- name: Install QLT
115164
id: install-qlt
116165
uses: ./.github/actions/install-qlt
117166
with:
118167
qlt-version: 'latest'
119168
add-to-path: true
120-
169+
{% endif %}
170+
{% raw %}
121171
- name: Collect test results
122172
uses: actions/download-artifact@v2
123173

src/CodeQLToolkit.Features/Test/Lifecycle/BaseLifecycleTarget.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ abstract public class BaseLifecycleTarget : ILifecycleTarget
1313

1414
public string ExtraArgs { get; set; }
1515

16+
public bool DevMode { get; set; }
17+
1618
}
1719
}

src/CodeQLToolkit.Features/Test/Lifecycle/Targets/Actions/InitLifecycleTarget.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public override void Run()
3535
numThreads = NumThreads,
3636
useRunner = UseRunner,
3737
language = tmpLanguage,
38-
codeqlArgs = codeqlArgs
38+
codeqlArgs = codeqlArgs,
39+
devMode = DevMode
3940
});
4041

4142
Language = tmpLanguage;

src/CodeQLToolkit.Features/Test/Lifecycle/TestLifecycleFeature.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void Register(Command parentCommand)
5050

5151

5252

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

@@ -67,9 +67,10 @@ public void Register(Command parentCommand)
6767
featureTarget.UseRunner = useRunner;
6868
featureTarget.Language = language;
6969
featureTarget.ExtraArgs = extraArgs;
70+
featureTarget.DevMode = devMode;
7071
featureTarget.Run();
7172

72-
}, Globals.BasePathOption, Globals.AutomationTypeOption, overwriteExistingOption, numThreadsOption, useRunnerOption, languageOption, extraCodeQLOptions);
73+
}, Globals.Development, Globals.BasePathOption, Globals.AutomationTypeOption, overwriteExistingOption, numThreadsOption, useRunnerOption, languageOption, extraCodeQLOptions);
7374

7475
}
7576

src/CodeQLToolkit.Shared/Options/Globals.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,10 @@ public class Globals
2020
public static Option<string> AutomationTypeOption { get; } = new Option<string>("--automation-type", () => {
2121
return "actions";
2222
}, "The base path to find the query repository.") { IsRequired = true }.FromAmong(SupportedAutomationTypes);
23+
24+
public static Option<bool> Development { get; } = new Option<bool>("--development", () => {
25+
return false;
26+
}, "Turns on development mode which enables special features used in the development of QLT.")
27+
{ IsRequired = true }.FromAmong(SupportedAutomationTypes);
2328
}
2429
}

0 commit comments

Comments
 (0)