gnu: cuirass: Update to 1.0.0-9.d601fe0.
[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 "d601fe0e4c85ab7b37f0571e898448c9fadde715")
59 (revision "9"))
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 "09d05bqy7wqz9175b4nv3sqasibx4175kmiz75id05ipr0vn0j12"))))
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 #:parallel-tests? #f
81 #:phases
82 (modify-phases %standard-phases
83 (add-before 'bootstrap 'fix-version-gen
84 (lambda _
85 (patch-shebang "build-aux/git-version-gen")
86
87 (call-with-output-file ".tarball-version"
88 (lambda (port)
89 (display ,version port)))))
90 (add-before 'check 'set-PATH-for-tests
91 (lambda* (#:key inputs #:allow-other-keys)
92 (let ((pg (assoc-ref inputs "ephemeralpg"))
93 (path (getenv "PATH")))
94 (setenv "PATH" (string-append pg "/bin:" path))
95 #t)))
96 ;; Disable the remote tests that require a Guix daemon connection.
97 (add-before 'check 'disable-remote-tests
98 (lambda _
99 (substitute* "Makefile.am"
100 (("tests/remote.scm") ""))
101 #t))
102 (add-after 'install 'wrap-program
103 (lambda* (#:key inputs outputs #:allow-other-keys)
104 ;; Wrap the 'cuirass' command to refer to the right modules.
105 (let* ((out (assoc-ref outputs "out"))
106 (avahi (assoc-ref inputs "guile-avahi"))
107 (gcrypt (assoc-ref inputs "guile-gcrypt"))
108 (json (assoc-ref inputs "guile-json"))
109 (zmq (assoc-ref inputs "guile-simple-zmq"))
110 (squee (assoc-ref inputs "guile-squee"))
111 (git (assoc-ref inputs "guile-git"))
112 (bytes (assoc-ref inputs "guile-bytestructures"))
113 (fibers (assoc-ref inputs "guile-fibers"))
114 (zlib (assoc-ref inputs "guile-zlib"))
115 (matd (assoc-ref inputs "guile-mastodon"))
116 (tls (assoc-ref inputs "gnutls"))
117 (mail (assoc-ref inputs "mailutils"))
118 (guix (assoc-ref inputs "guix"))
119 (deps (list avahi gcrypt json zmq squee git bytes
120 fibers zlib matd tls mail guix))
121 (guile (assoc-ref %build-inputs "guile"))
122 (effective
123 (read-line
124 (open-pipe* OPEN_READ
125 (string-append guile "/bin/guile")
126 "-c" "(display (effective-version))")))
127 (mods
128 (string-drop-right ;drop trailing colon
129 (string-join deps
130 (string-append "/share/guile/site/"
131 effective ":")
132 'suffix)
133 1))
134 (objs
135 (string-drop-right
136 (string-join deps
137 (string-append "/lib/guile/" effective
138 "/site-ccache:")
139 'suffix)
140 1)))
141 ;; Make sure 'cuirass' can find the relevant Guile modules.
142 (wrap-program (string-append out "/bin/cuirass")
143 `("PATH" ":" prefix (,(string-append out "/bin")))
144 `("GUILE_LOAD_PATH" ":" prefix (,mods))
145 `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,objs)))
146 #t))))))
147 (inputs
148 `(("guile" ,guile-3.0/libgc-7)
149 ("guile-avahi" ,guile-avahi)
150 ("guile-fibers" ,guile-fibers)
151 ("guile-gcrypt" ,guile-gcrypt)
152 ("guile-json" ,guile-json-4)
153 ("guile-simple-zmq" ,guile-simple-zmq)
154 ("guile-squee" ,guile-squee)
155 ("guile-git" ,guile-git)
156 ("guile-zlib" ,guile-zlib)
157 ("guile-mastodon" ,guile-mastodon)
158 ("gnutls" ,gnutls)
159 ("mailutils" ,mailutils)
160 ;; FIXME: this is propagated by "guile-git", but it needs to be among
161 ;; the inputs to add it to GUILE_LOAD_PATH.
162 ("guile-bytestructures" ,guile-bytestructures)
163 ("guix" ,guix)))
164 (native-inputs
165 `(("autoconf" ,autoconf)
166 ("automake" ,automake)
167 ("pkg-config" ,pkg-config)
168 ("texinfo" ,texinfo)
169 ("ephemeralpg" ,ephemeralpg)))
170 (native-search-paths
171 ;; For HTTPS access, Cuirass itself honors these variables, with the
172 ;; same semantics as Git and OpenSSL (respectively).
173 (list (search-path-specification
174 (variable "GIT_SSL_CAINFO")
175 (file-type 'regular)
176 (separator #f) ;single entry
177 (files '("etc/ssl/certs/ca-certificates.crt")))
178 (search-path-specification
179 (variable "SSL_CERT_DIR")
180 (files '("etc/ssl/certs")))))
181 (synopsis "Continuous integration system")
182 (description
183 "Cuirass is a continuous integration tool using GNU Guix. It is
184 intended as a replacement for Hydra.")
185 (home-page "https://guix.gnu.org/cuirass/")
186 (license l:gpl3+))))
187
188 (define-public laminar
189 (package
190 (name "laminar")
191 (version "1.0")
192 (source
193 (origin (method url-fetch)
194 (uri (string-append "https://github.com/ohwgiles/laminar/archive/"
195 version
196 ".tar.gz"))
197 (file-name (string-append name "-" version ".tar.gz"))
198 (sha256
199 (base32
200 "11m6h3rdmj2rsmsryy7r40gqccj4gg1cnqwy6blscs87gx4s423g"))))
201 (build-system cmake-build-system)
202 (arguments
203 `(#:tests? #f ; TODO Can't build tests
204 #:configure-flags
205 (list "-DCMAKE_CXX_STANDARD=17"
206 ;; "-DBUILD_TESTS=true" TODO: objcopy: js/stPskyUS: can't add
207 ;; section '.note.GNU-stack': file format not recognized
208 (string-append "-DLAMINAR_VERSION=" ,version))
209 #:phases
210 (modify-phases %standard-phases
211 (add-after 'unpack 'patch-CMakeLists.txt
212 (lambda _
213 (substitute* "CMakeLists.txt"
214 (("file\\(DOWNLOAD.*\n$")
215 "# file download removed by Guix --")
216 (("install\\(FILES etc/laminar.service DESTINATION \\$\\{SYSTEMD\\_UNITDIR\\}\\)")
217 "")
218 (("install\\(FILES \\$\\{CMAKE\\_CURRENT\\_BINARY\\_DIR\\}\\/laminar\\.service DESTINATION \\$\\{SYSTEMD\\_UNITDIR\\}\\)")
219 "")
220 (("install\\(FILES etc/laminar\\.conf DESTINATION \\/etc\\)") "")
221 (("\\/usr\\/") ""))
222 #t))
223 (add-after 'configure 'copy-in-javascript-and-css
224 (lambda* (#:key inputs outputs #:allow-other-keys)
225 (use-modules (ice-9 popen))
226
227 (mkdir-p "../build/js")
228 (for-each (lambda (name)
229 (let* ((file
230 (assoc-ref inputs (string-append name ".js")))
231 (port
232 (open-pipe* OPEN_READ "uglify-js" file))
233 (destination
234 (string-append
235 "../build/js/" name ".min.js")))
236
237 (call-with-output-file destination
238 (lambda (output-port)
239 (dump-port port output-port)))
240
241 (let ((exit (close-pipe port)))
242 (unless (zero? exit)
243 (error "uglify-js failed" exit)))))
244
245 '("vue"
246 "vue-router"
247 "Chart"))
248
249 ;; ansi_up.js isn't minified
250 (copy-file (assoc-ref inputs "ansi_up.js")
251 "../build/js/ansi_up.js")
252
253 #t)))))
254 (inputs
255 `(("capnproto" ,capnproto)
256 ("rapidjson" ,rapidjson)
257 ("sqlite" ,sqlite)
258 ("boost" ,boost)
259 ("zlib" ,zlib)))
260 (native-inputs
261 `(("googletest" ,googletest)
262 ("uglify-js" ,uglify-js)
263
264 ("vue.js"
265 ,(origin (method url-fetch)
266 (uri (string-append "https://raw.githubusercontent.com/"
267 "vuejs/vue/v2.6.12/dist/vue.js"))
268 (sha256
269 (base32
270 "1mq2dn6yqbmzar77xf4x2bvvanf9xc9nwfq06sksl5zmr300m7qm"))))
271 ("vue-router.js"
272 ,(origin (method url-fetch)
273 (uri (string-append "https://raw.githubusercontent.com/"
274 "vuejs/vue-router/v3.4.8/dist/vue-router.js"))
275 (sha256
276 (base32
277 "1hkrbgzhpnrsb4zdafslqagy1vkac6bkdj7kh49js2lhkp9z4nj5"))))
278 ("ansi_up.js"
279 ,(origin (method url-fetch)
280 (uri (string-append "https://raw.githubusercontent.com/"
281 "drudru/ansi_up/v1.3.0/ansi_up.js"))
282 (sha256
283 (base32
284 "1993dywxqi2ylnxybwk7m0s0bg2bq7kfllpyr0s8ck6chd0p8i6r"))))
285 ("Chart.js"
286 ,(origin (method url-fetch)
287 (uri (string-append "https://github.com/chartjs/Chart.js/"
288 "releases/download/v2.7.2/Chart.js"))
289 (sha256
290 (base32
291 "05m3gk6hqjx92j20drnk7q075qpjraywqaf25lnglmsgsgpiqsr7"))))))
292 (synopsis "Lightweight continuous integration service")
293 (description
294 "Laminar is a lightweight and modular continuous integration service. It
295 doesn't have a configuration web UI instead uses version-controllable
296 configuration files and scripts.
297
298 Laminar encourages the use of existing tools such as bash and cron instead of
299 reinventing them.")
300 (home-page "https://laminar.ohwg.net/")
301 (license l:gpl3+)))