Skip to content
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
30 changes: 25 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,44 @@ jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
defaults:
run:
shell: bash

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- name: Install SBCL
run: sudo apt-get install sbcl
- name: Install SBCL (Linux)
if: runner.os == 'Linux'
run: sudo apt-get install -y sbcl

- name: Install SBCL (macOS)
if: runner.os == 'macOS'
run: brew install sbcl

- name: Install SBCL (Windows)
if: runner.os == 'Windows'
run: choco install sbcl

- name: Install Quicklisp and ql-https
run: bash install.sh
run: ./install.sh

- name: Run tests
env:
CI: 1
run: |
sbcl <<EOF
(require 'asdf)
(push (uiop:getcwd) asdf:*central-registry*)
(ql:quickload "ql-https/test")
(asdf:test-system "ql-https")
(uiop:quit)
EOF

8 changes: 4 additions & 4 deletions ql-https.asd
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
(defsystem "ql-https/test"
:description "Tests for ql-https"
:depends-on ((:require "uiop")
"fiasco"
"fiveam"
"ql-https")
:pathname "t/"
:components ((:file "tests"))
:perform (test-op (op c)
(unless (uiop:symbol-call :fiasco :run-package-tests :package :ql-https/test)
#+(not (or :swank :slynk))
(error "Tests failed."))))
(unless (uiop:symbol-call :fiveam :run! :ql-https)
(when (uiop:getenvp "CI")
(uiop:quit 1)))))



Expand Down
28 changes: 16 additions & 12 deletions t/tests.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,45 @@
;;; License, v. 2.0. If a copy of the MPL was not distributed with this
;;; file, You can obtain one at http://mozilla.org/MPL/2.0/.

(fiasco:define-test-package :ql-https/test)
(defpackage #:ql-https/test
(:use :cl :fiveam))

(in-package #:ql-https/test)

(defmacro wait ((&key (timeout 10)) &body body)
(def-suite* :ql-https)

(defmacro wait ((&key (timeout 20)) &body body)
(let ((gthread (gensym "thread")))
`(let ((,gthread (sb-thread:make-thread (lambda ()
(progn ,@body)))))
(sb-thread:join-thread ,gthread :timeout ,timeout))))

(deftest test-ql-https-is-initialized-correctly ()
(test test-ql-https-is-initialized-correctly
(let ((http-function (cdr (assoc "http" ql-http:*fetch-scheme-functions* :test #'string=)))
(https-function (cdr (assoc "https" ql-http:*fetch-scheme-functions* :test #'string=))))
(is (eq 'ql-https:fetcher http-function) "HTTP doesn't use `ql-https:fetch'")
(is (eq 'ql-https:fetcher https-function) "HTTP doesn't use `ql-https:fetch'")))

(deftest test-downloading-system ()
(test test-downloading-system
(ql:uninstall "str")
(let ((ql-https:*quietly-use-https* nil))
(signals ql-https:no-https-error
(ql:quickload "str" :silent t))))

(deftest test-quicklisp-download ()
(test test-quicklisp-download
(ql:uninstall "str")
(wait ()
(let ((ql-https:*quietly-use-https* t))
(ql:quickload "str" :silent t)))
(let ((ql-https:*quietly-use-https* t))
(ql:quickload "str" :silent t)))
(is (find-package :str)))

(deftest test-ultralisp-download ()
(test test-ultralisp-download
(ql:uninstall "hyperdoc")
(wait ()
(let ((ql-https:*quietly-use-https* t))
;; install ultralisp
(ql-dist:install-dist "https://dist.ultralisp.org/" :prompt nil :replace t)
(ql:quickload "hyperdoc" :silent t)))
(let ((ql-https:*quietly-use-https* t))
;; install ultralisp
(ql-dist:install-dist "https://dist.ultralisp.org/" :prompt nil :replace t)
(ql:quickload "hyperdoc" :silent t)))
(is (find-package :hyperdoc)))


Expand Down
Loading