From 69d9de78820e1a8e767c5b10f5a964dbb94fffbd Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 19 Dec 2023 21:29:47 +0000 Subject: Use guix-channel-job-gexp for gn-auth pylint and mypy CI jobs. * genenetwork-development.scm (genenetwork3-tests): Delete function. (gn-auth-pylint): Delete variable. (genenetwork-projects): Build only the gn-auth variable in the gn-auth CI job. Combine gn-auth-mypy and gn-auth-pylint CI jobs into a gn-auth-all-tests job that uses guix-channel-job-gexp. * genenetwork/development-helper.scm (genenetwork-lint-gexp): Delete function. --- genenetwork-development.scm | 55 +++++++++----------------------------- genenetwork/development-helper.scm | 37 ------------------------- 2 files changed, 12 insertions(+), 80 deletions(-) diff --git a/genenetwork-development.scm b/genenetwork-development.scm index fe2392b..d22e926 100644 --- a/genenetwork-development.scm +++ b/genenetwork-development.scm @@ -207,35 +207,6 @@ executed." (chdir "genenetwork2") (apply invoke '#$test-command)))))) -(define (genenetwork3-tests tests-command manifest) - "Return a G-expression running TESTS-COMMAND in a profile described -by MANIFEST with the latest git checkout of genenetwork3 as the -current directory. TESTS-COMMAND is a list of strings specifying the -command to be executed." - (with-imported-modules (source-module-closure '((genenetwork development-helper)) - #:select? import-module?) - #~(lambda (genenetwork3-checkout) - ((@@ (genenetwork development-helper) - command-in-source-gexp) - genenetwork3-checkout - #$(profile - (content manifest) - (allow-collisions? #t)) - '#$tests-command)))) - -(define gn-auth-pylint - (with-imported-modules (source-module-closure '((genenetwork development-helper)) - #:select? import-module?) - #~(lambda (gn-auth-checkout) - ((@@ (genenetwork development-helper) - genenetwork-lint-gexp) - gn-auth-checkout - #$(profile - (content (manifest-cons* python-pylint shellcheck - (package->development-manifest gn-auth))) - (allow-collisions? #t)) - (list "main.py" "setup.py" "wsgi.py" "tests" "gn_auth" "scripts"))))) - (define %xapian-directory "/export/data/genenetwork-xapian") @@ -411,6 +382,9 @@ genenetwork3 source from the latest commit of @var{project}." (name 'gn-auth) (url (forge-project-repository this-forge-project)) (branch "main"))) + #:variables (list (variable-specification + (module '(gn-auth)) + (name 'gn-auth))) #:guix-daemon-uri %guix-daemon-uri)) ;; If unit tests pass, restart the auth server. (after (with-imported-modules '((guix build utils)) @@ -424,20 +398,15 @@ genenetwork3 source from the latest commit of @var{project}." (invoke #$(file-append laminar "/bin/laminarc") "queue" "genenetwork2")))))) (forge-laminar-job - (name "gn-auth-pylint") - (run (derivation-job-gexp - this-forge-project - this-forge-laminar-job - gn-auth-pylint - #:guix-daemon-uri %guix-daemon-uri))) - (forge-laminar-job - (name "gn-auth-mypy") - (run (derivation-job-gexp - this-forge-project - this-forge-laminar-job - (genenetwork3-tests (list "mypy" ".") - (manifest-cons python-mypy - (package->development-manifest gn-auth))) + (name "gn-auth-all-tests") + (run (guix-channel-job-gexp + (list (channel + (name 'gn-auth) + (url (forge-project-repository this-forge-project)) + (branch "main"))) + #:variables (list (variable-specification + (module '(gn-auth)) + (name 'gn-auth-all-tests))) #:guix-daemon-uri %guix-daemon-uri))))) (ci-jobs-trigger 'webhook))))) diff --git a/genenetwork/development-helper.scm b/genenetwork/development-helper.scm index 4e8c62b..7602eb0 100644 --- a/genenetwork/development-helper.scm +++ b/genenetwork/development-helper.scm @@ -64,40 +64,3 @@ items." (%lisp-type "sbcl")) (test-system #$system '#$asd-files #f)) (mkdir-p #$output))))) - -(define (genenetwork-lint-gexp source-repo-checkout profile files-and-modules) - "Return a G-expression that runs GeneNetwork3 lint tests in PROFILE -with SOURCE-REPO-CHECKOUT as the current directory. SOURCE-REPO-CHECKOUT -is a checkout of the genenetwork3 source code. PROFILE is a profile -with genenetwork3 dependencies." - (with-imported-modules '((guix build utils)) - (with-profile profile - #~(begin - (use-modules (rnrs exceptions) - (srfi srfi-26) - (ice-9 rdelim) - (guix build utils)) - - (define (shell-script? filename stat-obj) - (and (eq? (stat:type stat-obj) 'regular) - (call-with-input-file filename - (lambda (port) - (let ((first-line (read-line port))) - (and (not (eof-object? first-line)) - (> (string-length first-line) 2) - (string=? (string-take first-line 2) "#!") - (or (string-contains first-line "/bin/sh") - (string-contains first-line "/bin/bash")))))))) - - (chdir #$source-repo-checkout) - (guard (condition ((invoke-error? condition) - (format (current-error-port) - "`~a~{ ~a~}' failed with exit status ~a~%" - (invoke-error-program condition) - (invoke-error-arguments condition) - (invoke-error-exit-status condition)) - (exit #f))) - (for-each (cut invoke "shellcheck" <>) - (find-files "." shell-script?)) - (invoke "pylint" #$@files-and-modules)) - (mkdir-p #$output))))) -- cgit v1.2.3