e0c7238f2b576b9595838b85025cf194aa353d57
[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 git-download)
29 #:use-module (guix download)
30 #:use-module (gnu packages autotools)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages docbook)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages databases)
35 #:use-module (gnu packages guile)
36 #:use-module (gnu packages guile-xyz)
37 #:use-module (gnu packages gnupg)
38 #:use-module (gnu packages mail)
39 #:use-module (gnu packages package-management)
40 #:use-module (gnu packages perl)
41 #:use-module (gnu packages perl-compression)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages tls)
44 #:use-module (gnu packages texinfo)
45 #:use-module (gnu packages version-control)
46 #:use-module (gnu packages web)
47 #:use-module (gnu packages xml)
48 #:use-module (guix build-system gnu))
49
50 (define-public guile-mastodon-dev
51 (let ((commit "88115d85221876b1baea4accb7c76995da32f479")
52 (revision "1"))
53 (package
54 (inherit guile-mastodon)
55 (name "guile-mastodon")
56 (version (git-version "0.0.1" revision commit))
57 (home-page "https://framagit.org/mothacehe/guile-mastodon.git")
58 (source (origin
59 (method git-fetch)
60 (uri (git-reference
61 (url home-page)
62 (commit commit)))
63 (sha256
64 (base32
65 "04dgxliz9bmhn0f7h1n0dj0r5h0fzhg80nxl1rpbxh4zs1yw9qvj"))
66 (file-name (string-append name "-" version "-checkout")))))))
67
68 (define-public cuirass
69 (let ((commit "6f4a203a0bb2d441d091d561c1735fbe2d170cf7")
70 (revision "2"))
71 (package
72 (name "cuirass")
73 (version (git-version "1.0.0" revision commit))
74 (source
75 (origin
76 (method git-fetch)
77 (uri (git-reference
78 (url "https://git.savannah.gnu.org/git/guix/guix-cuirass.git")
79 (commit commit)))
80 (file-name (git-file-name name version))
81 (sha256
82 (base32
83 "120cnnjy4j2dinfmas1ddmqzzc7ikj9c76sl4li6g6dn8g7s8f69"))))
84 (build-system gnu-build-system)
85 (arguments
86 '(#:modules ((guix build utils)
87 (guix build gnu-build-system)
88 (ice-9 rdelim)
89 (ice-9 popen))
90 #:configure-flags '("--localstatedir=/var") ;for /var/log/cuirass
91 #:parallel-tests? #f
92 #:phases
93 (modify-phases %standard-phases
94 (add-before 'check 'set-PATH-for-tests
95 (lambda* (#:key inputs #:allow-other-keys)
96 (let ((pg (assoc-ref inputs "ephemeralpg"))
97 (path (getenv "PATH")))
98 (setenv "PATH" (string-append pg "/bin:" path))
99 #t)))
100 ;; Disable the remote tests that require a Guix daemon connection.
101 (add-before 'check 'disable-remote-tests
102 (lambda _
103 (substitute* "Makefile.am"
104 (("tests/remote.scm") ""))
105 #t))
106 (add-after 'install 'wrap-program
107 (lambda* (#:key inputs outputs #:allow-other-keys)
108 ;; Wrap the 'cuirass' command to refer to the right modules.
109 (let* ((out (assoc-ref outputs "out"))
110 (avahi (assoc-ref inputs "guile-avahi"))
111 (gcrypt (assoc-ref inputs "guile-gcrypt"))
112 (json (assoc-ref inputs "guile-json"))
113 (zmq (assoc-ref inputs "guile-simple-zmq"))
114 (squee (assoc-ref inputs "guile-squee"))
115 (git (assoc-ref inputs "guile-git"))
116 (bytes (assoc-ref inputs "guile-bytestructures"))
117 (fibers (assoc-ref inputs "guile-fibers"))
118 (zlib (assoc-ref inputs "guile-zlib"))
119 (matd (assoc-ref inputs "guile-mastodon"))
120 (tls (assoc-ref inputs "gnutls"))
121 (mail (assoc-ref inputs "mailutils"))
122 (guix (assoc-ref inputs "guix"))
123 (deps (list avahi gcrypt json zmq squee git bytes
124 fibers zlib matd tls mail guix))
125 (guile (assoc-ref %build-inputs "guile"))
126 (effective
127 (read-line
128 (open-pipe* OPEN_READ
129 (string-append guile "/bin/guile")
130 "-c" "(display (effective-version))")))
131 (mods
132 (string-drop-right ;drop trailing colon
133 (string-join deps
134 (string-append "/share/guile/site/"
135 effective ":")
136 'suffix)
137 1))
138 (objs
139 (string-drop-right
140 (string-join deps
141 (string-append "/lib/guile/" effective
142 "/site-ccache:")
143 'suffix)
144 1)))
145 ;; Make sure 'cuirass' can find the relevant Guile modules.
146 (wrap-program (string-append out "/bin/cuirass")
147 `("PATH" ":" prefix (,(string-append out "/bin")))
148 `("GUILE_LOAD_PATH" ":" prefix (,mods))
149 `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,objs)))
150 #t))))))
151 (inputs
152 `(("guile" ,guile-3.0/libgc-7)
153 ("guile-avahi" ,guile-avahi)
154 ("guile-fibers" ,guile-fibers)
155 ("guile-gcrypt" ,guile-gcrypt)
156 ("guile-json" ,guile-json-4)
157 ("guile-simple-zmq" ,guile-simple-zmq)
158 ("guile-squee" ,guile-squee)
159 ("guile-git" ,guile-git)
160 ("guile-zlib" ,guile-zlib)
161 ("guile-mastodon" ,guile-mastodon-dev)
162 ("gnutls" ,gnutls)
163 ("mailutils" ,mailutils)
164 ;; FIXME: this is propagated by "guile-git", but it needs to be among
165 ;; the inputs to add it to GUILE_LOAD_PATH.
166 ("guile-bytestructures" ,guile-bytestructures)
167 ("guix" ,guix)))
168 (native-inputs
169 `(("autoconf" ,autoconf)
170 ("automake" ,automake)
171 ("pkg-config" ,pkg-config)
172 ("texinfo" ,texinfo)
173 ("ephemeralpg" ,ephemeralpg)))
174 (native-search-paths
175 ;; For HTTPS access, Cuirass itself honors these variables, with the
176 ;; same semantics as Git and OpenSSL (respectively).
177 (list (search-path-specification
178 (variable "GIT_SSL_CAINFO")
179 (file-type 'regular)
180 (separator #f) ;single entry
181 (files '("etc/ssl/certs/ca-certificates.crt")))
182 (search-path-specification
183 (variable "SSL_CERT_DIR")
184 (files '("etc/ssl/certs")))))
185 (synopsis "Continuous integration system")
186 (description
187 "Cuirass is a continuous integration tool using GNU Guix. It is
188 intended as a replacement for Hydra.")
189 (home-page "https://www.gnu.org/software/guix/")
190 (license l:gpl3+))))