set up build and deployment
This commit is contained in:
67
build_linux/build.lisp
Normal file
67
build_linux/build.lisp
Normal file
@@ -0,0 +1,67 @@
|
||||
#+linux
|
||||
(declaim
|
||||
(sb-ext:muffle-conditions cl:warning)
|
||||
(sb-ext:muffle-conditions cl:style-warning)
|
||||
(sb-ext:muffle-conditions sb-ext:compiler-note))
|
||||
|
||||
#+linux
|
||||
(load #P"/build/build_linux/asdf.lisp")
|
||||
|
||||
#+linux
|
||||
(progn
|
||||
(labels ((all-subdirectories (path)
|
||||
(let ((subdirs (uiop:subdirectories path)))
|
||||
(append subdirs
|
||||
(mapcan #'all-subdirectories subdirs)))))
|
||||
(setf asdf:*central-registry*
|
||||
(list* #p"/build/"
|
||||
(all-subdirectories "ocicl"))))
|
||||
|
||||
(asdf:load-system :lispostory))
|
||||
|
||||
#+linux
|
||||
(lispostory:create-exe-and-die)
|
||||
|
||||
#+darwin
|
||||
(defun split-and-strip (str)
|
||||
(mapcar (lambda (s) (string-trim '(#\Newline) s))
|
||||
(remove-if (lambda (s) (string-equal "" s)) (uiop:split-string str :separator " "))))
|
||||
|
||||
#+darwin
|
||||
(defun run-shell-program (shell-cmd)
|
||||
(let ((cmd (split-and-strip shell-cmd)))
|
||||
(multiple-value-bind (output error-output exit-code)
|
||||
(uiop:run-program cmd
|
||||
:output :string
|
||||
:error-output :string
|
||||
:ignore-error-status t)
|
||||
(format t "Output: ~a~%" output)
|
||||
(when (not (string-equal error-output ""))
|
||||
(format t "Error: ~a~%" error-output))
|
||||
(format t "Exit code: ~a~%" exit-code))))
|
||||
|
||||
#+darwin
|
||||
(defun run-builder ()
|
||||
(let* ((shell-cmd "container run --arch amd64
|
||||
--volume /Users/grant/programming/projects/lispostory:/build lispostory-builder
|
||||
sbcl --load /build/build_linux/build.lisp"))
|
||||
(run-shell-program shell-cmd)))
|
||||
|
||||
#+darwin
|
||||
(defun build-builder ()
|
||||
(run-shell-program "container build -a amd64 --tag lispostory-builder --file ./linux-builder.Dockerfile ."))
|
||||
|
||||
#+darwin
|
||||
(defun deploy ()
|
||||
(run-shell-program "rsync -t /Users/grant/programming/projects/lispostory/lispostory
|
||||
hgranthorner.dev:/root/lispostory/lispostory"))
|
||||
|
||||
#+darwin
|
||||
(defun test-deployment ()
|
||||
(run-shell-program "ssh hgranthorner.dev ./lispostory/lispostory --version"))
|
||||
|
||||
(comment
|
||||
(build-builder)
|
||||
(run-builder)
|
||||
(deploy)
|
||||
(test-deployment))
|
||||
Reference in New Issue
Block a user