travis CI with Common Lisp.
Dec. 29th, 2014 02:53 amCommon Lisp tooling typically isn't oriented around the continuous integration/build systems that we're accustomed to in 2014.
I don't terribly like that, particularly since it's one of the few tools that have been demonstrated to work, and work well, in software engineering.
Anyway, I updated my TOML parser to work with (Travis CI)[https://github.com/pnathan/pp-toml] (but the principles are the same regardless of box host). Here's the code, followed by a write-up.
As a YAML:
before_script:
- curl -O -L http://prdownloads.sourceforge.net/sbcl/sbcl-1.2.6-x86-64-linux-binary.tar.bz2
- tar xjf sbcl-1.2.6-x86-64-linux-binary.tar.bz2
- pushd sbcl-1.2.6-x86-64-linux/ && sudo bash install.sh && popd
- curl -O -L http://beta.quicklisp.org/quicklisp.lisp
- sbcl --load quicklisp.lisp --eval '(quicklisp-quickstart:install)' --eval '(quit)'
script:
- sbcl --script run-sbcl-tests.lisp
Where the run-sbcl-tests.lisp looks as follows:
#!/usr/local/bin/sbcl
(require "sb-posix")
#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
(user-homedir-pathname))))
(when (probe-file quicklisp-init)
(load quicklisp-init)))
(defparameter *pwd* (concatenate 'string (sb-posix:getcwd) "/"))
(push *pwd* asdf:*central-registry*)
(ql:quickload :pp-toml-tests)
(let ((result-status (pp-toml-tests:run-tests)))
(sb-posix:exit (if result-status 0 1) ))
Under the hood and in Lisp, pp-toml-tests:run-tests
drives some fiveAM code to run the extant tests. FiveAM is, as far as I can tell, designed for on-the-fly interactive testing, as most Lisp tooling is. It was entirely too surprising in an integration with continuous integration. I've written my own bad hack for a unit testing framework, the "checker" system, designed for running in CI, but it's kind of, well, a bad hack. I should look elsewhere.
A few key highlights of what's going on in this code:
- I use old-style ASDF registry manipulation to dynamically set where we should be expecting our systems under test to be.
- This code relies on the SB-POSIX SBCL extension - I expect other systems will be able to do the same functionality, but SBCL is what I primarily use.
- I hand-load Quicklisp each time. That's not ideal, and should be changed when I update pp-toml to TOML 0.3.
Hope this helps your Common Lisp integration testing!