Skip to content

Commit

Permalink
Support installation of additional systems
Browse files Browse the repository at this point in the history
  • Loading branch information
foretspaisibles committed Sep 15, 2023
1 parent 1dbd1e2 commit d9142c1
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 29 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
id: 'quicklisp'
with:
implementation: '${{ matrix.implementation }}'
additional-systems: >-
alexandria
org.melusina.confidence
- name: 'Validate installed implementation'
run: |
test -d '${{ steps.quicklisp.outputs.quicklisp-home }}'
Expand Down Expand Up @@ -50,6 +53,9 @@ jobs:
id: 'quicklisp'
with:
implementation: '${{ matrix.implementation }}'
additional-systems: >-
alexandria
org.melusina.confidence
- name: 'Validate installed implementation'
continue-on-error: true
run: |
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Lisp implementation can use QuickLisp.
and maybe other implementations. Please open an issue to express
interest for other implementations.

* `additional-systems` — When set, the list of additional systems to
load with QuickLisp.

## Outputs

Expand Down
9 changes: 8 additions & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ branding:
color: blue
inputs:
implementation:
type: string
default: 'sbcl'
description: |
The Common Lisp implementation to setup QuickLisp for.
This can be one of the following values:
Expand All @@ -17,7 +19,11 @@ inputs:
abcl clasp clisp ecl gcl sbcl
default: 'sbcl'
additional-systems:
type: string
required: false
description: |
The list of additional systems to download with QuickLisp.
outputs:
quicklisp-home:
value: '${{ steps.setup-quicklisp.outputs.quicklisp-home }}'
Expand Down Expand Up @@ -48,5 +54,6 @@ runs:
run: >-
PACKAGE=${{ github.repository }}
QUICKLISP_HOME=${HOME}/quicklisp
QUICKLISP_ADDITIONAL_SYSTEMS='${{ inputs.additional-systems }}'
${{ github.action_path }}/with_lisp_implementation ${{ inputs.implementation }}
${{ github.action_path }}/setup-quicklisp.lisp
47 changes: 23 additions & 24 deletions setup-quicklisp.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,29 @@
(require '#:asdf)
(require '#:uiop)

(load
(labels
((select-quicklisp (process)
(uiop:run-program '("sed" "-n" "-e" "/quicklisp[.]lisp$/{s/^ *//;p;}")
:input (uiop:process-info-output process)
:output :string))
(ubuntu-quicklisp ()
(select-quicklisp
(uiop:launch-program '("dpkg" "-L" "cl-quicklisp")
:output :stream)))
(macports-quicklisp ()
(select-quicklisp
(uiop:launch-program '("port" "contents" "cl-quicklisp")
:output :stream)))
(find-quicklisp ()
(cond
((uiop:os-macosx-p)
(macports-quicklisp))
((uiop:os-unix-p)
(ubuntu-quicklisp))))
(quicklisp-pathname ()
(pathname (string-trim '(#\Space #\Newline #\Return #\Tab)
(find-quicklisp)))))
(quicklisp-pathname)))
(labels
((select-quicklisp (process)
(uiop:run-program '("sed" "-n" "-e" "/quicklisp[.]lisp$/{s/^ *//;p;}")
:input (uiop:process-info-output process)
:output :string))
(ubuntu-quicklisp ()
(select-quicklisp
(uiop:launch-program '("dpkg" "-L" "cl-quicklisp")
:output :stream)))
(macports-quicklisp ()
(select-quicklisp
(uiop:launch-program '("port" "contents" "cl-quicklisp")
:output :stream)))
(find-quicklisp ()
(cond
((uiop:os-macosx-p)
(macports-quicklisp))
((uiop:os-unix-p)
(ubuntu-quicklisp))))
(quicklisp-pathname ()
(pathname (string-trim '(#\Space #\Newline #\Return #\Tab)
(find-quicklisp)))))
(load (quicklisp-pathname)))

(defpackage #:org.melusina.lisp-action/setup-quicklisp
(:use #:common-lisp))
Expand Down
36 changes: 32 additions & 4 deletions with_lisp_implementation
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,52 @@ lisp_load_file()
(
local argv script

renaissance_lisp()
{
set -- "$@" --break
while true; do
case "$1" in
*.lisp)
set -- "$@" --load "$1"
shift
;;
'('*')')
set -- "$@" --eval "$1"
shift
;;
--break)
set -- "$@" --eval '(quit)'
shift
break
;;
*)
1>&2 printf 'Failure: %s: Cannot process argument.\n' "$1"
exit 64
;;
esac
done
exec "${lisp_implementation}" "$@"
}

if [ $# -eq 0 ]; then
script=$(mktemp)
trap "rm -f ${script}" EXIT TERM INT
cat > "${script}"
set -- "${script}"
fi



case "${lisp_implementation}" in
abcl|ecl|sbcl)
exec "${lisp_implementation}" --load "$1" --eval '(quit)'
renaissance_lisp "$@"
;;
clisp)
ubuntu_asdf="/usr/share/common-lisp/source/cl-asdf/asdf.lisp"
if [ -f "${ubuntu_asdf}" ]; then
exec clisp "${ubuntu_asdf}" "$1"
else
exec clisp "$1"
set -- "${ubuntu_asdf}" "$@"
fi
exec clisp "$@"
;;
*)
set -x
Expand Down

0 comments on commit d9142c1

Please sign in to comment.