Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions GitLab/ArtifactsSpec/Type.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ let When = ../When/Type.dhall

let Duration = ../Duration/Type.dhall

let Reports = ../Reports/Type.dhall

in { when : When
, expire_in : Duration
, reports : { junit : Optional Text }
, paths : List Text
, expire_in : Optional Duration
, reports : Optional Reports
, paths : Optional (List Text)
}
12 changes: 8 additions & 4 deletions GitLab/ArtifactsSpec/append.dhall
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
10 changes: 7 additions & 3 deletions GitLab/ArtifactsSpec/default.dhall
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
35 changes: 27 additions & 8 deletions GitLab/ArtifactsSpec/toJSON.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,48 @@ let JSON = Prelude.JSON

let ArtifactsSpec = ../ArtifactsSpec/Type.dhall

let Reports = ../Reports/package.dhall

let Duration = ../Duration/package.dhall

let Optional/map = Prelude.Optional.map

let dropNones = ../utils/dropNones.dhall

let When/toJSON = ../When/toJSON.dhall

let Duration/toJSON = ../Duration/toJSON.dhall

let List/map = Prelude.List.map

let Optional/map = Prelude.Optional.map

let stringsArray
: List Text → JSON.Type
= λ(xs : List Text) →
JSON.array (Prelude.List.map Text JSON.Type JSON.string xs)

in let ArtifactsSpec/toJSON
: ArtifactsSpec → JSON.Type
= λ(cs : ArtifactsSpec) →
let obj
: Map.Type Text JSON.Type
: Map.Type Text (Optional JSON.Type)
= toMap
{ when = When/toJSON cs.when
, expire_in = Duration/toJSON cs.expire_in
{ when = Some (When/toJSON cs.when)
, expire_in =
Optional/map
Duration.Type
JSON.Type
Duration.toJSON
cs.expire_in
, reports =
Optional/map
Reports.Type
JSON.Type
Reports.toJSON
cs.reports
, paths =
JSON.array
(List/map Text JSON.Type JSON.string cs.paths)
Optional/map (List Text) JSON.Type stringsArray cs.paths
}

in JSON.object obj
in JSON.object (dropNones Text JSON.Type obj)

in ArtifactsSpec/toJSON
3 changes: 3 additions & 0 deletions GitLab/CacheKey/Type.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let CacheKeyFiles = ../CacheKeyFiles/Type.dhall

in < Files : CacheKeyFiles | Text : Text >
1 change: 1 addition & 0 deletions GitLab/CacheKey/package.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ Type = ./Type.dhall, toJSON = ./toJSON.dhall }
18 changes: 18 additions & 0 deletions GitLab/CacheKey/toJSON.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
let Prelude = ../Prelude.dhall

let JSON = Prelude.JSON

let CacheKey = ./Type.dhall

let CacheKeyFiles = ../CacheKeyFiles/package.dhall

let CacheKey/toJSON
: CacheKey → JSON.Type
= λ(cku : CacheKey) →
merge
{ Files = λ(c : CacheKeyFiles.Type) → CacheKeyFiles.toJSON c
, Text = λ(t : Text) → JSON.string t
}
cku

in CacheKey/toJSON
1 change: 1 addition & 0 deletions GitLab/CacheKeyFiles/Type.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ files : List Text, prefix : Optional Text }
1 change: 1 addition & 0 deletions GitLab/CacheKeyFiles/default.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ files = [] : List Text, prefix = None Text } : ./Type.dhall
1 change: 1 addition & 0 deletions GitLab/CacheKeyFiles/package.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ Type = ./Type.dhall, default = ./default.dhall, toJSON = ./toJSON.dhall }
43 changes: 43 additions & 0 deletions GitLab/CacheKeyFiles/toJSON.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
let Prelude = ../Prelude.dhall

let Map = Prelude.Map

let JSON = Prelude.JSON

let CacheKeyFiles = ./Type.dhall

let dropNones = ../utils/dropNones.dhall

let Optional/map = Prelude.Optional.map

let List/map = Prelude.List.map

let stringsArray
: List Text → JSON.Type
= λ(xs : List Text) →
JSON.array (Prelude.List.map Text JSON.Type JSON.string xs)

in let CacheKeyFiles/toJSON
: CacheKeyFiles → JSON.Type
= λ(ck : CacheKeyFiles) →
let obj
: Map.Type Text (Optional JSON.Type)
= toMap
{ files =
if Prelude.List.null Text ck.files
then None JSON.Type
else Some
( JSON.array
( Prelude.List.map
Text
JSON.Type
JSON.string
ck.files
)
)
, prefix = Optional/map Text JSON.Type JSON.string ck.prefix
}

in JSON.object (dropNones Text JSON.Type obj)

in CacheKeyFiles/toJSON
6 changes: 4 additions & 2 deletions GitLab/CacheSpec/Type.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ let When = ../When/Type.dhall

let CachePolicy = ../CachePolicy/Type.dhall

in { key : Text
let CacheKey = ../CacheKey/Type.dhall

in { key : Optional CacheKey
, paths : List Text
, untracked : Optional Bool
, when : When
, when : Optional When
, policy : Optional CachePolicy
}
13 changes: 13 additions & 0 deletions GitLab/CacheSpec/default.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
let When = ../When/Type.dhall

let CachePolicy = ../CachePolicy/Type.dhall

let CacheKey = ../CacheKey/Type.dhall

in { key = None CacheKey
, when = None When
, paths = [] : List Text
, untracked = None Bool
, policy = None CachePolicy
}
: ./Type.dhall
6 changes: 5 additions & 1 deletion GitLab/CacheSpec/package.dhall
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
{ Type = ./Type.dhall, toJSON = ./toJSON.dhall, append = ./append.dhall }
{ Type = ./Type.dhall
, default = ./default.dhall
, toJSON = ./toJSON.dhall
, append = ./append.dhall
}
49 changes: 44 additions & 5 deletions GitLab/CacheSpec/toJSON.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,19 @@ let Map = Prelude.Map

let JSON = Prelude.JSON

let When = ../When/package.dhall

let CacheSpec = ./Type.dhall

let CacheKey = ../CacheKey/package.dhall

let CachePolicy = ../CachePolicy/package.dhall

let stringsArray
: List Text → JSON.Type
= λ(xs : List Text) →
JSON.array (Prelude.List.map Text JSON.Type JSON.string xs)

let dropNones = ../utils/dropNones.dhall

let Optional/map = Prelude.Optional.map
Expand All @@ -16,14 +27,42 @@ in let CacheSpec/toJSON
: CacheSpec → JSON.Type
= λ(cs : CacheSpec) →
let obj
: Map.Type Text JSON.Type
: Map.Type Text (Optional JSON.Type)
= toMap
{ key = JSON.string cs.key
{ key =
Optional/map
CacheKey.Type
JSON.Type
CacheKey.toJSON
cs.key
, paths =
JSON.array
(List/map Text JSON.Type JSON.string cs.paths)
if Prelude.List.null Text cs.paths
then None JSON.Type
else Some
( JSON.array
( List/map
Text
JSON.Type
JSON.string
cs.paths
)
)
, untracked =
Optional/map Bool JSON.Type JSON.bool cs.untracked
, when =
Optional/map
When.Type
JSON.Type
When.toJSON
cs.when
, policy =
Optional/map
CachePolicy.Type
JSON.Type
CachePolicy.toJSON
cs.policy
}

in JSON.object obj
in JSON.object (dropNones Text JSON.Type obj)

in CacheSpec/toJSON
1 change: 1 addition & 0 deletions GitLab/CoverageFormat/Type.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
< Cobertura >
1 change: 1 addition & 0 deletions GitLab/CoverageFormat/package.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ Type = ./Type.dhall, toJSON = ./toJSON.dhall }
12 changes: 12 additions & 0 deletions GitLab/CoverageFormat/toJSON.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
let Prelude = ../Prelude.dhall

let JSON = Prelude.JSON

let CoverageFormat = ./Type.dhall

let CoverageFormat/toJSON
: CoverageFormat → JSON.Type
= λ(format : CoverageFormat) →
JSON.string (merge { Cobertura = "cobertura" } format)

in CoverageFormat/toJSON
3 changes: 3 additions & 0 deletions GitLab/CoverageReport/Type.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let CoverageFormat = ../CoverageFormat/Type.dhall

in { coverage_format : CoverageFormat, path : Text }
9 changes: 9 additions & 0 deletions GitLab/CoverageReport/append.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let CoverageReport = ./Type.dhall

let append
: CoverageReport → CoverageReport → CoverageReport
= λ(a : CoverageReport) →
λ(b : CoverageReport) →
{ coverage_format = b.coverage_format, path = b.path }

in append
1 change: 1 addition & 0 deletions GitLab/CoverageReport/package.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ Type = ./Type.dhall, toJSON = ./toJSON.dhall, append = ./append.dhall }
24 changes: 24 additions & 0 deletions GitLab/CoverageReport/toJSON.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
let Prelude = ../Prelude.dhall

let Map = Prelude.Map

let JSON = Prelude.JSON

let CoverageFormat = ../CoverageFormat/package.dhall

let CoverageReport = ./Type.dhall

in let CoverageReport/toJSON
: CoverageReport → JSON.Type
= λ(report : CoverageReport) →
let everything
: Map.Type Text JSON.Type
= toMap
{ coverage_format =
CoverageFormat.toJSON report.coverage_format
, path = JSON.string report.path
}

in JSON.object everything

in CoverageReport/toJSON
1 change: 1 addition & 0 deletions GitLab/Defaults/Type.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ in { image : Optional Text
, after_script : List Text
, services : List Service
, cache : Optional CacheSpec
, retry : Optional Natural
}
1 change: 1 addition & 0 deletions GitLab/Defaults/default.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ in { image = None Text
, after_script = [] : List Text
, services = [] : List Service
, cache = None CacheSpec
, retry = None Natural
}
: Defaults
2 changes: 2 additions & 0 deletions GitLab/Defaults/toJSON.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ let Defaults/toJSON
JSON.Type
CacheSpec.toJSON
defaults.cache
, retry =
Optional/map Natural JSON.Type JSON.natural defaults.retry
}

in JSON.object (dropNones Text JSON.Type everything)
Expand Down
Loading