@@ -5,10 +5,12 @@ module Bootstrap.Data.Bootstrappable.GitlabCIConfigSpec (spec) where
55
66import Bootstrap.Data.Bootstrappable (Bootstrappable (bootstrapContent ))
77import Bootstrap.Data.Bootstrappable.GitlabCIConfig (gitlabCIConfigFor )
8+ import Bootstrap.Data.Bootstrappable.NixPreCommitHookConfig
9+ ( nixPreCommitHookConfigFor ,
10+ )
811import Bootstrap.Data.ContinuousIntegration
912 ( ContinuousIntegrationConfig (ContinuousIntegrationConfig ),
1013 )
11- import Bootstrap.Data.PreCommitHook (PreCommitHooksConfig (PreCommitHooksConfig ))
1214import Bootstrap.Data.ProjectType
1315 ( ElmMode (ElmModeBare , ElmModeNode ),
1416 ElmOptions (ElmOptions ),
@@ -26,8 +28,7 @@ spec :: Spec
2628spec = describe " gitlab-ci.yml rendering" do
2729 let ciConfig = ContinuousIntegrationConfig True
2830 it " renders an Elm/Parcel gitlab-ci config without pre-commit checks correctly" do
29- let preCommitHooksConfig = PreCommitHooksConfig False
30- bootstrapContent (gitlabCIConfigFor ciConfig rcWithFlakes (Elm $ ElmOptions (ElmModeNode PNPm ) False ) preCommitHooksConfig)
31+ bootstrapContent (gitlabCIConfigFor ciConfig rcWithFlakes (Elm $ ElmOptions (ElmModeNode PNPm ) False ) Nothing )
3132 >>= ( `shouldBe`
3233 Right
3334 [r |image: nixos/nix@sha256:473a2b527958665554806aea24d0131bacec46d23af09fef4598eeab331850fa
@@ -52,8 +53,7 @@ build-site:
5253|]
5354 )
5455 it " renders an Elm/Parcel gitlab-ci config without pre-commit or flakes checks correctly" do
55- let preCommitHooksConfig = PreCommitHooksConfig False
56- bootstrapContent (gitlabCIConfigFor ciConfig rcDefault (Elm $ ElmOptions (ElmModeNode PNPm ) False ) preCommitHooksConfig)
56+ bootstrapContent (gitlabCIConfigFor ciConfig rcDefault (Elm $ ElmOptions (ElmModeNode PNPm ) False ) Nothing )
5757 >>= ( `shouldBe`
5858 Right
5959 [r |image: nixos/nix@sha256:473a2b527958665554806aea24d0131bacec46d23af09fef4598eeab331850fa
@@ -78,8 +78,9 @@ build-site:
7878|]
7979 )
8080 it " renders a bare Elm gitlab-ci config with pre-commit checks correctly" do
81- let preCommitHooksConfig = PreCommitHooksConfig True
82- bootstrapContent (gitlabCIConfigFor ciConfig rcDefault (Elm $ ElmOptions ElmModeBare True ) preCommitHooksConfig)
81+ let projectType = Elm $ ElmOptions ElmModeBare True
82+ nixPreCommitHookConfig = Just $ nixPreCommitHookConfigFor rcDefault projectType
83+ bootstrapContent (gitlabCIConfigFor ciConfig rcDefault projectType nixPreCommitHookConfig)
8384 >>= ( `shouldBe`
8485 Right
8586 [r |image: nixos/nix@sha256:473a2b527958665554806aea24d0131bacec46d23af09fef4598eeab331850fa
@@ -91,10 +92,10 @@ default:
9192 - nix-env -iA nixpkgs.bash nixpkgs.openssh
9293 - echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
9394
94- check-dev-environment:
95+ check-dev-environment-and-run-impure-hooks :
9596 stage: build
9697 script:
97- - nix-shell --run 'echo ok '
98+ - nix-shell --run 'elm-review '
9899
99100pre-commit-check:
100101 stage: build
@@ -107,8 +108,9 @@ build-site:
107108|]
108109 )
109110 it " renders a bare Elm gitlab-ci config with pre-commit checks and flakes correctly" do
110- let preCommitHooksConfig = PreCommitHooksConfig True
111- bootstrapContent (gitlabCIConfigFor ciConfig rcWithFlakes (Elm $ ElmOptions ElmModeBare True ) preCommitHooksConfig)
111+ let projectType = Elm $ ElmOptions ElmModeBare True
112+ nixPreCommitHookConfig = Just $ nixPreCommitHookConfigFor rcDefault projectType
113+ bootstrapContent (gitlabCIConfigFor ciConfig rcWithFlakes projectType nixPreCommitHookConfig)
112114 >>= ( `shouldBe`
113115 Right
114116 [r |image: nixos/nix@sha256:473a2b527958665554806aea24d0131bacec46d23af09fef4598eeab331850fa
@@ -120,10 +122,10 @@ default:
120122 - nix-env -iA nixpkgs.bash nixpkgs.openssh
121123 - echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
122124
123- check-dev-environment:
125+ check-dev-environment-and-run-impure-hooks :
124126 stage: build
125127 script:
126- - nix develop -c echo ok
128+ - nix develop -c elm-review
127129
128130pre-commit-check:
129131 stage: build
@@ -136,8 +138,7 @@ build-site:
136138|]
137139 )
138140 it " renders a Go gitlab-ci with a flake build and without pre-commit checks correctly" do
139- let preCommitHooksConfig = PreCommitHooksConfig False
140- bootstrapContent (gitlabCIConfigFor ciConfig rcWithFlakes (Go $ SetUpGoBuild True ) preCommitHooksConfig)
141+ bootstrapContent (gitlabCIConfigFor ciConfig rcWithFlakes (Go $ SetUpGoBuild True ) Nothing )
141142 >>= ( `shouldBe`
142143 Right
143144 [r |image: nixos/nix@sha256:473a2b527958665554806aea24d0131bacec46d23af09fef4598eeab331850fa
@@ -160,8 +161,9 @@ build:
160161|]
161162 )
162163 it " renders a Go gitlab-ci with a flake build and with pre-commit checks correctly" do
163- let preCommitHooksConfig = PreCommitHooksConfig True
164- bootstrapContent (gitlabCIConfigFor ciConfig rcWithFlakes (Go $ SetUpGoBuild True ) preCommitHooksConfig)
164+ let projectType = Go $ SetUpGoBuild True
165+ nixPreCommitHookConfig = Just $ nixPreCommitHookConfigFor rcDefault projectType
166+ bootstrapContent (gitlabCIConfigFor ciConfig rcWithFlakes projectType nixPreCommitHookConfig)
165167 >>= ( `shouldBe`
166168 Right
167169 [r |image: nixos/nix@sha256:473a2b527958665554806aea24d0131bacec46d23af09fef4598eeab331850fa
@@ -188,8 +190,7 @@ build:
188190|]
189191 )
190192 it " renders a Go gitlab-ci with a build and without pre-commit checks correctly" do
191- let preCommitHooksConfig = PreCommitHooksConfig False
192- bootstrapContent (gitlabCIConfigFor ciConfig rcDefault (Go $ SetUpGoBuild True ) preCommitHooksConfig)
193+ bootstrapContent (gitlabCIConfigFor ciConfig rcDefault (Go $ SetUpGoBuild True ) Nothing )
193194 >>= ( `shouldBe`
194195 Right
195196 [r |image: nixos/nix@sha256:473a2b527958665554806aea24d0131bacec46d23af09fef4598eeab331850fa
@@ -212,8 +213,9 @@ build:
212213|]
213214 )
214215 it " renders a Go gitlab-ci with a build and with pre-commit checks correctly" do
215- let preCommitHooksConfig = PreCommitHooksConfig True
216- bootstrapContent (gitlabCIConfigFor ciConfig rcDefault (Go $ SetUpGoBuild True ) preCommitHooksConfig)
216+ let projectType = Go $ SetUpGoBuild True
217+ nixPreCommitHookConfig = Just $ nixPreCommitHookConfigFor rcDefault projectType
218+ bootstrapContent (gitlabCIConfigFor ciConfig rcDefault projectType nixPreCommitHookConfig)
217219 >>= ( `shouldBe`
218220 Right
219221 [r |image: nixos/nix@sha256:473a2b527958665554806aea24d0131bacec46d23af09fef4598eeab331850fa
@@ -240,8 +242,9 @@ build:
240242|]
241243 )
242244 it " renders a gitlab-ci without a build and with pre-commit checks correctly" do
243- let preCommitHooksConfig = PreCommitHooksConfig True
244- bootstrapContent (gitlabCIConfigFor ciConfig rcDefault (Go $ SetUpGoBuild False ) preCommitHooksConfig)
245+ let projectType = Go $ SetUpGoBuild False
246+ nixPreCommitHookConfig = Just $ nixPreCommitHookConfigFor rcDefault projectType
247+ bootstrapContent (gitlabCIConfigFor ciConfig rcDefault projectType nixPreCommitHookConfig)
245248 >>= ( `shouldBe`
246249 Right
247250 [r |image: nixos/nix@sha256:473a2b527958665554806aea24d0131bacec46d23af09fef4598eeab331850fa
0 commit comments