Skip to content

Commit 2220b39

Browse files
committed
templates fixes
1 parent cf8c6bd commit 2220b39

File tree

6 files changed

+91
-13
lines changed

6 files changed

+91
-13
lines changed

src/CodeQLToolkit.Core/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"profiles": {
33
"CodeQLToolkit.Core": {
44
"commandName": "Project",
5-
"commandLineArgs": "--base C:\\Projects\\codeql-development-lifecycle-toolkit\\example bundle set enable-custom-bundles"
5+
"commandLineArgs": "bundle init --use-runner ubuntu-latest --language cpp --automation-type actions --development --overwrite-existing"
66
}
77
}
88
}

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@ namespace CodeQLToolkit.Features.Bundle.Lifecycle
88
{
99
abstract public class BaseLifecycleTarget : ILifecycleTarget
1010
{
11-
public int NumThreads { get; set; }
1211
public string UseRunner { get; set; }
1312

14-
public string ExtraArgs { get; set; }
15-
16-
17-
1813
}
1914
}

src/CodeQLToolkit.Features/Bundle/Lifecycle/BundleLifecycleFeature.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
using CodeQLToolkit.Features.CodeQL.Lifecycle.Targets;
2-
using CodeQLToolkit.Features.CodeQL.Lifecycle;
3-
using CodeQLToolkit.Features.Test.Lifecycle.Targets;
4-
using CodeQLToolkit.Features.Test.Lifecycle.Targets.Actions;
1+
using CodeQLToolkit.Features.CodeQL.Lifecycle;
52
using CodeQLToolkit.Shared.Utils;
63
using System.CommandLine;
7-
using System.Reflection;
84
using CodeQLToolkit.Features.Bundle.Lifecycle.Targets;
9-
using CodeQLToolkit.Features.Test.Lifecycle;
105

116
namespace CodeQLToolkit.Features.Bundle.Lifecycle
127
{

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace CodeQLToolkit.Features.Bundle.Lifecycle.Targets.Actions
88
{
9+
[AutomationType(AutomationType.ACTIONS)]
910
public class InitLifecycleTarget : BaseLifecycleTarget
1011
{
1112

src/CodeQLToolkit.Features/CodeQLToolkit.Features.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<Folder Include="Bundle\Lifecycle\Targets\Actions\" />
1514
<Folder Include="Bundle\Models\" />
1615
<Folder Include="Pack\" />
1716
<Folder Include="Templates\Validation\Actions\" />
@@ -22,6 +21,12 @@
2221
</ItemGroup>
2322

2423
<ItemGroup>
24+
<None Update="Templates\Bundle\Actions\install-qlt.liquid">
25+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
26+
</None>
27+
<None Update="Templates\Bundle\Actions\run-bundle-integration-tests.liquid">
28+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
29+
</None>
2530
<None Update="Templates\Query\codeql-workspace.liquid">
2631
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
2732
</None>
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Fetch and Install QLT
2+
description: |
3+
Fetches and installs QLT.
4+
inputs:
5+
qlt-version:
6+
description: |
7+
The version of QLT to be downloaded.
8+
required: false
9+
default: 'latest'
10+
11+
add-to-path:
12+
description: |
13+
Add QLT to the system path
14+
required: false
15+
default: 'true'
16+
17+
outputs:
18+
qlt-home:
19+
description: 'The directory containing the QLT installation'
20+
value: ${{ steps.install-qlt.outputs.qlt-home }}
21+
22+
runs:
23+
using: composite
24+
steps:
25+
- name: Install QLT
26+
id: install-qlt
27+
env:
28+
RUNNER_OS: ${{ runner.os }}
29+
RUNNER_TEMP: ${{ runner.temp }}
30+
ADD_TO_PATH: ${{ inputs.add-to-path }}
31+
QLT_VERSION: ${{ inputs.qlt-version }}
32+
QLT_HOME: ${{ inputs.qlt-home }}
33+
GITHUB_TOKEN: ${{ github.token }}
34+
35+
shell: bash
36+
run: |
37+
echo -e "\e[0;32m[QLT]\e[0m Determining QLT release for $RUNNER_OS"
38+
case $RUNNER_OS in
39+
"Linux")
40+
RELEASE_PATTERN="qlt-linux-x86_64.zip"
41+
;;
42+
*)
43+
echo "::error::Unsupported runner operating system $RUNNER_OS"
44+
exit 1
45+
;;
46+
esac
47+
echo -e "\e[0;32m[QLT]\e[0m Selected $RELEASE_PATTERN"
48+
49+
if [ "$QLT_HOME" == "" ]
50+
then
51+
echo -e "\e[0;32m[QLT]\e[0m Creating temporary QLT home"
52+
QLT_HOME=$(mktemp -d -p $RUNNER_TEMP qlt-home-XXXXXXXXXX)
53+
else
54+
echo -e "\e[0;32m[QLT]\e[0m Creating CodeQL home at $QLT_HOME"
55+
mkdir -p $QLT_HOME
56+
fi
57+
58+
echo -e "\e[0;32m[QLT]\e[0m Changing directory to $QLT_HOME"
59+
pushd $QLT_HOME
60+
61+
echo -e "\e[0;32m[QLT]\e[0m Downloading QLT version $QLT_VERSION"
62+
if [ "$QLT_VERSION" == "latest" ]
63+
then
64+
# download the actual bundle
65+
gh release download -R advanced-security/codeql-development-toolkit --pattern "$RELEASE_PATTERN"
66+
else
67+
gh release download "$QLT_VERSION" -R advanced-security/codeql-development-toolkit --pattern "$RELEASE_PATTERN"
68+
fi
69+
echo -e "\e[0;32m[QLT]\e[0m Unpacking QLT"
70+
unzip $RELEASE_PATTERN
71+
72+
if [ "$ADD_TO_PATH" == "true" ]
73+
then
74+
echo -e "\e[0;32m[QLT]\e[0m Adding QLT '$(pwd)/qlt' to system path"
75+
echo "$(pwd)" >> $GITHUB_PATH
76+
fi
77+
78+
echo -e "\e[0;32m[QLT]\e[0m Setting output parameter qlt-home to $(pwd)"
79+
echo "qlt-home=$(pwd)" >> $GITHUB_OUTPUT
80+
81+
popd
82+
echo -e "\e[0;32m[QLT]\e[0m Done."

0 commit comments

Comments
 (0)