aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/ci.scm
blob: e0bf59b616322ee479abe6388aa1546104a2747f (about) (plain) '>137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
?id=ecb27103531ece0ee302957ff04cab8a17ec1ab3'>gnu: lttng-tools: Fix build failure....* gnu/packages/instrumentation.scm (lttng-tools)
[native-inputs]: Add autoconf, automake, libtool.
[arguments]: Add 'autoreconf build phase before 'configure.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Olivier Dion
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2016, 2017 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2017, 2020, 2021 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2017, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages ci)
  #:use-module ((guix licenses) #:prefix l:)
  #:use-module (gnu packages)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix download)
  #:use-module (guix gexp)
  #:use-module ((guix search-paths) #:select ($SSL_CERT_DIR))
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages base)
  #:use-module (gnu packages boost)
  #:use-module (gnu packages check)
  #:use-module (gnu packages docbook)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages guile)
  #:use-module (gnu packages guile-xyz)
  #:use-module (gnu packages gnupg)
  #:use-module (gnu packages mail)
  #:use-module (gnu packages package-management)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages perl-compression)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages serialization)
  #:use-module (gnu packages sqlite)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages texinfo)
  #:use-module (gnu packages uglifyjs)
  #:use-module (gnu packages version-control)
  #:use-module (gnu packages web)
  #:use-module (gnu packages xml)
  #:use-module (guix build-system cmake)
  #:use-module (guix build-system gnu)
  #:use-module ((guix search-paths) #:select ($SSL_CERT_DIR)))

(define-public cuirass
  (let ((commit "db6b63371159a735de74eee97c313740c998439a")
        (revision "20"))
    (package
      (name "cuirass")
      (version (git-version "1.1.0" revision commit))
      (source
       (origin
         (method git-fetch)
         (uri (git-reference
               (url "https://git.savannah.gnu.org/git/guix/guix-cuirass.git")
               (commit commit)))
         (file-name (git-file-name name version))
         (sha256
          (base32
           "16d9ylzk8mwsgppfdxyl0k2mkwll7fq17d6v09406rqkgddxg3m2"))))
      (build-system gnu-build-system)
      (arguments
       (list #:modules `((guix build utils)
                         (guix build gnu-build-system)
                         (ice-9 match)
                         (ice-9 rdelim)
                         (ice-9 popen)
                         (srfi srfi-1))
             #:configure-flags #~'("--localstatedir=/var") ;for /var/log/cuirass
             ;; XXX: HTTP tests fail on aarch64 due to Fibers errors, disable them
             ;; on that architecture for now.
             #:tests? (let ((s (or (%current-target-system)
                                   (%current-system))))
                        (not (string-prefix? "aarch64" s)))
             #:parallel-tests? #f
             #:phases
             #~(modify-phases %standard-phases
                 (add-before 'bootstrap 'fix-version-gen
                   (lambda _
                     (patch-shebang "build-aux/git-version-gen")

                     (call-with-output-file ".tarball-version"
                       (lambda (port)
                         (display #$(package-version this-package) port)))))
                 (add-after 'install 'wrap-program
                   (lambda* (#:key inputs outputs #:allow-other-keys)
                     ;; Wrap the 'cuirass' command to refer to the right modules.
                     ;; Do so by collecting the subset of INPUTS that provides Guile
                     ;; modules.  This includes direct inputs as well as their
                     ;; propagated inputs--e.g., 'guix' propagates 'guile-zstd'.
                     (define (sub-directory suffix)
                       (match-lambda
                         ((label . directory)
                          (let ((directory (string-append directory suffix)))
                            (and (directory-exists? directory)
                                 directory)))))

                     (let* ((out (assoc-ref outputs "out"))
                            (effective
                             (read-line
                              (open-pipe* OPEN_READ (which "guile") "-c"
                                          "(display (effective-version))")))
                            (mods (filter-map (sub-directory
                                               (string-append
                                                "/share/guile/site/"
                                                effective))
                                              inputs))
                            (objs (filter-map (sub-directory
                                               (string-append
                                                "/lib/guile/" effective
                                                "/site-ccache"))
                                              inputs)))
                       (wrap-program (string-append out "/bin/cuirass")
                         `("PATH" ":" prefix
                           (,(string-append out "/bin")))
                         `("GUILE_LOAD_PATH" ":" prefix
                           ,mods)
                         `("GUILE_LOAD_COMPILED_PATH" ":" prefix
                           ,objs))))))))
      (inputs
       (list guile-3.0-latest
             guile-avahi
             guile-fibers
             guile-gcrypt
             guile-json-4
             guile-simple-zmq
             guile-squee
             guile-git
             guile-zlib
             guile-mastodon
             guile-gnutls
             mailutils
             ;; FIXME: this is propagated by "guile-git", but it needs to be among
             ;; the inputs to add it to GUILE_LOAD_PATH.
             guile-bytestructures

             guix))
      (native-inputs
       (list autoconf-2.71 automake pkg-config texinfo ephemeralpg))
      (native-search-paths
       ;; For HTTPS access, Cuirass itself honors these variables, with the
       ;; same semantics as Git and OpenSSL (respectively).
       (list (search-path-specification
              (variable "GIT_SSL_CAINFO")
              (file-type 'regular)
              (separator #f)                      ;single entry
              (files '("etc/ssl/certs/ca-certificates.crt")))
             $SSL_CERT_DIR))
      (synopsis "Continuous integration system")
      (description
       "Cuirass is a continuous integration tool using GNU Guix.  It is
intended as a replacement for Hydra.")
      (home-page "https://guix.gnu.org/cuirass/")
      (license l:gpl3+))))

(define-public laminar
  (package
    (name "laminar")
    (version "1.2")
    (source
     (origin (method git-fetch)
             (uri (git-reference
                   (url "https://github.com/ohwgiles/laminar")
                   (commit version)))
             (file-name (git-file-name name version))
             (sha256
              (base32
               "1sg0kccp3nczkn2vxcsqv10vyvmjnhpaykc1nfhh55jyda4xzf9w"))))
    (build-system cmake-build-system)
    (arguments
     `(#:tests? #f                      ; TODO Can't build tests
       #:configure-flags
       (list "-DCMAKE_CXX_STANDARD=17"
             ;; "-DBUILD_TESTS=true" TODO: objcopy: js/stPskyUS: can't add
             ;; section '.note.GNU-stack': file format not recognized
             (string-append "-DLAMINAR_VERSION=" ,version))
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'patch-CMakeLists.txt
           (lambda _
             (substitute* "CMakeLists.txt"
               (("file\\(DOWNLOAD.*\n$")
                "# file download removed by Guix --")
               (("install\\(FILES etc/laminar.service DESTINATION \\$\\{SYSTEMD\\_UNITDIR\\}\\)")
                "")
               (("install\\(FILES \\$\\{CMAKE\\_CURRENT\\_BINARY\\_DIR\\}\\/laminar\\.service DESTINATION \\$\\{SYSTEMD\\_UNITDIR\\}\\)")
                "")
               (("install\\(FILES etc/laminar\\.conf DESTINATION \\/etc\\)") "")
               (("\\/usr\\/") ""))))
         (add-after 'configure 'copy-in-javascript-and-css
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (use-modules (ice-9 popen))

             (mkdir-p "../build/js")
             (for-each (lambda (name)
                         (let* ((file
                                 (assoc-ref inputs (string-append name ".js")))
                                (port
                                 (open-pipe* OPEN_READ "uglifyjs" file))
                                (destination
                                 (string-append
                                  "../build/js/" name ".min.js")))

                           (call-with-output-file destination
                             (lambda (output-port)
                               (dump-port port output-port)))

                           (let ((exit (close-pipe port)))
                             (unless (zero? exit)
                               (error "uglifyjs failed" exit)))))

                       '("vue"
                         "vue-router"
                         "Chart"))

             ;; ansi_up.js isn't minified
             (copy-file (assoc-ref inputs "ansi_up.js")
                        "../build/js/ansi_up.js"))))))
    (inputs
     (list capnproto rapidjson sqlite boost zlib))
    (native-inputs
     `(("googletest" ,googletest)
       ("uglifyjs" ,node-uglify-js)

       ("vue.js"
        ,(origin (method url-fetch)
                 (uri (string-append "https://raw.githubusercontent.com/"
                                     "vuejs/vue/v2.6.12/dist/vue.js"))
                 (sha256
                  (base32
                   "1mq2dn6yqbmzar77xf4x2bvvanf9xc9nwfq06sksl5zmr300m7qm"))))
       ("vue-router.js"
        ,(origin (method url-fetch)
                 (uri (string-append "https://raw.githubusercontent.com/"
                                     "vuejs/vue-router/v3.4.8/dist/vue-router.js"))
                 (sha256
                  (base32
                   "1hkrbgzhpnrsb4zdafslqagy1vkac6bkdj7kh49js2lhkp9z4nj5"))))
       ("ansi_up.js"
        ,(origin (method url-fetch)
                 (uri (string-append "https://raw.githubusercontent.com/"
                                     "drudru/ansi_up/v4.0.4/ansi_up.js"))
                 (sha256
                  (base32
                   "1dx8wn38ds8d01kkih26fx1yrisg3kpz61qynjr4zil03ap0hrlr"))))
       ("Chart.js"
        ,(origin (method url-fetch)
                 (uri (string-append "https://github.com/chartjs/Chart.js/"
                                     "releases/download/v2.7.2/Chart.js"))
                 (sha256
                  (base32
                   "05m3gk6hqjx92j20drnk7q075qpjraywqaf25lnglmsgsgpiqsr7"))))))
    (synopsis "Lightweight continuous integration service")
    (description
     "Laminar is a lightweight and modular continuous integration service.  It
doesn't have a configuration web UI instead uses version-controllable
configuration files and scripts.

Laminar encourages the use of existing tools such as bash and cron instead of
reinventing them.")
    (home-page "https://laminar.ohwg.net/")
    (license l:gpl3+)))