-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Reports to ArtifactsSpec and correctly render them
- Loading branch information
Showing
9 changed files
with
99 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
let ArtifactsSpec = ./Type.dhall | ||
|
||
let mergeOptionalRight = ../utils/mergeOptionalRight.dhall | ||
let Reports = ../Reports/package.dhall | ||
|
||
let mergeOptional = ../utils/mergeOptional.dhall | ||
|
||
let mergeOptionalList = ../utils/mergeOptionalList.dhall | ||
|
||
let append | ||
: ArtifactsSpec → ArtifactsSpec → ArtifactsSpec | ||
= λ(a : ArtifactsSpec) → | ||
λ(b : ArtifactsSpec) → | ||
{ when = b.when | ||
, expire_in = b.expire_in | ||
, reports.junit = | ||
mergeOptionalRight Text a.reports.junit b.reports.junit | ||
, paths = a.paths # b.paths | ||
, reports = | ||
mergeOptional Reports.Type Reports.append a.reports b.reports | ||
, paths = mergeOptionalList Text a.paths b.paths | ||
} | ||
|
||
in append |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
let When = ../When/Type.dhall | ||
|
||
let Duration = ../Duration/Type.dhall | ||
|
||
let Reports = ../Reports/Type.dhall | ||
|
||
in { when = When.OnSuccess | ||
, expire_in = ../Duration/fromDays.dhall 30 | ||
, reports.junit = None Text | ||
, paths = [] : List Text | ||
, expire_in = None Duration | ||
, reports = None Reports | ||
, paths = None (List Text) | ||
} | ||
: ./Type.dhall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ junit : Optional (List Text) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
let Reports = ./Type.dhall | ||
|
||
let mergeOptionalList = ../utils/mergeOptionalList.dhall | ||
|
||
let append | ||
: Reports → Reports → Reports | ||
= λ(a : Reports) → | ||
λ(b : Reports) → | ||
{ junit = mergeOptionalList Text a.junit b.junit } | ||
|
||
in append |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ junit = None (List Text) } : ./Type.dhall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ Type = ./Type.dhall | ||
, default = ./default.dhall | ||
, toJSON = ./toJSON.dhall | ||
, append = ./append.dhall | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
let Prelude = ../Prelude.dhall | ||
|
||
let Map = Prelude.Map | ||
|
||
let JSON = Prelude.JSON | ||
|
||
let dropNones = ../utils/dropNones.dhall | ||
|
||
let Optional/map = Prelude.Optional.map | ||
|
||
let Reports = ./Type.dhall | ||
|
||
let stringsArray | ||
: List Text → JSON.Type | ||
= λ(xs : List Text) → | ||
JSON.array (Prelude.List.map Text JSON.Type JSON.string xs) | ||
|
||
in let Reports/toJSON | ||
: Reports → JSON.Type | ||
= λ(reports : Reports) → | ||
let everything | ||
: Map.Type Text (Optional JSON.Type) | ||
= toMap | ||
{ junit = | ||
Optional/map | ||
(List Text) | ||
JSON.Type | ||
stringsArray | ||
reports.junit | ||
} | ||
|
||
in JSON.object (dropNones Text JSON.Type everything) | ||
|
||
in Reports/toJSON |