Skip to content

Commit

Permalink
Merge ec0d48c into 49d242f
Browse files Browse the repository at this point in the history
  • Loading branch information
svetlyak40wt committed Nov 12, 2022
2 parents 49d242f + ec0d48c commit e75d75b
Show file tree
Hide file tree
Showing 24 changed files with 461 additions and 348 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/client-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"steps": [
{
"name": "Checkout Code",
"uses": "actions/checkout@v2"
"uses": "actions/checkout@v3"
},
{
"name": "Grant All Perms to Make Cache Restoring Possible",
Expand All @@ -34,13 +34,13 @@
{
"name": "Get Current Month",
"id": "current-month",
"run": "echo \"::set-output name=value::$(date -u \"+%Y-%m\")\"",
"run": "echo \"value=$(date -u \"+%Y-%m\")\" >> $GITHUB_OUTPUT",
"shell": "bash"
},
{
"name": "Cache Roswell Setup",
"id": "cache",
"uses": "actions/cache@v2",
"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') }}"
Expand All @@ -56,8 +56,7 @@
"name": "Setup Common Lisp Environment",
"uses": "40ants/setup-lisp@v2",
"with": {
"asdf-system": "openrpc-client",
"asdf-version": "3.3.5.1"
"asdf-system": "openrpc-client"
},
"if": "steps.cache.outputs.cache-hit != 'true'"
},
Expand All @@ -68,7 +67,7 @@
},
{
"name": "Update Qlot",
"run": "qlot update || qlot update",
"run": "qlot update --no-deps",
"shell": "bash"
},
{
Expand All @@ -78,7 +77,7 @@
},
{
"name": "Run Linter",
"run": "qlot exec 40ants-linter --system \"openrpc-client\"",
"run": "qlot exec 40ants-linter --system \"openrpc-client\" --imports",
"shell": "bash"
}
]
Expand Down
50 changes: 45 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,47 @@
]
},
"jobs": {
"linter": {
"runs-on": "ubuntu-latest",
"env": {
"OS": "ubuntu-latest",
"QUICKLISP_DIST": "quicklisp",
"LISP": "sbcl-bin"
},
"steps": [
{
"name": "Checkout Code",
"uses": "actions/checkout@v3"
},
{
"name": "Setup Common Lisp Environment",
"uses": "40ants/setup-lisp@v2",
"with": {
"asdf-system": "openrpc-docs"
}
},
{
"name": "Change dist to Ultralisp",
"run": "echo 'dist ultralisp http://dist.ultralisp.org' > qlfile",
"shell": "bash"
},
{
"name": "Update Qlot",
"run": "qlot update --no-deps",
"shell": "bash"
},
{
"name": "Install SBLint wrapper",
"run": "qlot exec ros install 40ants-linter",
"shell": "bash"
},
{
"name": "Run Linter",
"run": "qlot exec 40ants-linter --system \"openrpc-docs\" --imports",
"shell": "bash"
}
]
},
"build-docs": {
"runs-on": "ubuntu-latest",
"env": {
Expand All @@ -24,19 +65,18 @@
"steps": [
{
"name": "Checkout Code",
"uses": "actions/checkout@v2"
"uses": "actions/checkout@v3"
},
{
"name": "Setup Common Lisp Environment",
"uses": "40ants/setup-lisp@v2",
"with": {
"asdf-system": "openrpc-docs",
"asdf-version": "3.3.5.1"
"asdf-system": "openrpc-docs"
}
},
{
"name": "Build Docs",
"uses": "40ants/build-docs@v1.3.2-pre1",
"uses": "40ants/build-docs@v1",
"with": {
"asdf-system": "openrpc-docs",
"error-on-warnings": true
Expand All @@ -45,4 +85,4 @@
]
}
}
}
}
98 changes: 84 additions & 14 deletions .github/workflows/server-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,41 @@
"steps": [
{
"name": "Checkout Code",
"uses": "actions/checkout@v2"
"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'"
},
{
"name": "Setup Common Lisp Environment",
"uses": "40ants/setup-lisp@v2",
"with": {
"asdf-system": "openrpc-server",
"asdf-version": "3.3.5.1"
}
"asdf-system": "openrpc-server"
},
"if": "steps.cache.outputs.cache-hit != 'true'"
},
{
"name": "Change dist to Ultralisp",
Expand All @@ -41,7 +67,7 @@
},
{
"name": "Update Qlot",
"run": "qlot update || qlot update",
"run": "qlot update --no-deps",
"shell": "bash"
},
{
Expand All @@ -51,37 +77,81 @@
},
{
"name": "Run Linter",
"run": "qlot exec 40ants-linter --system \"openrpc-server\"",
"run": "qlot exec 40ants-linter --system \"openrpc-server\" --imports",
"shell": "bash"
}
]
},
"run-tests": {
"runs-on": "ubuntu-latest",
"strategy": {
"fail-fast": false,
"matrix": {
"os": [
"ubuntu-latest",
"macos-latest"
],
"quicklisp": [
"quicklisp",
"ultralisp"
],
"lisp": [
"sbcl-bin",
"ccl-bin"
]
}
},
"runs-on": "${{ matrix.os }}",
"env": {
"OS": "ubuntu-latest",
"QUICKLISP_DIST": "ultralisp",
"LISP": "sbcl-bin"
"OS": "${{ matrix.os }}",
"QUICKLISP_DIST": "${{ matrix.quicklisp }}",
"LISP": "${{ matrix.lisp }}"
},
"steps": [
{
"name": "Checkout Code",
"uses": "actions/checkout@v2"
"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 }}-${{ matrix.os }}-${{ matrix.quicklisp }}-${{ matrix.lisp }}-${{ 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'"
},
{
"name": "Setup Common Lisp Environment",
"uses": "40ants/setup-lisp@v2",
"with": {
"asdf-system": "openrpc-server",
"asdf-version": "3.3.5.1"
}
"qlfile-template": "{% ifequal quicklisp_dist \"ultralisp\" %}\ndist ultralisp http://dist.ultralisp.org\n{% endifequal %}"
},
"if": "steps.cache.outputs.cache-hit != 'true'"
},
{
"name": "Run Tests",
"uses": "40ants/run-tests@v2",
"with": {
"asdf-system": "openrpc-server",
"coveralls-token": "${{ secrets.github_token }}"
"coveralls-token": "\n${{ matrix.lisp == 'sbcl-bin' &&\n matrix.os == 'ubuntu-latest' &&\n matrix.quicklisp == 'ultralisp' &&\n secrets.github_token }}"
}
}
]
Expand Down
8 changes: 1 addition & 7 deletions client/ci.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,10 @@
(in-package #:openrpc-client/ci)


(defparameter *asdf-version* "3.3.5.1"
"At some point installation of the latest roswell version was broken:
https://github.com/roswell/roswell/issues/497")


(defworkflow client-ci
:on-push-to "master"
:by-cron "0 10 * * 1"
:on-pull-request t
:cache t
:jobs ((40ants-ci/jobs/linter:linter
:asdf-version *asdf-version*)))
:jobs ((40ants-ci/jobs/linter:linter :check-imports t)))

22 changes: 11 additions & 11 deletions client/core.lisp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
(uiop:define-package #:openrpc-client/core
(:use #:cl)
(:import-from #:40ants-doc
#:defsection
#:defsection-copy)
(:import-from #:kebab
#:to-lisp-case)
(:import-from #:jsonrpc)
(:import-from #:log)
(:import-from #:yason)
(:import-from #:jsonrpc/class)
(:import-from #:str)
(:import-from #:dexador)
Expand All @@ -17,15 +15,10 @@
#:connection-refused-error)
(:import-from #:openrpc-client/error
#:rpc-error)
(:export #:@index
#:@readme
#:generate-client))
(:export #:generate-client))
(in-package #:openrpc-client/core)


(defsection @example (:title "Example chapter")
"Please, fill this documentation with real docs.")


(eval-when (:compile-toplevel :load-toplevel :execute)
(defun generate-method-description (spec)
Expand Down Expand Up @@ -283,10 +276,17 @@
:message message
:func-name func-name
:func-arguments arguments)))))
(jsonrpc:call client func-name arguments))))
(jsonrpc/class:call client func-name arguments))))


(defmacro generate-client (class-name url-or-path &key (export-symbols t))
"Generates Common Lisp client by OpenRPC spec.
CLASS-NAME is the name of a API class. Also, a corresponding MAKE-<CLASS-NAME> function
is created.
URL-OR-PATH argument could be a string with HTTP URL of a spec, or a pathname
if a spec should be read from the disc."
(let* ((spec (retrieve-spec (eval url-or-path)))
(client-class (generate-client-class class-name spec :export-symbols export-symbols))
(object-classes
Expand Down
8 changes: 6 additions & 2 deletions client/docs.lisp
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
(uiop:define-package #:openrpc-client/docs
(:use #:cl)
(:import-from #:40ants-doc
#:defsection))
#:defsection)
(:import-from #:openrpc-client
#:generate-client))
(in-package #:openrpc-client/docs)


(defsection @client (:title "Client")
(openrpc-client system)
"OPENRPC-CLIENT ASDF system provides a way to build CL classes and methods for working with JSON-RPC API.
All you need is to give it an URL and all code will be created in compile-time as a result of macro-expansion.
Expand Down Expand Up @@ -127,4 +130,5 @@ OPENRPC-EXAMPLE/CLIENT> (funcall #v167:1)
Now this is the last page and there is now a closure to retrieve the next page. Learn more how
to implement pagination on server-side in the OPENRPC-SERVER/DOCS::@PAGINATION section.
")
"
(generate-client macro))
7 changes: 6 additions & 1 deletion docs/changelog.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@

(defchangelog (:ignore-words ("40ANTS-DOC"
"ASDF"
"API"
"CL"
"OSX"))
(0.4.0 2022-11-07
"- Fixed usage of default API when api is not specified to define-rpc-method macro.
- Fixed most imports.")
(0.3.0 2022-10-30
"- Method and its params now support such metadata as :summary :description and :deprecated.
- Schemas for CL classes can have :description if documentation id defined for class or its slots.
- Function OPENRPC-CLIENT:GENERATE now exports methods, classes and their slot readers by default.
- Macro OPENRPC-CLIENT:GENERATE-CLIENT now exports methods, classes and their slot readers by default.
- All methods, their arguments and object keys now use underscore instead of dash to make them more
convenient to use from other languages.")
(0.2.0 2022-10-25
Expand Down

0 comments on commit e75d75b

Please sign in to comment.