-
Notifications
You must be signed in to change notification settings - Fork 3
/
Lakefile
78 lines (60 loc) · 2.42 KB
/
Lakefile
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
#|-*- mode:lisp -*-|#
(in-package :cl-user)
(ql:quickload '(:cl-interpol :named-readtables))
(defpackage :lake.user
(:use :cl :lake)
(:shadowing-import-from :lake
:directory))
(in-package :lake.user)
(named-readtables:in-readtable :interpol-syntax)
;;(use-syntax :interpol)
(defun search-version-in-changelog (lines)
(let* ((line (nth 4 lines))
(space-pos (position #\Space line)))
(when space-pos
(subseq line 0 space-pos))))
(defun get-current-version ()
(uiop:read-file-line "ChangeLog.rst" :at #'search-version-in-changelog))
(defvar *implementations*
(list "ccl-bin"
"sbcl-bin"
"sbcl"))
(defvar *no-cache* nil)
(defun build-implementation (version implementation &key no-cache)
(let ((no-cache-opt (if no-cache
"--no-cache"
"")))
(sh #?"DOCKER_BUILDKIT=1 docker build \
${no-cache-opt} \
--add-host 'beta.quicklisp.org:13.33.243.6' \
--target lisp-image-with-${implementation} \
-t 40ants/base-lisp-image:${version}-${implementation} \
-t 40ants/base-lisp-image:latest-${implementation} \
-f Dockerfile .")))
(defun push-implementation (version implementation)
(sh #?"docker push 40ants/base-lisp-image:${version}-${implementation}")
(sh #?"docker push 40ants/base-lisp-image:latest-${implementation}"))
(task ("build" implementation version no_cache) ()
(let ((version (or version
(get-current-version)))
(implementations (if implementation
(list implementation)
*implementations*)))
(echo #?"Building version ${version}")
(mapc (alexandria:rcurry
(alexandria:curry #'build-implementation
version)
:no-cache no_cache)
implementations)))
(task ("push" implementation version) ("build")
(let ((version (or version
(get-current-version)))
(implementations (if implementation
(list implementation)
*implementations*)))
(echo #?"Building version ${version}")
(mapc (alexandria:curry #'push-implementation version)
implementations)))
(task "default" ()
(format t "Version: ~A~%"
(get-current-version)))