From 5b1a626adb63fd44b62c3954b67b7bf7d9677f0f Mon Sep 17 00:00:00 2001 From: Oliver Wegner Date: Mon, 9 Sep 2024 10:00:41 +0200 Subject: [PATCH 1/4] Fix application of *js-default-action* format string. --- src/actions.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/actions.lisp b/src/actions.lisp index 4d86df92..4b9611b0 100644 --- a/src/actions.lisp +++ b/src/actions.lisp @@ -235,7 +235,7 @@ situation (e.g. redirect, signal an error, etc.).")) (yason:with-output-to-string* () (yason:encode options))))) (t - (format nil *js-default-action* action-code))))) + (format nil *js-default-action* action-code nil))))) (defun make-js-form-action (action) From 85fc0f788e38ec01b9563be5d6a0f1f353ff195f Mon Sep 17 00:00:00 2001 From: Alexander Artemenko Date: Sat, 14 Sep 2024 12:53:25 +0000 Subject: [PATCH 2/4] Fixed an error inside REBLOCKS/ACTIONS:MAKE-JS-ACTION function when called without :ARGS. --- src/actions.lisp | 18 ++++++++---------- src/doc/changelog.lisp | 8 ++++++++ t/actions.lisp | 43 +++++++++++++++++++++++++++++++----------- 3 files changed, 48 insertions(+), 21 deletions(-) diff --git a/src/actions.lisp b/src/actions.lisp index 4b9611b0..d552e392 100644 --- a/src/actions.lisp +++ b/src/actions.lisp @@ -226,16 +226,14 @@ situation (e.g. redirect, signal an error, etc.).")) It accepts any function as input and produces a string with JavaScript code." (check-type args (or null hash-table)) - (let* ((action-code (make-action action))) - (cond - (args - (let ((options (dict "args" args))) - (format nil *js-default-action* - action-code - (yason:with-output-to-string* () - (yason:encode options))))) - (t - (format nil *js-default-action* action-code nil))))) + (let* ((action-code (make-action action)) + (serialized-args + (when args + (yason:with-output-to-string* () + (yason:encode (dict "args" args)))))) + (format nil *js-default-action* + action-code + serialized-args))) (defun make-js-form-action (action) diff --git a/src/doc/changelog.lisp b/src/doc/changelog.lisp index 9118d0d5..2cbda704 100644 --- a/src/doc/changelog.lisp +++ b/src/doc/changelog.lisp @@ -35,6 +35,14 @@ "REBLOCKS/SESSION:INIT") :external-links (("Ultralisp" . "https://ultralisp.org")) :external-docs ("https://40ants.com/log4cl-extras/")) + (0.61.0 2024-09-14 + """ +Fixes +===== + +* Fixed an error inside REBLOCKS/ACTIONS:MAKE-JS-ACTION function when called without :ARGS. (Thanks to olivercsr@github for the PR) + +""") (0.60.0 2024-07-28 """ Incompatible Changed diff --git a/t/actions.lisp b/t/actions.lisp index 969d9db9..006c586b 100644 --- a/t/actions.lisp +++ b/t/actions.lisp @@ -4,6 +4,8 @@ #:hamcrest/rove #:reblocks-tests/utils) (:import-from #:reblocks/actions + #:generate-action-code + #:make-js-action #:make-action #:eval-action #:on-missing-action @@ -19,7 +21,11 @@ (:import-from #:reblocks/variables #:*current-app*) (:import-from #:serapeum - #:fmt)) + #:dict + #:fmt) + (:import-from #:cl-mock + #:with-mocks + #:answer)) (in-package #:reblocks-tests/actions) @@ -123,18 +129,17 @@ (deftest make-action-success - (reblocks/app:with-app (make-instance 'test-app) - (with-test-session () - (with-test-request ("/") - (internal-make-action #'identity "abc123") + (with-test-session () + (with-test-request ("/") + (internal-make-action #'identity "abc123") - (ok (equal (make-action "abc123") - "abc123") - "When action is defined make-action should return it's name") + (ok (equal (make-action "abc123") + "abc123") + "When action is defined make-action should return it's name") - (ok (equal (make-action #'identity) - "abc123") - "This also should work if a function was given as an argument"))))) + (ok (equal (make-action #'identity) + "abc123") + "This also should work if a function was given as an argument")))) (defun test-action () @@ -149,3 +154,19 @@ (ok (equal (make-action-url "test-action") "/foo/bar?action=test-action")))))) + + +(deftest make-js-action-test () + (with-test-session () + (with-test-request ("/") + (with-mocks () + (answer generate-action-code "action:code") + + (ok (equal (make-js-action 'identity) + "return initiateAction(\"action:code\")")) + + (ok (equal (make-js-action 'identity + :args (dict + "some" "argument" + "another" 100500)) + "return initiateAction(\"action:code\", {\"args\":{\"some\":\"argument\",\"another\":100500}})")))))) From 99443096a613a5c5f686d680d38ba977c24e3f81 Mon Sep 17 00:00:00 2001 From: Alexander Artemenko Date: Sat, 14 Sep 2024 13:13:50 +0000 Subject: [PATCH 3/4] Fixed a few issues in docs and tests. --- src/doc/changelog.lisp | 1 + t/actions.lisp | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doc/changelog.lisp b/src/doc/changelog.lisp index 2cbda704..d6fd2739 100644 --- a/src/doc/changelog.lisp +++ b/src/doc/changelog.lisp @@ -13,6 +13,7 @@ "URL" "URI" "API" + "PR" "DOM" "AJAX" "JSON" diff --git a/t/actions.lisp b/t/actions.lisp index 006c586b..d5d882bc 100644 --- a/t/actions.lisp +++ b/t/actions.lisp @@ -167,6 +167,5 @@ (ok (equal (make-js-action 'identity :args (dict - "some" "argument" - "another" 100500)) - "return initiateAction(\"action:code\", {\"args\":{\"some\":\"argument\",\"another\":100500}})")))))) + "foo" 100500)) + "return initiateAction(\"action:code\", {\"args\":{\"foo\":100500}})")))))) From 745439a5313af12f421ba6fde9282b339e574f89 Mon Sep 17 00:00:00 2001 From: Alexander Artemenko Date: Sat, 14 Sep 2024 13:25:43 +0000 Subject: [PATCH 4/4] Updated CI pipelines. --- .github/workflows/ci.yml | 13 ++++++++++--- .github/workflows/docs.yml | 36 +++++------------------------------ .github/workflows/linter.yml | 36 +++++------------------------------ .github/workflows/release.yml | 2 +- src/ci.lisp | 6 +++++- 5 files changed, 26 insertions(+), 67 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cb60349..2a206983 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,12 @@ "ubuntu-latest", "windows-latest" ], + "exclude": [ + { + "os": "windows-latest", + "lisp": "ccl-bin" + } + ], "lisp": [ "sbcl-bin", "ccl-bin" @@ -37,13 +43,14 @@ "steps": [ { "name": "Checkout Code", - "uses": "actions/checkout@v3" + "uses": "actions/checkout@v4" }, { "name": "Setup Common Lisp Environment", - "uses": "40ants/setup-lisp@v3", + "uses": "40ants/setup-lisp@v4", "with": { - "asdf-system": "reblocks" + "asdf-system": "reblocks", + "cache": "true" } }, { diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2892e767..1e413d18 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -19,41 +19,15 @@ "steps": [ { "name": "Checkout Code", - "uses": "actions/checkout@v3" - }, - { - "name": "Grant All Perms to Make Cache Restoring Possible", - "run": "sudo mkdir -p /usr/local/etc/roswell\n sudo chown \"${USER}\" /usr/local/etc/roswell\n # Here the ros binary will be restored:\n sudo chown \"${USER}\" /usr/local/bin", - "shell": "bash" - }, - { - "name": "Get Current Month", - "id": "current-month", - "run": "echo \"value=$(date -u \"+%Y-%m\")\" >> $GITHUB_OUTPUT", - "shell": "bash" - }, - { - "name": "Cache Roswell Setup", - "id": "cache", - "uses": "actions/cache@v3", - "with": { - "path": "qlfile\nqlfile.lock\n~/.cache/common-lisp/\n~/.roswell\n/usr/local/etc/roswell\n/usr/local/bin/ros\n/usr/local/Cellar/roswell\n.qlot", - "key": "a-${{ steps.current-month.outputs.value }}-${{ env.cache-name }}-ubuntu-latest-quicklisp-sbcl-bin-${{ hashFiles('qlfile.lock', '*.asd') }}" - } - }, - { - "name": "Restore Path To Cached Files", - "run": "echo $HOME/.roswell/bin >> $GITHUB_PATH\n echo .qlot/bin >> $GITHUB_PATH", - "shell": "bash", - "if": "steps.cache.outputs.cache-hit == 'true'" + "uses": "actions/checkout@v4" }, { "name": "Setup Common Lisp Environment", - "uses": "40ants/setup-lisp@v3", + "uses": "40ants/setup-lisp@v4", "with": { - "asdf-system": "reblocks-docs" - }, - "if": "steps.cache.outputs.cache-hit != 'true'" + "asdf-system": "reblocks-docs", + "cache": "true" + } }, { "name": "Build Docs", diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 8604c1cb..3c95bd06 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -14,41 +14,15 @@ "steps": [ { "name": "Checkout Code", - "uses": "actions/checkout@v3" - }, - { - "name": "Grant All Perms to Make Cache Restoring Possible", - "run": "sudo mkdir -p /usr/local/etc/roswell\n sudo chown \"${USER}\" /usr/local/etc/roswell\n # Here the ros binary will be restored:\n sudo chown \"${USER}\" /usr/local/bin", - "shell": "bash" - }, - { - "name": "Get Current Month", - "id": "current-month", - "run": "echo \"value=$(date -u \"+%Y-%m\")\" >> $GITHUB_OUTPUT", - "shell": "bash" - }, - { - "name": "Cache Roswell Setup", - "id": "cache", - "uses": "actions/cache@v3", - "with": { - "path": "qlfile\nqlfile.lock\n~/.cache/common-lisp/\n~/.roswell\n/usr/local/etc/roswell\n/usr/local/bin/ros\n/usr/local/Cellar/roswell\n.qlot", - "key": "a-${{ steps.current-month.outputs.value }}-${{ env.cache-name }}-ubuntu-latest-quicklisp-sbcl-bin-${{ hashFiles('qlfile.lock', '*.asd') }}" - } - }, - { - "name": "Restore Path To Cached Files", - "run": "echo $HOME/.roswell/bin >> $GITHUB_PATH\n echo .qlot/bin >> $GITHUB_PATH", - "shell": "bash", - "if": "steps.cache.outputs.cache-hit == 'true'" + "uses": "actions/checkout@v4" }, { "name": "Setup Common Lisp Environment", - "uses": "40ants/setup-lisp@v3", + "uses": "40ants/setup-lisp@v4", "with": { - "asdf-system": "reblocks" - }, - "if": "steps.cache.outputs.cache-hit != 'true'" + "asdf-system": "reblocks", + "cache": "true" + } }, { "name": "Change dist to Ultralisp if qlfile does not exist", diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 954a253b..4362396b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ "steps": [ { "name": "Checkout Code", - "uses": "actions/checkout@v3" + "uses": "actions/checkout@v4" }, { "name": "Create release tag", diff --git a/src/ci.lisp b/src/ci.lisp index 910d3f53..827f464c 100644 --- a/src/ci.lisp +++ b/src/ci.lisp @@ -25,12 +25,16 @@ :on-push-to "master" :by-cron "0 10 * * 1" :on-pull-request t - ;; :cache t + :cache t :jobs ((40ants-ci/jobs/run-tests:run-tests :os ("ubuntu-latest" "windows-latest") :lisp ("sbcl-bin" "ccl-bin") + :exclude ((:os "windows-latest" + ;; CCL-BIN 1.13 has issues on Windows + ;; https://github.com/40ants/reblocks/actions/runs/10862718561/job/30146062047?pr=66 + :lisp "ccl-bin")) :coverage t))) (defworkflow docs