diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3424155 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +### Adapted from: https://github.com/neil-lindquist/CI-Utils/blob/master/config-examples/.github/workflows/ci.yml +name: CI + +# Github Actions allows for running jobs on a wide variety of events +on: + push: # Commits pushed to Github + pull_request: # Pull request is update + workflow_dispatch: # Manually dispatched from Github's UI + +jobs: + test: + name: "sbcl on ubuntu" + runs-on: ubuntu-latest + + env: + LISP: sbcl-bin + steps: + - uses: actions/checkout@v2 + - uses: 40ants/setup-lisp@v2 + with: + asdf-system: homestead + - uses: 40ants/run-tests@v2 + with: + asdf-system: homestead diff --git a/homestead-tests.asd b/homestead-tests.asd new file mode 100644 index 0000000..1e14f34 --- /dev/null +++ b/homestead-tests.asd @@ -0,0 +1,14 @@ +(asdf:defsystem "homestead-tests" + :author "Gosha Tcherednitchenko " + :license "MIT License" + :depends-on (#:homestead #:fiveam) + :serial t + :components ((:module "tests" + :components ((:file "test-util")))) + :perform (asdf:test-op (op system) + (let* ((fiveam:*on-failure* :backtrace) + (fiveam:*on-error* :backtrace) + (fiveam:*verbose-failures* t)) + (if (fiveam:run-all-tests :summary :end) + (format t "✅ All tests passed") + (error "❌ At least one suite failed"))))) diff --git a/homestead.asd b/homestead.asd index fff911f..78394ab 100644 --- a/homestead.asd +++ b/homestead.asd @@ -10,4 +10,5 @@ (:file "templates" :depends-on ("util")) (:file "node" :depends-on ("templates")) (:file "main" :depends-on ("util" "node"))))) - :description "A static website generator") + :description "A static website generator" + :in-order-to ((test-op (test-op "homestead-tests")))) diff --git a/tests/test-util.lisp b/tests/test-util.lisp new file mode 100644 index 0000000..8f53b4d --- /dev/null +++ b/tests/test-util.lisp @@ -0,0 +1,19 @@ +(defpackage homestead/tests/util + (:use :cl :it.bese.fiveam) + (:export :util-test-suite :|util-test-suite|)) + +(in-package :homestead/tests/util) + +(def-suite + util-test-suite + :description "Util test suite") +(in-suite util-test-suite) + +(test join + (let ((list '("a" "b"))) + (is (string= (homestead/util:join list) "a, b")) + (is (string= (homestead/util:join list " | ") "a | b")))) + +(test slurp + (let ((missing-file "/tmp/bob.txt")) + (is (equal '() (homestead/util:slurp missing-file)))))