Skip to content

Commit

Permalink
Updated ids tool lib and improved build naming.
Browse files Browse the repository at this point in the history
  • Loading branch information
CBenghi committed Oct 14, 2023
1 parent 10b5edf commit 922b24d
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 18 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/check-test-cases.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: check-test-cases
name: audit-all-ids-files

on:
workflow_dispatch: # Allow running the workflow manually from the GitHub UI
Expand All @@ -11,9 +11,9 @@ on:

jobs:
check-test-cases:
name: check-test-cases
name: audit-all-ids-files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run './build.cmd CheckTestCases'
run: ./build.cmd CheckTestCases
- name: Run './build.cmd AuditAllIdsFiles'
run: ./build.cmd AuditAllIdsFiles
6 changes: 4 additions & 2 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@
"items": {
"type": "string",
"enum": [
"AuditAllIdsFiles",
"AuditDevelopment",
"AuditDocTestCases",
"CheckTestCases"
"MakeClasses"
]
}
},
Expand All @@ -84,9 +85,10 @@
"items": {
"type": "string",
"enum": [
"AuditAllIdsFiles",
"AuditDevelopment",
"AuditDocTestCases",
"CheckTestCases"
"MakeClasses"
]
}
},
Expand Down
51 changes: 40 additions & 11 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,41 @@ class Build : NukeBuild
/// - Microsoft VisualStudio https://nuke.build/visualstudio
/// - Microsoft VSCode https://nuke.build/vscode

public static int Main() => Execute<Build>(x => x.CheckTestCases);
public static int Main() => Execute<Build>(x => x.AuditAllIdsFiles);

[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
private readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;

[PackageExecutable("ids-tool.CommandLine", "tools/net6.0/ids-tool.dll")]
private Tool IdsTool;

private string IdsToolPath => System.IO.Path.GetDirectoryName(ToolPathResolver.GetPackageExecutable("ids-tool.CommandLine", "tools/net6.0/ids-tool.dll"));
[PackageExecutable("dotnet-xscgen", "tools/net6.0/any/xscgen.dll")]
private Tool SchemaTool;

/// <summary>
/// Checks the validity of development folder in the repository, using ids-tool.
/// The tool is deployed by the annotated <see cref="IdsTool"/>.
/// </summary>
Target AuditDevelopment => _ => _
/// <summary>
/// Audits the validity of development folder in the repository, using ids-tool.
/// The tool is deployed by the annotated <see cref="IdsTool"/>.
/// The schema is loaded from the repository to ensure internal coherence.
/// </summary>
Target MakeClasses => _ => _
.AssuredAfterFailure()
.Executes(() =>
{
// development samples
var schemaFile = RootDirectory / "Development" / "ids.xsd";
var arguments = $"\"{schemaFile}\"";
SchemaTool(arguments);
});


private string IdsToolPath => Path.GetDirectoryName(ToolPathResolver.GetPackageExecutable("ids-tool.CommandLine", "tools/net6.0/ids-tool.dll"));

/// <summary>
/// Audits the validity of development folder in the repository, using ids-tool.
/// The tool is deployed by the annotated <see cref="IdsTool"/>.
/// The schema is loaded from the repository to ensure internal coherence.
/// </summary>
Target AuditDevelopment => _ => _
.AssuredAfterFailure()
.Executes(() =>
{
Expand All @@ -36,28 +56,37 @@ class Build : NukeBuild
IdsTool(arguments, workingDirectory: IdsToolPath);
});

Target AuditDocTestCases => _ => _
/// <summary>
/// Audits the validity of Documentation/testcases folder in the repository, using ids-tool.
/// The tool is deployed by the annotated <see cref="IdsTool"/>.
/// The schema is loaded from the repository to ensure internal coherence.
/// </summary>
Target AuditDocTestCases => _ => _
.AssuredAfterFailure()
.Executes(() =>
{
// we are omitting tests on the content of the Documentation/testcases folder,
// because they include IDSs that intentionally contain errors
//
// todo: once stable, this could be improved to omit contens based on failure patter name
// todo: once stable, constrained on expected auditing failures on the "fail-" cases should be added
var schemaFile = RootDirectory / "Development" / "ids.xsd";
var inputFolder = RootDirectory / "Documentation" / "testcases";
var arguments = $"audit \"{inputFolder}\" --omitContent -x \"{schemaFile}\"";
IdsTool(arguments, workingDirectory: IdsToolPath);
});

/// <summary>
/// Perform all tests via DependsOn, this is the one invoked by default
/// Perform all quality assurance of published IDS files; this is the one invoked by default
/// </summary>
Target CheckTestCases => _ => _
Target AuditAllIdsFiles => _ => _
.AssuredAfterFailure()
.DependsOn(AuditDocTestCases)
.DependsOn(AuditDevelopment)
.Executes(() =>
{
Console.WriteLine("Empty target, to launch all available checking targets.");
Console.WriteLine("This is an utility target that launches all available IDS auditing targets.");
});


}
6 changes: 5 additions & 1 deletion build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ids-tool.CommandLine" Version="1.0.43" />
<PackageReference Include="ids-tool.CommandLine" Version="1.0.45" />
<PackageReference Include="Nuke.Common" Version="6.2.1" />
</ItemGroup>

<ItemGroup>
<PackageDownload Include="dotnet-xscgen" Version="[2.1.915]" />
</ItemGroup>

</Project>

0 comments on commit 922b24d

Please sign in to comment.