Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nasdf #13

Merged
merged 4 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 15 additions & 63 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# SPDX-FileCopyrightText: Atlas Engineer LLC
# SPDX-License-Identifier: BSD-3 Clause
# Inspired by http://3bb.cc/blog/2020/09/11/github-ci/.

name: Tests

# We tell GitHub to not duplicate the checks in pull requests. See
# https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662/15
on:
push:
branches: [ master ]
Expand All @@ -17,76 +15,30 @@ jobs:
name: ${{ matrix.lisp }} on ${{ matrix.os }}
strategy:
matrix:
# Use ccl-bin/1.12.1 instead of 'ccl' because of
# https://github.com/roswell/roswell/issues/534.
# TODO: Revert when Roswell is functional again.
lisp: [sbcl-bin, ccl-bin/1.12.1, ecl/21.2.1]
rosargs: [dynamic-space-size=3072]
os: [ubuntu-latest, macos-latest] # try windows-latest when we understand commands to install Roswell on it

# run the job on every combination of "lisp" and "os" above
lisp: [sbcl-bin]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}

steps:
# Check out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Cache .roswell
id: cache-dot-roswell
uses: actions/cache@v1
- uses: actions/checkout@v4
with:
path: ~/.roswell
key: ${{ runner.os }}-dot-roswell-${{ matrix.lisp }}-${{ hashFiles('**/*.asd') }}
restore-keys: |
${{ runner.os }}-dot-roswell-${{ matrix.lisp }}-
${{ runner.os }}-dot-roswell-

- name: Install Roswell
shell: bash
# always run install, since it does some global installs and setup that isn't cached
env:
LISP: ${{ matrix.lisp }}
# TODO: Update Roswell to latest version (may need Ubuntu 20.* or above).
run: curl -L https://raw.githubusercontent.com/roswell/roswell/v20.06.14.107/scripts/install-for-ci.sh | sh -x

- name: Check Lisp
continue-on-error: true
shell: bash
run: |
ros ${{ matrix.rosargs }} -e '(format t "~&~a:~a on ~a~%" (lisp-implementation-type) (lisp-implementation-version) (machine-type))'
ros ${{ matrix.rosargs }} -e '(format t "ASDF: ~a~%" (asdf:asdf-version))'
ros ${{ matrix.rosargs }} -e '(format t "fixnum bits: ~a~%" (integer-length most-positive-fixnum))'
ros ${{ matrix.rosargs }} -e '(format t "features: ~s~%" *features*)'
show-progress: 'false'
submodules: 'true'

- name: Register current checkout path in ASDF
shell: bash
- name: Register submodules in ASDF
run: |
mkdir -p ~/.config/common-lisp/source-registry.conf.d/
echo "(:tree \"$PWD\")" > ~/.config/common-lisp/source-registry.conf.d/asdf.conf
echo "(:tree \"$PWD/_build\")" >> ~/.config/common-lisp/source-registry.conf.d/asdf.conf

- name: Fetch Common Lisp third-party dependencies
shell: bash
run: |
ros ${{ matrix.rosargs }} -e '(handler-bind ((error (lambda (a) (uiop:print-backtrace) (format *error-output* "Error: ~a~&" a) (uiop:quit 17)))) (asdf:load-system :njson/submodules))'
mkdir -p ~/.config/common-lisp/source-registry.conf.d/
echo "(:tree \"$PWD/_build/submodules\")" >> ~/.config/common-lisp/source-registry.conf.d/asdf.conf

- name: Load the system
shell: bash
run: |
# TODO: Can we make CCL backtraces more readable? With trivial-backtrace maybe?
ros ${{ matrix.rosargs }} -e '(asdf:load-system :njson/submodules)' -e '(handler-bind ((error (lambda (a) (uiop:print-condition-backtrace a) (format *error-output* "Error: ~a~&" a) (uiop:quit 17)))) (asdf:load-system :njson))'

# Load tests separately to not clutter the test output.
- name: Load tests
shell: bash
- name: Install Roswell
env:
LISP: ${{ matrix.lisp }}
run: |
ros ${{ matrix.rosargs }} -e '(asdf:load-system :njson/submodules)' -e '(handler-bind ((error (lambda (a) (uiop:print-backtrace) (format *error-output* "~a~&" a) (uiop:quit 17)))) (asdf:load-system :njson/tests))'
curl -L https://raw.githubusercontent.com/roswell/roswell/master/scripts/install-for-ci.sh | sh -x

- name: Run tests
shell: bash
# Export CI to tell ASDF to quit on test errors.
env:
NASDF_TESTS_QUIT_ON_FAIL: yes
run: |
ros ${{ matrix.rosargs }} -e '(asdf:load-system :njson/submodules)' -e '(asdf:test-system :njson/cl-json)'
ros -e '(asdf:load-system :njson/cl-json)' \
-e '(handler-case (asdf:load-system :njson/tests) (error (c) (format t "Error: ~s~%~a~%" c c) (uiop:quit 1)))' \
-e '(let ((output (lisp-unit2:run-tests :package :njson/tests))) (lisp-unit2:print-summary output) (when (or (lisp-unit2:failed output) (lisp-unit2:errors output)) (uiop:quit 1)))'
90 changes: 6 additions & 84 deletions guix.scm
Original file line number Diff line number Diff line change
Expand Up @@ -3,95 +3,17 @@

;;; Commentary:
;;
;; GNU Guix development package. To build and install, clone this repository,
;; switch directory to here and run:
;; GNU Guix development package. To start the REPL:
;;
;; guix package --install-from-file=guix.scm
;; guix shell -f path/to/guix.scm sbcl -- sbcl
;;
;; To use as the basis for a development environment, run:
;;
;; guix shell --container -D -f build-scripts/guix.scm
;;
;; Replace --container by --pure if you still want ASDF to see external
;; libraries in ~/common-lisp, etc.
;; To build a local executable and then run it:
;;; Code:

(use-modules (guix packages)
((guix licenses) #:prefix license:)
(guix gexp)
(guix git-download)
(guix build-system asdf)
(gnu packages)
(gnu packages lisp)
(gnu packages lisp-check)
(gnu packages lisp-xyz))

(define-public sbcl-njson
(package
(name "sbcl-njson")
(version "1.2.1")
(source
(local-file (dirname (current-filename)) #:recursive? #t)
;;;; Or this, in case of contributing to Guix.
;; (origin
;; (method git-fetch)
;; (uri (git-reference
;; (url "https://github.com/atlas-engineer/njson")
;; (commit version)))
;; (file-name (git-file-name "cl-njson" version))
;; (sha256
;; (base32
;; "SPECIFY-HASH")))
)
(build-system asdf-build-system/sbcl)
;; We use `cl-*' inputs and not `sbcl-*' ones so that CCL users can also use
;; this Guix manifests.
;;
;; Another reason is to not fail when an input dependency is found in
;; ~/common-lisp, which would trigger a rebuild of the SBCL input in the
;; store, which is read-only and would thus fail.
;;
;; The official Guix package should use `sbcl-*' inputs though.
(native-inputs (list cl-lisp-unit2 sbcl))
(inputs (list cl-json cl-jzon))
(arguments
'(#:asd-systems '("njson" "njson/jzon")))
(synopsis "JSON handling framework for Common Lisp.")
(home-page "https://github.com/atlas-engineer/njson")
(description "NJSON aims to make it convenient for one to decode, encode,
and process JSON data, in the minimum keystrokes/minutes possible.

NJSON is parser-independent, with existing Common Lisp JSON parsers being
loadable as additional system. @code{jzon} is included by default, though.
Conveniences that NJSON provides are:

@itemize

@item @code{encode} and @code{decode} as single entry points for JSON reading
and writing, be it from streams/string/files, or from those.

@item @code{jget}, @code{jcopy}, @code{jkeys}, and their aliases to
manipulate the decoded objects' properties without the need to worry
about the low-level details of how these values are decoded.

@item @code{jif}, @code{jwhen}, @code{jor}, @code{jand}, and other macros
mimicking Lisp ones, while using truth values of JSON-decoded data.

@item @code{jbind} and @code{jmatch} macros to destructure and
validate parsed JSON.

@item @code{njson/aliases} package to nickname to @code{j} for all the
forms conveniently accessible as @code{j:get}, @code{j:copy},
@code{j:if} etc.

@end itemize\n")
(license license:bsd-3)))

(define-public cl-njson
(sbcl-package->cl-source-package sbcl-njson))

(define-public ecl-njson
(sbcl-package->ecl-package sbcl-njson))

cl-njson
(package
(inherit cl-njson)
(version "dev")
(source (local-file (dirname (current-filename)) #:recursive? #t)))
168 changes: 0 additions & 168 deletions nasdf/compilation-tests.lisp

This file was deleted.

Loading