Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Ci (#3)
Browse files Browse the repository at this point in the history
* Add docker test via cli.

* Initial attempt at CircleCI config.

* Update Makefile/Dockerfile.

* Try to correct config.yml errors.

* Add checkout step.

* Tweak Dockerfile.

* Don't publish when loading (breaks Docker build).

* Fix dtest dependency.
  • Loading branch information
porcuquine committed Aug 6, 2019
1 parent 9fcf7e9 commit d4c3ed0
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 35 deletions.
12 changes: 12 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
jobs:
test:
machine: true
steps:
- checkout
- run: make dtest
workflows:
version: 2
build_and_test:
jobs:
- test
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ENV LC_TYPE=en_US.UTF-8
RUN apt-get update; apt-get upgrade -y; apt-get install -y openssl; apt-get install -y libssl1.0.0;

RUN apt-get install -y cl-launch
RUN apt-get install -y jq

COPY . /root/orient

Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ docker:

ubercalc:
cl -Q -sp orient --dump bin/ubercalc

utest: ubercalc
./bin/ucalc test

dtest: docker
./bin/dcalc test

2 changes: 1 addition & 1 deletion bin/dcalc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
docker run ubercalc $@
docker run ubercalc dcalc $@
72 changes: 38 additions & 34 deletions cli/cli.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
(calc (calc "{filecoin, performance, zigzag, fc-no-zigzag}" "Calculator to use"))
(port (port "port-number" "port to listen on"))
(merge (merge nil "merge inputs with (instead of replacing) defaults"))
(command (command "{dump, solve, web}" "<COMMAND>: may be provided as free token (without flag)."))
(command (command "{dump, solve, test, web}" "<COMMAND>: may be provided as free token (without flag)."))
&free commands)
(map-parsed-options (cli-options) nil '("in" "i"
"out" "o"
Expand All @@ -41,40 +41,44 @@
(lambda (free-val) (declare (ignore free-val))))
(destructuring-bind (&optional arg0 free-command &rest subcommands) commands
(declare (ignore arg0 subcommands))
(let ((command (keywordize (if command
(progn (assert (not free-command))
command)
free-command))))
(when (eql command :test)
(asdf:test-system :orient)
(return-from main t))
(let* ((*schema-package* (find-package :filecoin))
(calc-spec (maybe-keywordize calc))
(json:*json-symbols-package* 'filecoin) ;; FIXME: remove need to expose use of JSON package here.
(input (cond
((equal in "--") (load-tuple *standard-input*))
(in (load-tuple in))))

(let* ((*schema-package* (find-package :filecoin))
(command (if command
(progn (assert (not free-command))
command)
free-command))
(calc-spec (maybe-keywordize calc))
(json:*json-symbols-package* 'filecoin) ;; FIXME: remove need to expose use of JSON package here.
(input (cond
((equal in "--") (load-tuple *standard-input*))
(in (load-tuple in))))

(system (choose-system calc-spec)))
(with-output (out)
(case (keywordize command)
((:web)
(let ((acceptor (if port
(web:start-web :port port)
(web:start-web))))
(when acceptor
(format *error-output* "Orient webserver started on port ~S" (hunchentoot:acceptor-port acceptor)))
(let ((*package* (find-package :orient.web)))
(sb-impl::toplevel-repl nil))))
((:solve)
(cond
(system
(let ((override-data (and merge input))
(input (and (not merge) input)))
(handle-calc :system system :input input :override-data override-data)))
(t (format *error-output* "No system specified.~%"))))
((:dump)
(dump-json :system system *out* :expand-references t))
(otherwise
(format t "Usage: ~A command~% command is one of {web, solve}~%" (car argv)))))))))
(system (choose-system calc-spec)))
(with-output (out)
(case command
((:web)
(let ((acceptor (if port
(web:start-web :port port)
(web:start-web))))
(when acceptor
(format *error-output* "Orient webserver started on port ~S" (hunchentoot:acceptor-port acceptor)))
(let ((*package* (find-package :orient.web)))
(sb-impl::toplevel-repl nil))))
((:solve)
(cond
(system
(let ((override-data (and merge input))
(input (and (not merge) input)))
(handle-calc :system system :input input :override-data override-data)))
(t (format *error-output* "No system specified.~%"))))
((:dump)
(dump-json :system system *out* :expand-references t))
(otherwise
;; TODO: Generate this list and share with options doc.
(format t "Usage: ~A command~% command is one of {dump, solve, test, web}~%" (car argv))))
(terpri)))))))

(defun choose-system (spec)
(case spec
Expand Down
1 change: 1 addition & 0 deletions filecoin/publish.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
(null (with-output-to-string (out) (json:encode-json (publish-filecoin) out)))
(t (json:encode-json (publish-filecoin) where))))

#+(or)
(eval-when (:load-toplevel :execute)
(publish-filecoin-json))

Expand Down

0 comments on commit d4c3ed0

Please sign in to comment.