projects/guix·blob javascript-team · refs

414 lines · 17.2 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Eric Bavier <[email protected]>
3;;; Copyright © 2016 Jan Nieuwenhuizen <[email protected]>
4;;; Copyright © 2016, 2017 Mathieu Lirzin <[email protected]>
5;;; Copyright © 2017, 2020, 2021 Mathieu Othacehe <[email protected]>
6;;; Copyright © 2017, 2019, 2020 Ricardo Wurmus <[email protected]>
7;;; Copyright © 2018 Clément Lassieur <[email protected]>
8;;; Copyright © 2022, 2024 Arun Isaac <[email protected]>
9;;; Copyright © 2023 David Pflug <[email protected]>
10;;; Copyright © 2025 David Thompson <[email protected]>
11;;; Copyright © 2025-2026 Ludovic Courtès <[email protected]>
12;;; Copyright © 2026 Sharlatan Hellseher <[email protected]>
13;;;
14;;; This file is part of GNU Guix.
15;;;
16;;; GNU Guix is free software; you can redistribute it and/or modify it
17;;; under the terms of the GNU General Public License as published by
18;;; the Free Software Foundation; either version 3 of the License, or (at
19;;; your option) any later version.
20;;;
21;;; GNU Guix is distributed in the hope that it will be useful, but
22;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24;;; GNU General Public License for more details.
25;;;
26;;; You should have received a copy of the GNU General Public License
27;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29(define-module (gnu packages ci)
30 #:use-module ((guix search-paths) #:select ($SSL_CERT_DIR))
31 #:use-module ((guix licenses) #:prefix l:)
32 #:use-module (guix build-system cmake)
33 #:use-module (guix build-system gnu)
34 #:use-module (guix build-system go)
35 #:use-module (guix download)
36 #:use-module (guix gexp)
37 #:use-module (guix git-download)
38 #:use-module (guix packages)
39 #:use-module (guix utils)
40 #:use-module (gnu packages)
41 #:use-module (gnu packages autotools)
42 #:use-module (gnu packages base)
43 #:use-module (gnu packages bash)
44 #:use-module (gnu packages boost)
45 #:use-module (gnu packages check)
46 #:use-module (gnu packages compression)
47 #:use-module (gnu packages databases)
48 #:use-module (gnu packages docbook)
49 #:use-module (gnu packages gnupg)
50 #:use-module (gnu packages golang)
51 #:use-module (gnu packages golang-build)
52 #:use-module (gnu packages golang-check)
53 #:use-module (gnu packages golang-compression)
54 #:use-module (gnu packages golang-vcs)
55 #:use-module (gnu packages golang-web)
56 #:use-module (gnu packages golang-xyz)
57 #:use-module (gnu packages guile)
58 #:use-module (gnu packages guile-xyz)
59 #:use-module (gnu packages mail)
60 #:use-module (gnu packages package-management)
61 #:use-module (gnu packages perl)
62 #:use-module (gnu packages perl-compression)
63 #:use-module (gnu packages pkg-config)
64 #:use-module (gnu packages serialization)
65 #:use-module (gnu packages sqlite)
66 #:use-module (gnu packages texinfo)
67 #:use-module (gnu packages tls)
68 #:use-module (gnu packages uglifyjs)
69 #:use-module (gnu packages version-control)
70 #:use-module (gnu packages web)
71 #:use-module (gnu packages xml))
72
73(define-public cuirass
74 (package
75 (name "cuirass")
76 (version "1.3.6")
77 (source
78 (origin
79 (method git-fetch)
80 (uri (git-reference
81 (url "https://git.guix.gnu.org/cuirass.git")
82 (commit (string-append "v" version))))
83 (file-name (git-file-name name version))
84 (sha256
85 (base32
86 "0b1rjb5vjv72a25w7awz2gaf7bvqjn8l699anigrrc62sjj4mk80"))))
87 (build-system gnu-build-system)
88 (arguments
89 (list #:modules `((guix build utils)
90 (guix build gnu-build-system)
91 (ice-9 match)
92 (ice-9 rdelim)
93 (ice-9 popen)
94 (srfi srfi-1))
95 #:configure-flags #~'("--localstatedir=/var" ;for /var/log/cuirass
96 "--sysconfdir=/etc") ;for /etc/cuirass/forge-tokens
97
98 ;; XXX: HTTP tests fail on aarch64 due to Fibers errors, disable them
99 ;; on that architecture for now.
100 #:tests? (let ((s (or (%current-target-system)
101 (%current-system))))
102 (not (string-prefix? "aarch64" s)))
103 #:parallel-tests? #f
104 #:phases
105 #~(modify-phases %standard-phases
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 ;; Do so by collecting the subset of INPUTS that provides Guile
110 ;; modules. This includes direct inputs as well as their
111 ;; propagated inputs--e.g., 'guix' propagates 'guile-zstd'.
112 (define (sub-directory suffix)
113 (match-lambda
114 ((label . directory)
115 (let ((directory (string-append directory suffix)))
116 (and (directory-exists? directory)
117 directory)))))
118
119 (let* ((out (assoc-ref outputs "out"))
120 (effective
121 (read-line
122 (open-pipe* OPEN_READ (which "guile") "-c"
123 "(display (effective-version))")))
124 (mods (filter-map (sub-directory
125 (string-append
126 "/share/guile/site/"
127 effective))
128 inputs))
129 (objs (filter-map (sub-directory
130 (string-append
131 "/lib/guile/" effective
132 "/site-ccache"))
133 inputs)))
134 (wrap-program (string-append out "/bin/cuirass")
135 `("PATH" ":" prefix
136 (,(string-append out "/bin")))
137 `("GUILE_LOAD_PATH" ":" prefix
138 ,mods)
139 `("GUILE_LOAD_COMPILED_PATH" ":" prefix
140 ,objs))))))))
141 (inputs
142 (list bash-minimal
143 guile-3.0-latest
144 guile-avahi
145 guile-fibers
146 guile-gcrypt
147 guile-json-4
148 guile-simple-zmq
149 guile-squee
150 guile-git
151 guile-zlib
152 guile-mastodon
153 guile-gnutls
154 mailutils
155 ;; FIXME: this is propagated by "guile-git", but it needs to be among
156 ;; the inputs to add it to GUILE_LOAD_PATH.
157 guile-bytestructures
158
159 guix))
160 (native-inputs
161 (list autoconf-2.71
162 automake
163 pkg-config
164 texinfo
165 ephemeralpg
166 esbuild))
167 (native-search-paths
168 ;; For HTTPS access, Cuirass itself honors these variables, with the
169 ;; same semantics as Git and OpenSSL (respectively).
170 (list (search-path-specification
171 (variable "GIT_SSL_CAINFO")
172 (file-type 'regular)
173 (separator #f) ;single entry
174 (files '("etc/ssl/certs/ca-certificates.crt")))
175 $SSL_CERT_DIR))
176 (synopsis "Continuous integration system")
177 (description
178 "Cuirass is a continuous integration tool using GNU Guix. It is
179intended as a replacement for Hydra.")
180 (home-page "https://guix.gnu.org/cuirass/")
181 (license l:gpl3+)))
182
183(define-public laminar
184 (package
185 (name "laminar")
186 (version "1.3")
187 (source
188 (origin (method git-fetch)
189 (uri (git-reference
190 (url "https://github.com/ohwgiles/laminar")
191 (commit version)))
192 (file-name (git-file-name name version))
193 (sha256
194 (base32
195 "0ya5nzl1qf11if564xd49l8ajxyish7pbn875js4f153z775d3ks"))))
196 (build-system cmake-build-system)
197 (arguments
198 `(#:tests? #f ; TODO Can't build tests
199 #:configure-flags
200 (list "-DCMAKE_CXX_STANDARD=17"
201 ;; "-DBUILD_TESTS=true" TODO: objcopy: js/stPskyUS: can't add
202 ;; section '.note.GNU-stack': file format not recognized
203 (string-append "-DLAMINAR_VERSION=" ,version))
204 #:phases
205 (modify-phases %standard-phases
206 (add-after 'unpack 'patch-CMakeLists.txt
207 (lambda _
208 (substitute* "CMakeLists.txt"
209 (("file\\(DOWNLOAD.*\n$")
210 "# file download removed by Guix --")
211 (("install\\(FILES etc/laminar.service DESTINATION \\$\\{SYSTEMD\\_UNITDIR\\}\\)")
212 "")
213 (("install\\(FILES \\$\\{CMAKE\\_CURRENT\\_BINARY\\_DIR\\}\\/laminar\\.service DESTINATION \\$\\{SYSTEMD\\_UNITDIR\\}\\)")
214 "")
215 (("install\\(FILES etc/laminar\\.conf DESTINATION \\/etc\\)") "")
216 (("\\/usr\\/") ""))))
217 (add-after 'configure 'copy-in-javascript-and-css
218 (lambda* (#:key inputs outputs #:allow-other-keys)
219 (use-modules (ice-9 popen))
220
221 (mkdir-p "../build/js")
222 (invoke "tar" "-xf" (assoc-ref inputs "chart.js.tgz")
223 "--strip-components" "2"
224 "package/dist/chart.js")
225 (for-each (lambda (file minified-file)
226 (let* ((port
227 (open-pipe* OPEN_READ "uglifyjs" file))
228 (destination
229 (string-append
230 "../build/js/" minified-file)))
231
232 (call-with-output-file destination
233 (lambda (output-port)
234 (dump-port port output-port)))
235
236 (let ((exit (close-pipe port)))
237 (unless (zero? exit)
238 (error "uglifyjs failed" exit)))))
239
240 (list (assoc-ref inputs "vue.js")
241 (assoc-ref inputs "vue-router.js")
242 "chart.js")
243 (list "vue.min.js"
244 "vue-router.min.js"
245 "Chart.min.js"))
246
247 ;; ansi_up.js isn't minified
248 (copy-file (assoc-ref inputs "ansi_up.js")
249 "../build/js/ansi_up.js"))))))
250 (inputs
251 (list capnproto rapidjson sqlite boost zlib))
252 (native-inputs
253 `(("googletest" ,googletest)
254 ("uglifyjs" ,node-uglify-js)
255
256 ("vue.js"
257 ,(origin (method url-fetch)
258 (uri (string-append "https://raw.githubusercontent.com/"
259 "vuejs/vue/v2.6.12/dist/vue.js"))
260 (sha256
261 (base32
262 "1mq2dn6yqbmzar77xf4x2bvvanf9xc9nwfq06sksl5zmr300m7qm"))))
263 ("vue-router.js"
264 ,(origin (method url-fetch)
265 (uri (string-append "https://raw.githubusercontent.com/"
266 "vuejs/vue-router/v3.4.8/dist/vue-router.js"))
267 (sha256
268 (base32
269 "1hkrbgzhpnrsb4zdafslqagy1vkac6bkdj7kh49js2lhkp9z4nj5"))))
270 ("ansi_up.js"
271 ,(origin (method url-fetch)
272 (uri (string-append "https://raw.githubusercontent.com/"
273 "drudru/ansi_up/v4.0.4/ansi_up.js"))
274 (sha256
275 (base32
276 "1dx8wn38ds8d01kkih26fx1yrisg3kpz61qynjr4zil03ap0hrlr"))))
277 ("chart.js.tgz"
278 ,(origin (method url-fetch)
279 (uri (string-append "https://github.com/chartjs/Chart.js/"
280 "releases/download/v3.9.1/chart.js-3.9.1.tgz"))
281 (sha256
282 (base32
283 "1ikjgspaknqlhpjad17563yph4pvrh8dkzjdx58pl23gg58hf7hi"))))))
284 (synopsis "Lightweight continuous integration service")
285 (description
286 "Laminar is a lightweight and modular continuous integration service. It
287doesn't have a configuration web UI instead uses version-controllable
288configuration files and scripts.
289
290Laminar encourages the use of existing tools such as bash and cron instead of
291reinventing them.")
292 (home-page "https://laminar.ohwg.net/")
293 (license l:gpl3+)))
294
295(define-public go-code-forgejo-org-forgejo-runner-v12
296 (package
297 (name "go-code-forgejo-org-forgejo-runner-v12")
298 (version "12.13.0")
299 (source
300 (origin
301 (method git-fetch)
302 (uri (git-reference
303 (url "https://code.forgejo.org/forgejo/runner.git")
304 (commit (string-append "v" version))))
305 (file-name (git-file-name name version))
306 (sha256
307 (base32 "1v609i9ymqzqf04m6yx51bd1aap52kmnasf3dlnhsdqnz3idkcf2"))))
308 (build-system go-build-system)
309 (arguments
310 (list
311 ;; forgejo-runner binary is in forgejo-runner package, this is a Go
312 ;; source library to use in inputs for other packages.
313 #:skip-build? #f
314 #:import-path "code.forgejo.org/forgejo/runner/v12"
315 #:build-flags
316 #~(list (string-append "-ldflags=-X code.forgejo.org/"
317 "forgejo/runner/v12/internal/pkg/ver.version="
318 #$version))
319 #:embed-files #~(list ".*\\.json" ".*\\.js" ".*\\.sh")
320 #:test-flags
321 #~(list "-skip" (string-join
322 ;; Newtork access and running Docker are required.
323 (list "TestCancelLongRunningCommand"
324 "TestClone/annotated-tag"
325 "TestClone/branch"
326 "TestClone/sha"
327 "TestClone/short-sha"
328 "TestClone/tag"
329 "TestCloneIfRequired/clone"
330 "TestCloneIfRequired/clone_different_remote"
331 "TestHandler"
332 "TestHandlerAPIFatalErrors/commit"
333 "TestHandlerAPIFatalErrors/find"
334 "TestHandlerAPIFatalErrors/get"
335 "TestHandlerAPIFatalErrors/upload"
336 "TestHandler_gcCache"
337 "TestPollerPoll"
338 "TestPollerPoll/fetchTasks_rate_limited"
339 "TestRunJob_WithConnectionFromCommandOptions"
340 "TestRunner_ReusableWorkflowGitHubInstance"
341 "TestStepDockerMain")
342 "|")
343 "-args" "-features" "-"
344 )))
345 (native-inputs
346 (list git-minimal/pinned
347 go-github-com-google-go-cmp
348 go-github-com-spf13-cobra
349 go-github-com-spf13-pflag
350 go-github-com-stretchr-testify))
351 (propagated-inputs
352 (list go-code-forgejo-org-forgejo-actions-proto
353 go-connectrpc-com-connect
354 go-dario-cat-mergo
355 go-github-com-avast-retry-go-v4
356 go-github-com-containerd-errdefs
357 go-github-com-creack-pty
358 go-github-com-distribution-reference
359 go-github-com-djherbis-buffer
360 go-github-com-djherbis-nio-v3
361 go-github-com-docker-cli
362 go-github-com-docker-docker
363 go-github-com-docker-go-connections
364 go-github-com-gdgvda-cron
365 go-github-com-gobwas-glob
366 go-github-com-google-uuid
367 go-github-com-joho-godotenv
368 go-github-com-julienschmidt-httprouter
369 go-github-com-kballard-go-shellquote
370 go-github-com-masterminds-semver
371 go-github-com-mattn-go-isatty
372 go-github-com-moby-go-archive
373 go-github-com-moby-patternmatcher
374 go-github-com-opencontainers-image-spec
375 go-github-com-opencontainers-selinux
376 go-github-com-powerman-fileuri
377 go-github-com-rhysd-actionlint
378 go-github-com-sirupsen-logrus
379 go-github-com-timshannon-bolthold
380 go-go-etcd-io-bbolt
381 go-go-yaml-in-yaml-v3
382 go-golang-org-x-sys
383 go-golang-org-x-term
384 go-golang-org-x-time
385 go-google-golang-org-protobuf
386 go-gotest-tools-v3))
387 (home-page "https://code.forgejo.org/forgejo/runner")
388 (synopsis "Run continuous integration jobs for Forgejo")
389 (description
390 "This package provides a daemon that connects to a Forgejo instance and
391runs jobs for continuous integration. Forgejo Runner can also run workflows
392locally and act as a cache.")
393 (license l:gpl3)))
394
395(define-public forgejo-runner
396 (package/inherit go-code-forgejo-org-forgejo-runner-v12
397 (name "forgejo-runner")
398 (arguments
399 (substitute-keyword-arguments arguments
400 ((#:install-source? _ #t) #f)
401 ((#:skip-build? _ #t) #f)
402 ((#:tests? _ #t) #f)
403 ((#:phases phases '%standard-phases)
404 #~(modify-phases #$phases
405 (add-after 'install 'rename-binary
406 (lambda _
407 (with-directory-excursion (string-append #$output "/bin")
408 (rename-file "v12" "forgejo-runner"))))))))
409 (native-inputs
410 (append
411 (package-native-inputs go-code-forgejo-org-forgejo-runner-v12)
412 (package-propagated-inputs go-code-forgejo-org-forgejo-runner-v12)))
413 (propagated-inputs '())
414 (inputs '())))