From 922b24d102031e72a4990c14c9b626c7742cf213 Mon Sep 17 00:00:00 2001 From: Claudio Benghi Date: Sat, 14 Oct 2023 22:49:47 +0200 Subject: [PATCH] Updated ids tool lib and improved build naming. --- .github/workflows/check-test-cases.yml | 8 ++-- .nuke/build.schema.json | 6 ++- build/Build.cs | 51 ++++++++++++++++++++------ build/_build.csproj | 6 ++- 4 files changed, 53 insertions(+), 18 deletions(-) diff --git a/.github/workflows/check-test-cases.yml b/.github/workflows/check-test-cases.yml index b44f6fa..a453715 100644 --- a/.github/workflows/check-test-cases.yml +++ b/.github/workflows/check-test-cases.yml @@ -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 @@ -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 diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index c9ff52b..13ea54d 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -72,9 +72,10 @@ "items": { "type": "string", "enum": [ + "AuditAllIdsFiles", "AuditDevelopment", "AuditDocTestCases", - "CheckTestCases" + "MakeClasses" ] } }, @@ -84,9 +85,10 @@ "items": { "type": "string", "enum": [ + "AuditAllIdsFiles", "AuditDevelopment", "AuditDocTestCases", - "CheckTestCases" + "MakeClasses" ] } }, diff --git a/build/Build.cs b/build/Build.cs index 7f37759..56df655 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -11,7 +11,7 @@ class Build : NukeBuild /// - Microsoft VisualStudio https://nuke.build/visualstudio /// - Microsoft VSCode https://nuke.build/vscode - public static int Main() => Execute(x => x.CheckTestCases); + public static int Main() => Execute(x => x.AuditAllIdsFiles); [Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] private readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release; @@ -19,13 +19,33 @@ class Build : NukeBuild [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; - /// - /// Checks the validity of development folder in the repository, using ids-tool. - /// The tool is deployed by the annotated . - /// - Target AuditDevelopment => _ => _ + /// + /// Audits the validity of development folder in the repository, using ids-tool. + /// The tool is deployed by the annotated . + /// The schema is loaded from the repository to ensure internal coherence. + /// + 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")); + + /// + /// Audits the validity of development folder in the repository, using ids-tool. + /// The tool is deployed by the annotated . + /// The schema is loaded from the repository to ensure internal coherence. + /// + Target AuditDevelopment => _ => _ .AssuredAfterFailure() .Executes(() => { @@ -36,13 +56,20 @@ class Build : NukeBuild IdsTool(arguments, workingDirectory: IdsToolPath); }); - Target AuditDocTestCases => _ => _ + /// + /// Audits the validity of Documentation/testcases folder in the repository, using ids-tool. + /// The tool is deployed by the annotated . + /// The schema is loaded from the repository to ensure internal coherence. + /// + 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}\""; @@ -50,14 +77,16 @@ class Build : NukeBuild }); /// - /// 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 /// - 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."); }); + + } diff --git a/build/_build.csproj b/build/_build.csproj index f7529e8..512a8b4 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -11,8 +11,12 @@ - + + + + +