Skip to content

Commit aefbbe9

Browse files
committed
work for validation feature
1 parent 00b8f7b commit aefbbe9

File tree

6 files changed

+49
-11
lines changed

6 files changed

+49
-11
lines changed

.github/workflows/internal-validate-workflow-files.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ jobs:
3434
- name: Generate Workflow Files (Test Feature)
3535
shell: bash
3636
run: |
37-
qlt test init --use-runner ubuntu-latest --num-threads 4 --language cpp --automation-type actions --development --overwrite-existing
37+
qlt test init --use-runner ubuntu-latest --num-threads 4 --language cpp --automation-type actions --development --overwrite-existing
3838
39+
- name: Generate Workflow Files (Validation Feature)
40+
shell: bash
41+
run: |
42+
qlt validation init --use-runner ubuntu-latest --language cpp --automation-type actions --development --overwrite-existing
3943
4044
- name: Check Git Clean Status
4145
shell: bash

src/CodeQLToolkit.Features/Templates/Validation/Actions/validate-query-metadata.liquid

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,32 @@ jobs:
1818
steps:
1919
- name: Checkout repository
2020
uses: actions/checkout@v3
21+
{% endraw %}
22+
{% if dev_mode %}
23+
- name: Install QLT
24+
id: install-qlt
25+
uses: ./.github/actions/install-qlt-local
26+
with:
27+
qlt-version: 'latest'
28+
add-to-path: true
2129

30+
- name: Export unit test matrix
31+
id: export-unit-test-matrix
32+
run: |
33+
qlt test run get-matrix --os-version {{ use_runner }} --base example/
34+
{% else %}
2235
- name: Install QLT
2336
id: install-qlt
2437
uses: ./.github/actions/install-qlt
2538
with:
2639
qlt-version: 'latest'
2740
add-to-path: true
28-
{% endraw %}
29-
- name: Export test matrix
30-
id: export-test-matrix
41+
42+
- name: Export unit test matrix
43+
id: export-unit-test-matrix
3144
run: |
3245
qlt test run get-matrix --os-version {{ use_runner }}
46+
{% endif %}
3347
{% raw %}
3448
validate-queries:
3549
name: Validate Queries
@@ -44,12 +58,23 @@ jobs:
4458
- name: Checkout repository
4559
uses: actions/checkout@v3
4660
61+
{% endraw %}
62+
{% if dev_mode %}
4763
- name: Install QLT
64+
id: install-qlt
65+
uses: ./.github/actions/install-qlt-local
66+
with:
67+
qlt-version: 'latest'
68+
add-to-path: true
69+
{% else %}
70+
- name: Install QLT
71+
id: install-qlt
4872
uses: ./.github/actions/install-qlt
4973
with:
5074
qlt-version: 'latest'
5175
add-to-path: true
52-
76+
{% endif %}
77+
{% raw %}
5378
- name: Install CodeQL
5479
uses: ./.github/actions/install-codeql
5580
with:
@@ -72,11 +97,17 @@ jobs:
7297
shell: bash
7398
run: |
7499
qlt query run install-packs
75-
100+
{% endraw %}
101+
{% if dev_mode %}
102+
- name: Run validation tests
103+
shell: bash
104+
run: >
105+
qlt validation run check-queries --pretty-print --language {{ language }} --base example/ >> $GITHUB_STEP_SUMMARY
106+
qlt validation run check-queries --language {{ language }} --base example/
107+
{% else %}
76108
- name: Run validation tests
77109
shell: bash
78110
run: >
79-
{% endraw %}
80111
qlt validation run check-queries --pretty-print --language {{ language }} >> $GITHUB_STEP_SUMMARY
81-
82112
qlt validation run check-queries --language {{ language }}
113+
{% else %}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ abstract public class BaseLifecycleTarget : ILifecycleTarget
1313

1414
public string ExtraArgs { get; set; }
1515

16-
public bool DevMode { get; set; }
16+
1717

1818
}
1919
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public override void Run()
2626
{
2727
useRunner = UseRunner,
2828
language = tmpLanguage,
29+
devMode = DevMode
2930
});
3031

3132
Language = tmpLanguage;

src/CodeQLToolkit.Features/Validation/Lifecycle/ValidationLifecycleFeature.cs

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

4747
parentCommand.Add(initCommand);
4848

49-
initCommand.SetHandler((basePath, automationType, overwriteExisting, language, useRunner) =>
49+
initCommand.SetHandler((devMode, basePath, automationType, overwriteExisting, language, useRunner) =>
5050
{
5151
Log<TestLifecycleFeature>.G().LogInformation("Executing init command...");
5252

@@ -61,9 +61,10 @@ public void Register(Command parentCommand)
6161
featureTarget.UseRunner = useRunner;
6262
featureTarget.OverwriteExisting = overwriteExisting;
6363
featureTarget.Language = language;
64+
featureTarget.DevMode = devMode;
6465
featureTarget.Run();
6566

66-
}, Globals.BasePathOption, Globals.AutomationTypeOption, overwriteExistingOption, languageOption, useRunnerOption);
67+
}, Globals.Development, Globals.BasePathOption, Globals.AutomationTypeOption, overwriteExistingOption, languageOption, useRunnerOption);
6768

6869
}
6970

src/CodeQLToolkit.Shared/Target/ILifecycleTarget.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public abstract class ILifecycleTarget : ITarget
1212
public string Language { get; set; }
1313
public bool OverwriteExisting { get; set; }
1414
public string FeatureName { get; set; }
15+
public bool DevMode { get; set; }
1516
public AutomationType AutomationType { get; set; } = AutomationType.ANY;
1617

1718

0 commit comments

Comments
 (0)