Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a test to check if need lisp really was installed and activated. #14

Merged
merged 1 commit into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 40 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,65 @@ name: tests

on:
push:
branches:
- master
pull_request:
schedule:
- cron: "0 0 * * SUN"

jobs:
tests:
# We want to run on external PRs, but not on our own internal PRs as
# they'll be run by the push to the branch.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false # Let the workflow continue as much as possible
matrix:
include:
- os: ubuntu-latest
lisp: sbcl-bin
lisp: sbcl
# Just to ensure test.ros will not fail when version
# is specified explicitly
- os: ubuntu-latest
lisp: sbcl/2.3.1
- os: macos-latest
lisp: sbcl-bin
- os: windows-latest
lisp: sbcl-bin
- os: ubuntu-latest
lisp: sbcl-bin
- os: ubuntu-latest
lisp: ccl-bin

# See issue: https://github.com/40ants/setup-lisp/issues/15
# - os: ubuntu-latest
# lisp: clisp
- os: ubuntu-latest
lisp: clisp-head
- os: ubuntu-latest
lisp: ecl
- os: ubuntu-latest
lisp: allegro
- os: ubuntu-latest
lisp: abcl-bin
# See issue: https://github.com/40ants/setup-lisp/issues/16
# - os: ubuntu-latest
# lisp: clasp
- os: ubuntu-latest
lisp: clasp-bin
- os: ubuntu-latest
lisp: cmu-bin
# See issue: https://github.com/40ants/setup-lisp/issues/17
# - os: ubuntu-latest
# lisp: mkcl
# See issue: https://github.com/40ants/setup-lisp/issues/18
# - os: ubuntu-latest
# lisp: npt
defaults:
run:
shell: lispsh {0}
env:
LISP: ${{ matrix.lisp }}
name: test with ${{ matrix.lisp }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -50,4 +83,6 @@ jobs:
asdf-version: 3.3.5.3
qlot-version: latest
- run: ros config
- run: qlot exec ros install 40ants/gh-pages
- run: qlot exec ros install 40ants/cl-info
- run: qlot exec cl-info

55 changes: 37 additions & 18 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ inputs:
roswell-version:
description: 'Roswell version to install. If not specified, the latest working version will be used; if "latest", the latest version is used'
required: false
default: v21.10.14.111
default: v23.10.14.114
asdf-system:
description: 'ASDF system to install'
required: false
Expand Down Expand Up @@ -52,7 +52,11 @@ runs:
# workaround I came up with is:
#
# 1. Symlink bash/msys2 to a known location, i.e. lispsh
# 2. Use lispsh as shell parameter
# 2. Use lispsh -eo pipefail {0} as shell parameter
#
# Pay attention to -eo pipefail options. We need them to exit on the
# first error. Without this option, Roswell might fail to install the
# implementation and continue to execute everything with default SBCL.
#
# It's not ideal, but the alternative is to duplicate most of the steps
# below, and have some of them with `shell: bash`, and others with
Expand All @@ -68,6 +72,7 @@ runs:
shell: bash
run: |
echo ::group::Set up Environment

if [[ "$RUNNER_OS" == "Windows" ]]; then
# ROSWELL_INSTALL_DIR defaults to /usr/local/bin which
# unfortunately is not part of PATH on Windows; one could be
Expand Down Expand Up @@ -155,9 +160,12 @@ runs:
env | sort -u
echo ::endgroup::
- name: Install Roswell
shell: lispsh {0}
shell: lispsh -eo pipefail {0}
run: |
echo ::group::Installing Roswell dependencies



if [[ "$RUNNER_OS" == "Linux" ]]; then
sudo apt-get update
sudo apt-get -y install git build-essential automake libcurl4-openssl-dev
Expand All @@ -182,14 +190,14 @@ runs:

echo ::endgroup::
- name: Upgrade Quicklisp dists
shell: lispsh {0}
shell: lispsh -eo pipefail {0}
run: |
# The parent workflow might have caching enabled for Roswell and all
# the other Lisp files in general, so it's better to tell Quicklisp
# to update all its dists.
ros -e "(ql:update-all-dists :prompt nil)"
- name: Install Quicklisp patch for package-inferred systems
shell: lispsh {0}
shell: lispsh -eo pipefail {0}
run: |
git clone \
--no-tags \
Expand All @@ -201,18 +209,23 @@ runs:
mkdir -p ~/.roswell

cat >> ~/.roswell/init.lisp <<EOF
(let ((fix-filename (make-pathname :directory '(:absolute :home ".quicklisp-client-fix")
:name "quicklisp-fix"
:type "lisp")))
(cond
((probe-file fix-filename)
(format t "Loading quicklisp fix.~%")
(load fix-filename))
(t
(format t "Quicklisp fix was not found at ~S.~%" fix-filename))))
(handler-bind ((error #'(lambda (c)
(uiop:print-condition-backtrace c)
(uiop:quit 1))))
(let ((fix-filename (merge-pathnames
(make-pathname :directory '(:relative ".quicklisp-client-fix")
:name "quicklisp-fix"
:type "lisp")
(user-homedir-pathname))))
(cond
((probe-file fix-filename)
(format t "Loading quicklisp fix.~%")
(load fix-filename))
(t
(format t "Quicklisp fix was not found at ~S.~%" fix-filename)))))
EOF
- name: Upgrade ASDF to the Latest Version
shell: lispsh {0}
shell: lispsh -eo pipefail {0}
run: |
if [[ "${{ inputs.asdf-version }}" != "latest" ]]; then
echo ::group::Installing ASDF ${{ inputs.asdf-version }}
Expand All @@ -223,7 +236,7 @@ runs:
fi
echo ::endgroup::
- name: Install Qlot
shell: lispsh {0}
shell: lispsh -eo pipefail {0}
run: |
if [[ "${{ inputs.qlot-version }}" != "latest" ]]; then
echo ::group::Installing Qlot ${{ inputs.qlot-version }}
Expand All @@ -235,7 +248,7 @@ runs:
echo .qlot/bin >> $GITHUB_PATH
echo ::endgroup::
- name: Create Qlot Environment
shell: lispsh {0}
shell: lispsh -eo pipefail {0}
run: |
echo ::group::Create Qlot Environment

Expand Down Expand Up @@ -264,12 +277,18 @@ runs:
# all possible roswell scripts, if the system
# has them in the roswell/ subdirectory:
- name: Install ASDF System
shell: lispsh {0}
shell: lispsh -eo pipefail {0}
run: |
echo ::group::Install ASDF System

if [[ -n "${{ inputs.asdf-system }}" ]]; then
qlot exec ros install ${{ inputs.asdf-system }}
else
echo "ASDF system wasn't provided."
fi
echo ::endgroup::

- name: Check it is possible to run desired lisp implementation
shell: lispsh -eo pipefail {0}
run: setup-lisp/test.ros

17 changes: 16 additions & 1 deletion changelog.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@
(in-package project-docs/changelog)


(defchangelog (:ignore-words ("ASDF"))
(defchangelog (:ignore-words ("ASDF"
"HOME"))
(3.1.0 2023-01-27
"
# Changed

* Switched from Roswell v21.10.14.111 to v23.10.14.114.
* Now action checks if it is really installed requested Lisp implementation.
* A list of supported implementation was added to the documentation.
* Some implementation supported by Roswell, have problems. If you need them, please, contribute the fix either to this action or to the Roswell itself.

# Fixed

* Now all steps fail-fast on the first encountered error. Previously some step might be failed, but action's execution was considered success.
* Fixed Quicklisp fix activation for lisp implementations which are not support :HOME as part of the pathname.
")
(3.0.0 2023-12-14
"Now action uses a fix for Quicklisp client which makes it possible to load package inferred ASDF systems by name of the subsystem.")
(2.1.0 2022-11-10
Expand Down
24 changes: 24 additions & 0 deletions docs.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ necessary to make available [Roswell](https://github.com/roswell/roswell)
and [Qlot](https://github.com/fukamachi/qlot) inside the Github CI.
"
(@features section)
(@implementation-support section)
(@typical-usage section)
(@roswell-version section)
(@asdf-version section)
Expand Down Expand Up @@ -73,6 +74,29 @@ and [Qlot](https://github.com/fukamachi/qlot) inside the Github CI.
")


(defsection @implementation-support (:title "Implementation support")
"
Most implementations are tested on Linux, but for some of them Windows and OSX are also should work:


| **Implementation** | **Supported** |
|--------------------|------------------------------------------------------|
| abcl-bin | ✅ |
| allegro | ✅ |
| ccl-bin | ✅ |
| clasp | [❌](https://github.com/40ants/setup-lisp/issues/16) |
| clasp-bin | ✅ |
| clisp | [❌](https://github.com/40ants/setup-lisp/issues/15) |
| clisp-head | ✅ |
| cmu-bin | ✅ |
| ecl | ✅ |
| mkcl | [❌](https://github.com/40ants/setup-lisp/issues/17) |
| npt | [❌](https://github.com/40ants/setup-lisp/issues/18) |
| sbcl | ✅ |
| sbcl-bin | ✅ |

")

(defsection @typical-usage (:title "A typical usage")
"
Here is how a minimal GitHub Workflow might look like:
Expand Down
4 changes: 2 additions & 2 deletions qlfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
("quicklisp" .
(:class qlot/source/dist:source-dist
:initargs (:distribution "http://beta.quicklisp.org/dist/quicklisp.txt" :%version :latest)
:version "2022-11-07"))
:version "2023-10-21"))
("ultralisp" .
(:class qlot/source/dist:source-dist
:initargs (:distribution "http://dist.ultralisp.org" :%version :latest)
:version "20221109175500"))
:version "20240127152000"))
("sly" .
(:class qlot/source/github:source-github
:initargs (:repos "svetlyak40wt/sly" :ref nil :branch "patches" :tag nil)
Expand Down
64 changes: 64 additions & 0 deletions test.ros
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
(progn ;;init forms
(ros:ensure-asdf)
#+quicklisp(ql:quickload '() :silent t)
)

(defpackage :ros.script.test
(:use :cl))
(in-package :ros.script.test)


(defparameter *lisps*
'(("sbcl-bin" . "SBCL")
("sbcl" . "SBCL")
("clisp" . "CLISP")
("clisp-head" . "CLISP")
("ccl-bin" . "Clozure Common Lisp")
("clasp" . "clasp")
("clasp-bin" . "clasp")
("cmu-bin" . "CMU Common Lisp")
("allegro" . "International Allegro CL Free Express Edition")
("abcl-bin" . "Armed Bear Common Lisp")
("npt" . "NPT")
("ecl" . "ECL")))


(defun cut-before (char text)
(let ((pos (position char text)))
(if pos
(subseq text 0 pos)
text)))


(defun main (&rest argv)
(declare (ignorable argv))
(handler-bind ((error (lambda (c)
(uiop:print-condition-backtrace c)
;; Not all implementation do quit with correct status code
;; in case if we just signal and error :(
;; Example of such implementations: CCL-BIN
(uiop:quit 1))))
(let ((needed-lisp (uiop:getenv "LISP")))
(unless needed-lisp
(error "Env variable LISP was not set."))

(let ((expected (or (cdr (assoc needed-lisp *lisps* :test #'string-equal))
(cdr (assoc (cut-before #\/ needed-lisp) *lisps* :test #'string-equal))))
(real-implementation (lisp-implementation-type)))
(unless expected
(error "This test does not support LISP=~A. The real-implementation=~A."
needed-lisp
real-implementation))

(unless (string-equal real-implementation
expected)
(error "Real implementation is \"~A\", but \"~A\" was expected when LISP=~A."
real-implementation
expected
needed-lisp))))))
;;; vim: set ft=lisp lisp:
Loading