From a1f83f325aa03659f37194910dd35aacaa5a4b5c Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Tue, 27 Feb 2024 14:22:04 +0100 Subject: [PATCH] Add Pipeline execution function that generates ARC-spec v2 draft compliant output folder. --- src/ARCExpect/RELEASE_NOTES.md | 4 ++++ src/ARCExpect/TopLevelAPI.fs | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/ARCExpect/RELEASE_NOTES.md b/src/ARCExpect/RELEASE_NOTES.md index 7bdf954..75e0d0e 100644 --- a/src/ARCExpect/RELEASE_NOTES.md +++ b/src/ARCExpect/RELEASE_NOTES.md @@ -1,3 +1,7 @@ +### 1.0.1 - (Released 2024-02-27) + +Add Pipeline execution function that generates ARC-spec v2 draft compliant output folder. + ### 1.0.0 - (Released 2024-01-12) First release of ARCExpect API as a package. Initially, it was only used in the `arc-validate` CLI tool. diff --git a/src/ARCExpect/TopLevelAPI.fs b/src/ARCExpect/TopLevelAPI.fs index 07db66f..d9ad339 100644 --- a/src/ARCExpect/TopLevelAPI.fs +++ b/src/ARCExpect/TopLevelAPI.fs @@ -2,6 +2,7 @@ open AnyBadge.NET open Expecto +open System.IO type Execute = @@ -48,5 +49,33 @@ type Execute = results |> Execute.JUnitSummaryCreation(jUnitPath) + results + |> Execute.BadgeCreation(badgePath, labelText, ?ValueSuffix = ValueSuffix, ?Thresholds = Thresholds, ?DefaultColor = DefaultColor) + + static member ValidationPipeline( + basePath: string, + packageName: string, + ?BadgeLabelText: string, + ?ValueSuffix: string, + ?Thresholds: Map, + ?DefaultColor: Color + ) = + fun (validationCases: Test) -> + + let resultFolder = Path.Combine(basePath, ".arc-validate-results", packageName) + let badgePath = Path.Combine(resultFolder, "badge.svg") + let jUnitPath = Path.Combine(resultFolder, "validation_report.xml") + + Directory.CreateDirectory(resultFolder) |> ignore + + let results = + validationCases + |> Execute.Validation + + results + |> Execute.JUnitSummaryCreation(jUnitPath) + + let labelText = defaultArg BadgeLabelText packageName + results |> Execute.BadgeCreation(badgePath, labelText, ?ValueSuffix = ValueSuffix, ?Thresholds = Thresholds, ?DefaultColor = DefaultColor) \ No newline at end of file