about summary refs log tree commit diff
path: root/.guix/cwltest-package.scm
diff options
context:
space:
mode:
authorArun Isaac2025-08-18 16:44:05 +0100
committerArun Isaac2025-08-18 16:44:05 +0100
commitd08227022eeaa33e375d88eb3f3d41da75390eb5 (patch)
tree26b71cc463f7bfdef5f663bfac6af93ba59f28fa /.guix/cwltest-package.scm
parent8f5e4e7c6564bd43d953007c23a3e9b9aff5ff95 (diff)
downloadravanan-d08227022eeaa33e375d88eb3f3d41da75390eb5.tar.gz
ravanan-d08227022eeaa33e375d88eb3f3d41da75390eb5.tar.lz
ravanan-d08227022eeaa33e375d88eb3f3d41da75390eb5.zip
guix: Add cwltest package. HEAD main
Diffstat (limited to '.guix/cwltest-package.scm')
-rw-r--r--.guix/cwltest-package.scm117
1 files changed, 117 insertions, 0 deletions
diff --git a/.guix/cwltest-package.scm b/.guix/cwltest-package.scm
new file mode 100644
index 0000000..f3eeb9d
--- /dev/null
+++ b/.guix/cwltest-package.scm
@@ -0,0 +1,117 @@
+;;; ravanan --- High-reproducibility CWL runner powered by Guix
+;;; Copyright © 2025 Arun Isaac <arunisaac@systemreboot.net>
+;;;
+;;; This file is part of ravanan.
+;;;
+;;; ravanan is free software: you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation, either version 3 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; ravanan is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;;; General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with ravanan.  If not, see <https://www.gnu.org/licenses/>.
+
+(define-module (cwltest-package)
+  #:use-module ((gnu packages bioinformatics)
+                #:select (cwltool python-schema-salad))
+  #:use-module ((gnu packages check)
+                #:select (python-pytest python-pytest-xdist))
+  #:use-module ((gnu packages node) #:select (node))
+  #:use-module ((gnu packages python-build)
+                #:select (python-setuptools python-setuptools-scm python-wheel))
+  #:use-module ((gnu packages python-check) #:select (python-junit-xml))
+  #:use-module ((gnu packages xml) #:select (python-defusedxml))
+  #:use-module (guix build-system pyproject)
+  #:use-module (guix build-system python)
+  #:use-module (guix download)
+  #:use-module (guix gexp)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix packages))
+
+;; cwltest uses cwltool as a library. so, create a library version of cwltool
+;; where inputs become propagated inputs.
+(define python-cwltool
+  (package
+    (inherit cwltool)
+    (name "python-cwltool")
+    (inputs
+     (list node))
+    (propagated-inputs
+     (modify-inputs (package-inputs cwltool)
+       (delete "node")))))
+
+;; cwltest requires cwl-runner, the implementation-agnostic entry point to
+;; cwltool, for its tests.
+(define cwl-runner
+  (file-union "cwl-runner"
+              `(("bin/cwl-runner" ,(file-append cwltool "/bin/cwltool")))))
+
+(define-public cwltest
+  (package
+    (name "cwltest")
+    (version "2.6.20250314152537")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "cwltest" version))
+       (sha256
+        (base32 "0h2w9bllb6cz8d5pja5lbbd1kj08yga40jdi3300anwllczcnfq6"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list #:modules `((rnrs io ports)
+                       (srfi srfi-1)
+                       (srfi srfi-26)
+                       (srfi srfi-171)
+                       (guix build pyproject-build-system)
+                       (guix build utils))
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'disable-docker-in-tests
+                 (lambda _
+                   ;; Remove DockerRequirement (lines 7–10).
+                   (let* ((file "tests/test-data/v1.0/cat1-testcli.cwl")
+                          (lines (call-with-input-file file
+                                   (cut port-transduce
+                                        identity
+                                        rcons
+                                        get-line
+                                        <>))))
+                     (call-with-output-file file
+                       (lambda (port)
+                         (for-each (lambda (line)
+                                     (display line port)
+                                     (newline port))
+                                   (append (take lines 6)
+                                           (drop lines 10))))))))
+               (add-after 'install 'fix-permissions
+                 (lambda* (#:key inputs outputs #:allow-other-keys)
+                   ;; Make test scripts executable.
+                   (for-each (lambda (file)
+                               (chmod (string-append (site-packages inputs outputs)
+                                                     "/cwltest/tests/test-data/"
+                                                     file)
+                                      #o755))
+                             (list "dummy-executor.sh"
+                                   "mock_cwl_runner.py")))))))
+    (inputs (list python-defusedxml
+                  python-junit-xml
+                  python-pytest
+                  python-schema-salad))
+    (native-inputs (list cwl-runner
+                         python-cwltool
+                         python-pytest
+                         python-pytest-xdist
+                         python-setuptools
+                         python-setuptools-scm
+                         python-wheel))
+    (home-page "https://github.com/common-workflow-language/cwltest")
+    (synopsis "Common Workflow Language testing framework")
+    (description "Common Workflow Language testing framework.")
+    (license license:asl2.0)))
+
+cwltest