Skip to content

Commit

Permalink
Start of Github workflow for building and testing
Browse files Browse the repository at this point in the history
Right now we have ECL in native and fall back modes.
  • Loading branch information
metawilm committed May 9, 2024
1 parent 2df8938 commit ab07fd9
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 13 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/force-native.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(in-package :cl-user)

(eval-when (:compile-toplevel :load-toplevel :execute)
(setf *features*
(cons :custom-hash-table-fallback
(remove :custom-hash-table-native *features*))))
15 changes: 15 additions & 0 deletions .github/workflows/github-workflow-tests.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(in-package :cl-user)

(load "/tmp/ql-dir/quicklisp.lisp")
(quicklisp-quickstart:install)

(load "/home/runner/work/cl-custom-hash-table/cl-custom-hash-table/cl-custom-hash-table.asd")
(load "/home/runner/work/cl-custom-hash-table/cl-custom-hash-table/cl-custom-hash-table-test.asd")

(ql:quickload :cl-custom-hash-table)
(ql:quickload :cl-custom-hash-table-test)

(asdf:oos 'asdf::load-op :cl-custom-hash-table :force t)
(asdf:oos 'asdf::load-op :cl-custom-hash-table-test :force t)

(cl-custom-hash-table-test:run-without-debugging)
74 changes: 74 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: build & test
on:
push:
branches:
- master
- dev
jobs:

install_ecl:
name: Download and Install ECL
runs-on: ubuntu-latest
steps:
- run: |
cd /tmp
mkdir ecl-dir
cd ecl-dir
wget https://common-lisp.s3.eu-central-1.amazonaws.com/ecl-23.9.9.tgz
- name: Upload ECL artifact
uses: actions/upload-artifact@v4
with:
name: ecl-artifact
path: /tmp/ecl-dir/ecl-23.9.9.tgz

install_quicklisp:
name: Install QuickLisp
runs-on: ubuntu-latest
steps:
- run: |
cd /tmp
mkdir ql-dir
cd ql-dir
wget -q https://beta.quicklisp.org/quicklisp.lisp
chmod -R a+rwx /tmp/ql-dir
- name: Upload Quicklisp artifact
uses: actions/upload-artifact@v4
with:
name: ql-artifact
path: /tmp/ql-dir

run_test_suites:
name: Test on ${{ matrix.scenario }}
runs-on: ubuntu-latest
strategy:
matrix:
scenario: [ecl_native, ecl_fallback]
needs: [install_quicklisp, install_ecl]
steps:
- uses: actions/checkout@v4
- run: |
cd /home/runner/work/cl-custom-hash-table/cl-custom-hash-table/.github/workflows/
cat force-native.lisp github-workflow-tests.lisp > github-workflow-tests-fallback.lisp
- uses: actions/download-artifact@v4
with:
name: ql-artifact
path: /tmp/ql-dir
- if: (matrix.scenario == 'ecl_native') || (matrix.scenario == 'ecl_fallback')
uses: actions/download-artifact@v4
with:
name: ecl-artifact
path: /tmp/ecl-dir/
- if: (matrix.scenario == 'ecl_native') || (matrix.scenario == 'ecl_fallback')
run: |
cd /tmp/ecl-dir/
tar -xzf ecl-23.9.9.tgz
cd ecl-23.9.9
./configure
make -j 8
sudo make install
- if: matrix.scenario == 'ecl_native'
run: |
ecl --shell /home/runner/work/cl-custom-hash-table/cl-custom-hash-table/.github/workflows/github-workflow-tests.lisp
- if: matrix.scenario == 'ecl_fallback'
run: |
ecl --shell /home/runner/work/cl-custom-hash-table/cl-custom-hash-table/.github/workflows/github-workflow-tests-fallback.lisp
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
CL-CUSTOM-HASH-TABLE: Custom hash tables for Common Lisp
========================================================

[![](https://github.com/metawilm/cl-custom-hash-table/actions/workflows/run-tests.yaml/badge.svg?branch=master)](https://github.com/metawilm/cl-custom-hash-table/actions)

Introduction
------------

Expand Down Expand Up @@ -36,18 +38,16 @@ The fall-back solution is not thread-safe. The native implementation may or may
Supported implementations
-------------------------

See the [build status](https://travis-ci.org/metawilm/cl-custom-hash-table) on Travis-CI, and the [coverage status](https://coveralls.io/github/metawilm/cl-custom-hash-table?branch=master) on Coveralls:

| Common Lisp Implementation | Native | Fallback |
|:-:|:-:|:-:|
| [ABCL](https://common-lisp.net/project/armedbear/) | n/a | ![Build Status](https://travis-build-job-badge.herokuapp.com/badge?user=metawilm&repo=cl-custom-hash-table&branch=master&envContains=abcl+FALLBACK&label=ABCL+fallback) |
| [Allegro CL](http://franz.com/products/allegrocl/) | ![Build Status](https://travis-build-job-badge.herokuapp.com/badge?user=metawilm&repo=cl-custom-hash-table&branch=master&envContains=allegro+NATIVE&label=Allegro+native) | ![Build Status](https://travis-build-job-badge.herokuapp.com/badge?user=metawilm&repo=cl-custom-hash-table&branch=master&envContains=allegro+FALLBACK&label=Allegro+fallback) |
| [Clozure CL](http://clozure.com/clozurecl.html) | ![Build Status](https://travis-build-job-badge.herokuapp.com/badge?user=metawilm&repo=cl-custom-hash-table&branch=master&envContains=ccl+NATIVE&label=CCL+native) | ![Build Status](https://travis-build-job-badge.herokuapp.com/badge?user=metawilm&repo=cl-custom-hash-table&branch=master&envContains=ccl+FALLBACK&label=CCL+fallback) |
| [CLISP](http://clisp.sourceforge.net) | n/a | ![Build Status](https://travis-build-job-badge.herokuapp.com/badge?user=metawilm&repo=cl-custom-hash-table&branch=master&envContains=clisp+FALLBACK&label=CLISP+fallback) |
| [ABCL](https://common-lisp.net/project/armedbear/) | ? | ? |
| [Allegro CL](http://franz.com/products/allegrocl/) | ? | ? |
| [Clozure CL](http://clozure.com/clozurecl.html) | ? | ? |
| [CLISP](http://clisp.sourceforge.net) | ? | ? |
| [CMUCL](http://www.cons.org/cmucl/) | ? | ? |
| [ECL](http://ecls.sourceforge.net/) | n/a | ![Build Status](https://travis-build-job-badge.herokuapp.com/badge?user=metawilm&repo=cl-custom-hash-table&branch=master&envContains=ecl+FALLBACK&label=ECL+fallback) |
| [ECL 23.9.9](https://ecl.common-lisp.dev) | ✅ | ✅ |
| [LispWorks](http://www.lispworks.com/) | ? | ? |
| [SBCL](http://sbcl.sourceforge.net/) | ![Build Status](https://travis-build-job-badge.herokuapp.com/badge?user=metawilm&repo=cl-custom-hash-table&branch=master&envContains=sbcl+NATIVE&label=SBCL+native) | ![Build Status](https://travis-build-job-badge.herokuapp.com/badge?user=metawilm&repo=cl-custom-hash-table&branch=master&envContains=sbcl+FALLBACK&label=SBCL+fallback) ![Coverage Status](https://coveralls.io/repos/github/metawilm/cl-custom-hash-table/badge.svg?branch=master) |
| [SBCL](http://sbcl.sourceforge.net/) | ? | ? |

Example
-------
Expand Down
2 changes: 1 addition & 1 deletion test-package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
(:use #:cl-custom-hash-table #:hu.dwim.stefil #:common-lisp)
#+custom-hash-table-fallback
(:import-from #:cl-custom-hash-table #:custom-hash-table)
(:export #:run))
(:export #:run #:run-without-debugging))
18 changes: 14 additions & 4 deletions test-suite.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,20 @@
(signals error (eval '(with-custom-hash-table
(loop for x being the #:hash-values in (make-hash-table)
do nil))))

(terpri)
(format t "Test success!~%")
t)

(defun test-failures-p ()
(when (plusp #1=(length (hu.dwim.stefil::failure-descriptions-of *last-test-result*)))
#1#))

(defun run-without-debugging ()
(without-debugging (run))
(if #1=(test-failures-p)
(error "There were ~d test failures" #1#)
(format t "No test failures.~%")))

(defun run ()
(basic-test))
(prog1 (basic-test)
(if #1=(test-failures-p)
(format t "~%There were ~d test failures~%" #1#)
(format t "~%Test success!~%"))))

0 comments on commit ab07fd9

Please sign in to comment.