62 lines
1.9 KiB
Common Lisp
62 lines
1.9 KiB
Common Lisp
#+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
|
|
;; NOTE(grant): uiop:getcwd is provided by asdf
|
|
(asdf:initialize-source-registry `(:source-registry (:tree ,(uiop:getcwd)) :inherit-configuration))
|
|
(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))
|