gnu: emacs-consult: Fix grammar.
[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, 2020, 2021 Mathieu Othacehe <m.othacehe@gmail.com>
6 ;;; Copyright © 2017, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
7 ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 (define-module (gnu packages ci)
25 #:use-module ((guix licenses) #:prefix l:)
26 #:use-module (gnu packages)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix download)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages boost)
34 #:use-module (gnu packages check)
35 #:use-module (gnu packages docbook)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages databases)
38 #:use-module (gnu packages guile)
39 #:use-module (gnu packages guile-xyz)
40 #:use-module (gnu packages gnupg)
41 #:use-module (gnu packages lisp-xyz)
42 #:use-module (gnu packages mail)
43 #:use-module (gnu packages package-management)
44 #:use-module (gnu packages perl)
45 #:use-module (gnu packages perl-compression)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages serialization)
48 #:use-module (gnu packages sqlite)
49 #:use-module (gnu packages tls)
50 #:use-module (gnu packages texinfo)
51 #:use-module (gnu packages version-control)
52 #:use-module (gnu packages web)
53 #:use-module (gnu packages xml)
54 #:use-module (guix build-system cmake)
55 #:use-module (guix build-system gnu))
56
57 (define-public cuirass
58 (let ((commit "962923c13b914b84098b409948f8e328c74b4056")
59 (revision "15"))
60 (package
61 (name "cuirass")
62 (version (git-version "1.0.0" revision commit))
63 (source
64 (origin
65 (method git-fetch)
66 (uri (git-reference
67 (url "https://git.savannah.gnu.org/git/guix/guix-cuirass.git")
68 (commit commit)))
69 (file-name (git-file-name name version))
70 (sha256
71 (base32
72 "0nij7bvv1cxn47bdgd0lfqhnl8462il1ay6r39sp09zxni517mh7"))))
73 (build-system gnu-build-system)
74 (arguments
75 `(#:modules ((guix build utils)
76 (guix build gnu-build-system)
77 (ice-9 rdelim)
78 (ice-9 popen))
79 #:configure-flags '("--localstatedir=/var") ;for /var/log/cuirass
80 ;; XXX: HTTP tests fail on aarch64 due to Fibers errors, disable them
81 ;; on that architecture for now.
82 #:tests? ,(let ((s (or (%current-target-system)
83 (%current-system))))
84 (not (string-prefix? "aarch64" s)))
85 #:parallel-tests? #f
86 #:phases
87 (modify-phases %standard-phases
88 (add-before 'bootstrap 'fix-version-gen
89 (lambda _
90 (patch-shebang "build-aux/git-version-gen")
91
92 (call-with-output-file ".tarball-version"
93 (lambda (port)
94 (display ,version port)))))
95 (add-before 'check 'set-PATH-for-tests
96 (lambda* (#:key inputs #:allow-other-keys)
97 (let ((pg (assoc-ref inputs "ephemeralpg"))
98 (path (getenv "PATH")))
99 (setenv "PATH" (string-append pg "/bin:" path))
100 #t)))
101 ;; Disable the remote tests that require a Guix daemon connection.
102 (add-before 'check 'disable-remote-tests
103 (lambda _
104 (substitute* "Makefile.am"
105 (("tests/remote.scm") ""))
106 #t))
107 (add-after 'install 'wrap-program
108 (lambda* (#:key inputs outputs #:allow-other-keys)
109 ;; Wrap the 'cuirass' command to refer to the right modules.
110 (let* ((out (assoc-ref outputs "out"))
111 (avahi (assoc-ref inputs "guile-avahi"))
112 (gcrypt (assoc-ref inputs "guile-gcrypt"))
113 (json (assoc-ref inputs "guile-json"))
114 (zmq (assoc-ref inputs "guile-simple-zmq"))
115 (squee (assoc-ref inputs "guile-squee"))
116 (git (assoc-ref inputs "guile-git"))
117 (bytes (assoc-ref inputs "guile-bytestructures"))
118 (fibers (assoc-ref inputs "guile-fibers"))
119 (zlib (assoc-ref inputs "guile-zlib"))
120 (matd (assoc-ref inputs "guile-mastodon"))
121 (tls (assoc-ref inputs "gnutls"))
122 (mail (assoc-ref inputs "mailutils"))
123 (guix (assoc-ref inputs "guix"))
124 (deps (list avahi gcrypt json zmq squee git bytes
125 fibers zlib matd tls mail guix))
126 (guile (assoc-ref %build-inputs "guile"))
127 (effective
128 (read-line
129 (open-pipe* OPEN_READ
130 (string-append guile "/bin/guile")
131 "-c" "(display (effective-version))")))
132 (mods
133 (string-drop-right ;drop trailing colon
134 (string-join deps
135 (string-append "/share/guile/site/"
136 effective ":")
137 'suffix)
138 1))
139 (objs
140 (string-drop-right
141 (string-join deps
142 (string-append "/lib/guile/" effective
143 "/site-ccache:")
144 'suffix)
145 1)))
146 ;; Make sure 'cuirass' can find the relevant Guile modules.
147 (wrap-program (string-append out "/bin/cuirass")
148 `("PATH" ":" prefix (,(string-append out "/bin")))
149 `("GUILE_LOAD_PATH" ":" prefix (,mods))
150 `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,objs)))
151 #t))))))
152 (inputs
153 `(("guile" ,guile-3.0/libgc-7)
154 ("guile-avahi" ,guile-avahi)
155 ("guile-fibers" ,guile-fibers)
156 ("guile-gcrypt" ,guile-gcrypt)
157 ("guile-json" ,guile-json-4)
158 ("guile-simple-zmq" ,guile-simple-zmq)
159 ("guile-squee" ,guile-squee)
160 ("guile-git" ,guile-git)
161 ("guile-zlib" ,guile-zlib)
162 ("guile-mastodon" ,guile-mastodon)
163 ("gnutls" ,gnutls)
164 ("mailutils" ,mailutils)
165 ;; FIXME: this is propagated by "guile-git", but it needs to be among
166 ;; the inputs to add it to GUILE_LOAD_PATH.
167 ("guile-bytestructures" ,guile-bytestructures)
168 ("guix" ,guix)))
169 (native-inputs
170 `(("autoconf" ,autoconf)
171 ("automake" ,automake)
172 ("pkg-config" ,pkg-config)
173 ("texinfo" ,texinfo)
174 ("ephemeralpg" ,ephemeralpg)))
175 (native-search-paths
176 ;; For HTTPS access, Cuirass itself honors these variables, with the
177 ;; same semantics as Git and OpenSSL (respectively).
178 (list (search-path-specification
179 (variable "GIT_SSL_CAINFO")
180 (file-type 'regular)
181 (separator #f) ;single entry
182 (files '("etc/ssl/certs/ca-certificates.crt")))
183 (search-path-specification
184 (variable "SSL_CERT_DIR")
185 (files '("etc/ssl/certs")))))
186 (synopsis "Continuous integration system")
187 (description
188 "Cuirass is a continuous integration tool using GNU Guix. It is
189 intended as a replacement for Hydra.")
190 (home-page "https://guix.gnu.org/cuirass/")
191 (license l:gpl3+))))
192
193 (define-public laminar
194 (package
195 (name "laminar")
196 (version "1.0")
197 (source
198 (origin (method url-fetch)
199 (uri (string-append "https://github.com/ohwgiles/laminar/archive/"
200 version
201 ".tar.gz"))
202 (file-name (string-append name "-" version ".tar.gz"))
203 (sha256
204 (base32
205 "11m6h3rdmj2rsmsryy7r40gqccj4gg1cnqwy6blscs87gx4s423g"))))
206 (build-system cmake-build-system)
207 (arguments
208 `(#:tests? #f ; TODO Can't build tests
209 #:configure-flags
210 (list "-DCMAKE_CXX_STANDARD=17"
211 ;; "-DBUILD_TESTS=true" TODO: objcopy: js/stPskyUS: can't add
212 ;; section '.note.GNU-stack': file format not recognized
213 (string-append "-DLAMINAR_VERSION=" ,version))
214 #:phases
215 (modify-phases %standard-phases
216 (add-after 'unpack 'patch-CMakeLists.txt
217 (lambda _
218 (substitute* "CMakeLists.txt"
219 (("file\\(DOWNLOAD.*\n$")
220 "# file download removed by Guix --")
221 (("install\\(FILES etc/laminar.service DESTINATION \\$\\{SYSTEMD\\_UNITDIR\\}\\)")
222 "")
223 (("install\\(FILES \\$\\{CMAKE\\_CURRENT\\_BINARY\\_DIR\\}\\/laminar\\.service DESTINATION \\$\\{SYSTEMD\\_UNITDIR\\}\\)")
224 "")
225 (("install\\(FILES etc/laminar\\.conf DESTINATION \\/etc\\)") "")
226 (("\\/usr\\/") ""))
227 #t))
228 (add-after 'configure 'copy-in-javascript-and-css
229 (lambda* (#:key inputs outputs #:allow-other-keys)
230 (use-modules (ice-9 popen))
231
232 (mkdir-p "../build/js")
233 (for-each (lambda (name)
234 (let* ((file
235 (assoc-ref inputs (string-append name ".js")))
236 (port
237 (open-pipe* OPEN_READ "uglify-js" file))
238 (destination
239 (string-append
240 "../build/js/" name ".min.js")))
241
242 (call-with-output-file destination
243 (lambda (output-port)
244 (dump-port port output-port)))
245
246 (let ((exit (close-pipe port)))
247 (unless (zero? exit)
248 (error "uglify-js failed" exit)))))
249
250 '("vue"
251 "vue-router"
252 "Chart"))
253
254 ;; ansi_up.js isn't minified
255 (copy-file (assoc-ref inputs "ansi_up.js")
256 "../build/js/ansi_up.js")
257
258 #t)))))
259 (inputs
260 `(("capnproto" ,capnproto)
261 ("rapidjson" ,rapidjson)
262 ("sqlite" ,sqlite)
263 ("boost" ,boost)
264 ("zlib" ,zlib)))
265 (native-inputs
266 `(("googletest" ,googletest)
267 ("uglify-js" ,uglify-js)
268
269 ("vue.js"
270 ,(origin (method url-fetch)
271 (uri (string-append "https://raw.githubusercontent.com/"
272 "vuejs/vue/v2.6.12/dist/vue.js"))
273 (sha256
274 (base32
275 "1mq2dn6yqbmzar77xf4x2bvvanf9xc9nwfq06sksl5zmr300m7qm"))))
276 ("vue-router.js"
277 ,(origin (method url-fetch)
278 (uri (string-append "https://raw.githubusercontent.com/"
279 "vuejs/vue-router/v3.4.8/dist/vue-router.js"))
280 (sha256
281 (base32
282 "1hkrbgzhpnrsb4zdafslqagy1vkac6bkdj7kh49js2lhkp9z4nj5"))))
283 ("ansi_up.js"
284 ,(origin (method url-fetch)
285 (uri (string-append "https://raw.githubusercontent.com/"
286 "drudru/ansi_up/v1.3.0/ansi_up.js"))
287 (sha256
288 (base32
289 "1993dywxqi2ylnxybwk7m0s0bg2bq7kfllpyr0s8ck6chd0p8i6r"))))
290 ("Chart.js"
291 ,(origin (method url-fetch)
292 (uri (string-append "https://github.com/chartjs/Chart.js/"
293 "releases/download/v2.7.2/Chart.js"))
294 (sha256
295 (base32
296 "05m3gk6hqjx92j20drnk7q075qpjraywqaf25lnglmsgsgpiqsr7"))))))
297 (synopsis "Lightweight continuous integration service")
298 (description
299 "Laminar is a lightweight and modular continuous integration service. It
300 doesn't have a configuration web UI instead uses version-controllable
301 configuration files and scripts.
302
303 Laminar encourages the use of existing tools such as bash and cron instead of
304 reinventing them.")
305 (home-page "https://laminar.ohwg.net/")
306 (license l:gpl3+)))