build-system/gnu: Add 'bootstrap' phase.
[jackhill/guix/guix.git] / gnu / packages / ci.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
3 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
4 ;;; Copyright © 2016, 2017 Mathieu Lirzin <mthl@gnu.org>
5 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
6 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages ci)
24 #:use-module ((guix licenses) #:prefix l:)
25 #:use-module (gnu packages)
26 #:use-module (guix packages)
27 #:use-module (guix git-download)
28 #:use-module (gnu packages autotools)
29 #:use-module (gnu packages base)
30 #:use-module (gnu packages docbook)
31 #:use-module (gnu packages compression)
32 #:use-module (gnu packages databases)
33 #:use-module (gnu packages guile)
34 #:use-module (gnu packages mail)
35 #:use-module (gnu packages package-management)
36 #:use-module (gnu packages perl)
37 #:use-module (gnu packages pkg-config)
38 #:use-module (gnu packages tls)
39 #:use-module (gnu packages texinfo)
40 #:use-module (gnu packages version-control)
41 #:use-module (gnu packages web)
42 #:use-module (gnu packages xml)
43 #:use-module (guix build-system gnu))
44
45 (define-public hydra
46 (let ((commit "1ff48da3d3d4a425063f5b7dd0b89d35270f8932"))
47 (package
48 (name "hydra")
49 (version (string-append "20151030." (string-take commit 7)))
50 (source (origin
51 (method git-fetch)
52 (uri (git-reference
53 (url "https://github.com/NixOS/hydra")
54 (commit commit)))
55 (file-name (string-append name "-" version))
56 (patches (search-patches
57 ;; TODO: Remove once we have a darcs input
58 "hydra-disable-darcs-test.patch"))
59 (sha256
60 (base32
61 "0ni8i8v1nxxfr51rz8m6znwpbm77vr7i05k506hmgmg32r938lap"))))
62 (build-system gnu-build-system)
63 (native-inputs
64 `(("unzip" ,unzip)
65 ("pkg-config" ,pkg-config)
66 ;; For documentation
67 ("dblatex" ,dblatex)
68 ("xsltproc" ,libxslt)
69 ("docbook-xsl" ,docbook-xsl)
70 ;; For bootstrap
71 ("autoconf" ,autoconf)
72 ("automake" ,automake)
73 ("libtool" ,libtool)
74 ;; For tests
75 ("git" ,git)
76 ("subversion" ,subversion)
77 ("mercurial" ,mercurial)
78 ("bazaar" ,bazaar)))
79 (inputs
80 `(("libpqxx" ,libpqxx)
81 ("perl" ,perl)
82 ("guile" ,guile-2.0)
83 ("openssl" ,openssl)
84 ("bzip2" ,bzip2)
85 ("gzip" ,gzip)
86 ("sed" ,sed)
87 ("starman" ,starman)
88 ("git" ,git)
89 ("subversion" ,subversion)
90 ("mercurial" ,mercurial)
91 ("bazaar" ,bazaar)
92 ("nix" ,nix)
93 ;; Lots o' perl modules...
94 ("perl-catalyst-action-rest" ,perl-catalyst-action-rest)
95 ("perl-catalyst-authentication-store-dbix-class"
96 ,perl-catalyst-authentication-store-dbix-class)
97 ("perl-catalyst-devel" ,perl-catalyst-devel)
98 ("perl-catalyst-dispatchtype-regex" ,perl-catalyst-dispatchtype-regex)
99 ("perl-catalyst-plugin-accesslog" ,perl-catalyst-plugin-accesslog)
100 ("perl-catalyst-plugin-authorization-roles"
101 ,perl-catalyst-plugin-authorization-roles)
102 ("perl-catalyst-plugin-captcha" ,perl-catalyst-plugin-captcha)
103 ("perl-catalyst-plugin-session-state-cookie"
104 ,perl-catalyst-plugin-session-state-cookie)
105 ("perl-catalyst-plugin-session-store-fastmmap"
106 ,perl-catalyst-plugin-session-store-fastmmap)
107 ("perl-catalyst-plugin-stacktrace" ,perl-catalyst-plugin-stacktrace)
108 ("perl-catalyst-traitfor-request-proxybase"
109 ,perl-catalyst-traitfor-request-proxybase)
110 ("perl-catalyst-view-download" ,perl-catalyst-view-download)
111 ("perl-catalyst-view-json" ,perl-catalyst-view-json)
112 ("perl-catalyst-view-tt" ,perl-catalyst-view-tt)
113 ("perl-catalystx-roleapplicator" ,perl-catalystx-roleapplicator)
114 ("perl-catalystx-script-server-starman"
115 ,perl-catalystx-script-server-starman)
116 ("perl-crypt-randpasswd" ,perl-crypt-randpasswd)
117 ("perl-data-dump" ,perl-data-dump)
118 ("perl-datetime" ,perl-datetime)
119 ("perl-dbd-pg" ,perl-dbd-pg)
120 ("perl-dbd-sqlite" ,perl-dbd-sqlite)
121 ("perl-digest-sha1" ,perl-digest-sha1)
122 ("perl-email-mime" ,perl-email-mime)
123 ("perl-email-sender" ,perl-email-sender)
124 ("perl-file-slurp" ,perl-file-slurp)
125 ("perl-io-compress" ,perl-io-compress)
126 ("perl-ipc-run" ,perl-ipc-run)
127 ("perl-json-any" ,perl-json-any)
128 ("perl-json-xs" ,perl-json-xs)
129 ("perl-libwww" ,perl-libwww)
130 ("perl-lwp-protocol-https" ,perl-lwp-protocol-https)
131 ("perl-net-amazon-s3" ,perl-net-amazon-s3)
132 ("perl-net-statsd" ,perl-net-statsd)
133 ("perl-padwalker" ,perl-padwalker)
134 ("perl-readonly" ,perl-readonly)
135 ("perl-set-scalar" ,perl-set-scalar)
136 ("perl-sql-splitstatement" ,perl-sql-splitstatement)
137 ("perl-sys-hostname-long" ,perl-sys-hostname-long)
138 ("perl-text-diff" ,perl-text-diff)
139 ("perl-text-table" ,perl-text-table)
140 ("perl-xml-simple" ,perl-xml-simple)))
141 (arguments
142 `(#:configure-flags
143 (let ((docbook (assoc-ref %build-inputs "docbook-xsl")))
144 (list (string-append "--with-docbook-xsl="
145 docbook "/xml/xsl/docbook-xsl-"
146 ,(package-version docbook-xsl))
147 (string-append "--docdir=" %output
148 "/doc/hydra-" ,version)))
149 #:phases (modify-phases %standard-phases
150 (add-before
151 'check 'check-setup
152 (lambda _ (setenv "LOGNAME" "test.log")))
153 (add-after
154 'install 'wrap-program
155 (lambda* (#:key inputs outputs #:allow-other-keys)
156 (let ((out (assoc-ref outputs "out")))
157 (for-each
158 (lambda (file)
159 (wrap-program file
160 `("PATH" ":" prefix
161 (,(string-append out "/bin")
162 ,@(map (lambda (i)
163 (string-append (assoc-ref inputs i)
164 "/bin"))
165 '("subversion" "git" "bazaar"
166 "mercurial" "coreutils" "gzip"
167 "sed" "unzip" "nix"))))
168 `("PERL5LIB" ":" prefix
169 (,(string-append out "/libexec/hydra/lib")
170 ,@(search-path-as-string->list
171 (getenv "PERL5LIB"))))
172 `("HYDRA_RELEASE" = (,,version))
173 `("HYDRA_HOME" =
174 (,(string-append out "/libexec/hydra")))
175 `("NIX_RELEASE" = (,,(package-version nix)))))
176 (find-files (string-append out "/bin")
177 ".*"))))))))
178 (home-page "https://nixos.org/hydra")
179 (synopsis "Continuous build system")
180 (description
181 "Hydra is a tool for continuous integration testing and software
182 release that uses a purely functional language to describe build jobs and
183 their dependencies.")
184 (license l:gpl3+))))
185
186 (define-public cuirass
187 (let ((commit "4ab2f2c3f084ffd9d0f77134cc1af0f8cf0e13be")
188 (revision "12"))
189 (package
190 (name "cuirass")
191 (version (string-append "0.0.1-" revision "." (string-take commit 7)))
192 (source (origin
193 (method git-fetch)
194 (uri (git-reference
195 (url "https://git.savannah.gnu.org/git/guix/guix-cuirass.git")
196 (commit commit)))
197 (file-name (string-append name "-" version))
198 (sha256
199 (base32
200 "1r97z5lkzg6vx014rfmv1pp3x3bl1shb6wkcgnlncwqf56a9bzi1"))))
201 (build-system gnu-build-system)
202 (arguments
203 '(#:modules ((guix build utils)
204 (guix build gnu-build-system)
205 (ice-9 rdelim)
206 (ice-9 popen))
207
208 #:phases
209 (modify-phases %standard-phases
210 (add-after 'unpack 'disable-repo-tests
211 (λ _
212 ;; Disable tests that use a connection to the Guix daemon.
213 (substitute* "Makefile.am"
214 (("tests/repo.scm \\\\") "\\"))
215 #t))
216 (add-after 'disable-repo-tests 'patch-/bin/sh
217 (lambda _
218 (substitute* "build-aux/git-version-gen"
219 (("#!/bin/sh") (string-append "#!" (which "sh"))))
220 #t))
221 (add-after 'install 'wrap-program
222 (lambda* (#:key inputs outputs #:allow-other-keys)
223 ;; Wrap the 'cuirass' command to refer to the right modules.
224 (let* ((out (assoc-ref outputs "out"))
225 (json (assoc-ref inputs "guile-json"))
226 (sqlite (assoc-ref inputs "guile-sqlite3"))
227 (git (assoc-ref inputs "guile-git"))
228 (bytes (assoc-ref inputs "guile-bytestructures"))
229 (fibers (assoc-ref inputs "guile-fibers"))
230 (guix (assoc-ref inputs "guix"))
231 (guile (assoc-ref %build-inputs "guile"))
232 (effective (read-line
233 (open-pipe* OPEN_READ
234 (string-append guile "/bin/guile")
235 "-c" "(display (effective-version))")))
236 (mods (string-append json "/share/guile/site/"
237 effective ":"
238 git "/share/guile/site/"
239 effective ":"
240 bytes "/share/guile/site/"
241 effective ":"
242 sqlite "/share/guile/site/"
243 effective ":"
244 fibers "/share/guile/site/"
245 effective ":"
246 guix "/share/guile/site/"
247 effective)))
248 ;; Make sure 'cuirass' can find the 'evaluate' command, as
249 ;; well as the relevant Guile modules.
250 (wrap-program (string-append out "/bin/cuirass")
251 `("PATH" ":" prefix (,(string-append out "/bin")))
252 `("GUILE_LOAD_PATH" ":" prefix (,mods))
253 `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,mods)))
254 #t))))))
255 (inputs
256 `(("guile" ,guile-2.2)
257 ("guile-fibers" ,guile-fibers)
258 ("guile-json" ,guile-json)
259 ("guile-sqlite3" ,guile-sqlite3)
260 ("guile-git" ,guile-git)
261 ;; FIXME: this is propagated by "guile-git", but it needs to be among
262 ;; the inputs to add it to GUILE_LOAD_PATH.
263 ("guile-bytestructures" ,guile-bytestructures)
264 ("guix" ,guix)))
265 (native-inputs
266 `(("autoconf" ,autoconf)
267 ("automake" ,automake)
268 ("pkg-config" ,pkg-config)
269 ("texinfo" ,texinfo)))
270 (native-search-paths
271 ;; For HTTPS access, Cuirass itself honors these variables, with the
272 ;; same semantics as Git and OpenSSL (respectively).
273 (list (search-path-specification
274 (variable "GIT_SSL_CAINFO")
275 (file-type 'regular)
276 (separator #f) ;single entry
277 (files '("etc/ssl/certs/ca-certificates.crt")))
278 (search-path-specification
279 (variable "SSL_CERT_DIR")
280 (files '("etc/ssl/certs")))))
281 (synopsis "Continuous integration system")
282 (description
283 "Cuirass is a continuous integration tool using GNU Guix. It is
284 intended as a replacement for Hydra.")
285 (home-page "https://www.gnu.org/software/guix/")
286 (license l:gpl3+))))