Trying to add qlfile template support.
This commit is contained in:
parent
3e43e468a8
commit
ceeaec3941
3 changed files with 34 additions and 26 deletions
34
.github/actions/setup/action.yml
vendored
34
.github/actions/setup/action.yml
vendored
|
@ -1,19 +1,15 @@
|
|||
name: 'Install Roswell & Qlot'
|
||||
|
||||
inputs:
|
||||
qlfile-template:
|
||||
description: 'Jinja template for qlfile'
|
||||
required: false
|
||||
default: 'The Template'
|
||||
asdf-system:
|
||||
description: 'ASDF system to install and test'
|
||||
required: true
|
||||
run-tests:
|
||||
description: A command to run tests
|
||||
required: false
|
||||
# default: |
|
||||
# qlot exec ros --eval '(asdf:test-system :{{ lisp-system }})' --quit
|
||||
|
||||
qlfile-template:
|
||||
description: 'Mustache template for qlfile'
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
@ -57,28 +53,20 @@ runs:
|
|||
echo .qlot/bin >> $GITHUB_PATH
|
||||
echo ::endgroup::
|
||||
|
||||
# - name: Run a custom Roswell Script
|
||||
# shell: ros -Q -- {0} "$@"
|
||||
# run: |
|
||||
# (progn
|
||||
# (ros:ensure-asdf)
|
||||
# #+quicklisp
|
||||
# (ql:quickload '() :silent t))
|
||||
|
||||
# (defun main (args)
|
||||
# (declare (ignore args))
|
||||
# (format t "::group::Custom Roswell Script~%")
|
||||
# (format t "Lisp: ~A ~A~%ASDF: ~A~%"
|
||||
# (lisp-implementation-version)
|
||||
# (lisp-implementation-type)
|
||||
# (asdf:asdf-version))
|
||||
# (format t "::endgroup::~%"))
|
||||
- name: Create Qlot Environment
|
||||
shell: bash
|
||||
run: |
|
||||
echo ::group::Create Qlot Environment
|
||||
|
||||
if [[ -n "${QLFILE_TEMPLATE}" ]]; then
|
||||
echo "${QLFILE_TEMPLATE} | .github/actions/setup/templater.ros > qlfile
|
||||
rm -f qlfile.lock
|
||||
fi
|
||||
|
||||
qlot install
|
||||
echo ::endgroup::
|
||||
env:
|
||||
QLFILE_TEMPLATE: ${{ qlfile-template }}
|
||||
|
||||
# This step will install system and
|
||||
# all possible roswell scripts, if the system
|
||||
|
|
2
.github/actions/setup/run-tests.ros
vendored
2
.github/actions/setup/run-tests.ros
vendored
|
@ -69,7 +69,7 @@ exec ros -Q -- $0 "$@"
|
|||
"Please specify ASDF system as a first argument.~%")
|
||||
(uiop:quit 1))
|
||||
|
||||
(let* ((user-script (uiop/stream:slurp-stream-forms *standard-input*))
|
||||
(let* ((user-script (uiop:slurp-stream-forms *standard-input*))
|
||||
(result
|
||||
(cond
|
||||
(user-script
|
||||
|
|
24
.github/actions/setup/templater.ros
vendored
24
.github/actions/setup/templater.ros
vendored
|
@ -6,7 +6,7 @@ exec ros -Q -- $0 "$@"
|
|||
(progn
|
||||
(ros:ensure-asdf)
|
||||
#+quicklisp
|
||||
(ql:quickload '(cl-mustache)
|
||||
(ql:quickload '(djula)
|
||||
:silent t))
|
||||
|
||||
(defpackage :ros.script.templater
|
||||
|
@ -14,7 +14,27 @@ exec ros -Q -- $0 "$@"
|
|||
(in-package :ros.script.templater)
|
||||
|
||||
|
||||
(defun collect-arguments ()
|
||||
(let* ((env-output (with-output-to-string (s)
|
||||
(uiop:run-program "env" :output s)))
|
||||
(lines (uiop:with-input (env-output)
|
||||
(uiop:slurp-stream-lines env-output))))
|
||||
(loop for line in lines
|
||||
for (key value) = (cl-ppcre:split "=" line
|
||||
:limit 2)
|
||||
appending (list (alexandria:make-keyword key)
|
||||
value))))
|
||||
|
||||
|
||||
(defun main (&rest argv)
|
||||
(declare (ignorable argv)))
|
||||
(declare (ignore argv))
|
||||
(let* ((lines (uiop:slurp-stream-lines *standard-input*))
|
||||
(template-text (apply #'concatenate 'string lines))
|
||||
(template (djula::compile-string template-text))
|
||||
(arguments (collect-arguments)))
|
||||
(apply #'djula:render-template*
|
||||
template
|
||||
*standard-output*
|
||||
arguments)))
|
||||
|
||||
;;; vim: set ft=lisp lisp:
|
||||
|
|
Loading…
Reference in a new issue