From fb813b043bcdde9df80128c29cf45cc3987c9d09 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 19 Dec 2023 21:01:21 +0000 Subject: Use guix-channel-job-gexp for genenetwork3 pylint and mypy CI jobs. * genenetwork-development.scm (genenetwork3-mypy, genenetwork3-pylint): Delete variables. (genenetwork-projects): Build only genenetwork3 variable in genenetwork3 CI job. Combine genenetwork3-mypy and genenetwork3-pylint CI jobs into a genenetwork3-all-tests job that uses guix-channel-job-gexp. * genenetwork/development-helper.scm (genenetwork3-lint-gexp): Delete function. --- genenetwork-development.scm | 41 +++++++++++--------------------------- genenetwork/development-helper.scm | 39 +----------------------------------- 2 files changed, 13 insertions(+), 67 deletions(-) diff --git a/genenetwork-development.scm b/genenetwork-development.scm index c219c5c..fe2392b 100644 --- a/genenetwork-development.scm +++ b/genenetwork-development.scm @@ -223,23 +223,6 @@ command to be executed." (allow-collisions? #t)) '#$tests-command)))) -(define genenetwork3-pylint - (with-imported-modules (source-module-closure '((genenetwork development-helper)) - #:select? import-module?) - #~(lambda (genenetwork3-checkout) - ((@@ (genenetwork development-helper) - genenetwork3-lint-gexp) - genenetwork3-checkout - #$(profile - (content (manifest-cons* python-pylint shellcheck - (package->development-manifest genenetwork3))) - (allow-collisions? #t)))))) - -(define genenetwork3-mypy - (genenetwork3-tests (list "mypy" ".") - (manifest-cons python-mypy - (package->development-manifest genenetwork3)))) - (define gn-auth-pylint (with-imported-modules (source-module-closure '((genenetwork development-helper)) #:select? import-module?) @@ -386,6 +369,9 @@ genenetwork3 source from the latest commit of @var{project}." (name 'genenetwork3) (url (forge-project-repository this-forge-project)) (branch "main"))) + #:variables (list (variable-specification + (module '(genenetwork3-package)) + (name 'genenetwork3))) #:guix-daemon-uri %guix-daemon-uri)) ;; If tests run successfully, redeploy ;; genenetwork3 and trigger genenetwork2 tests. @@ -400,18 +386,15 @@ genenetwork3 source from the latest commit of @var{project}." (invoke #$(file-append laminar "/bin/laminarc") "queue" "genenetwork2")))))) (forge-laminar-job - (name "genenetwork3-pylint") - (run (derivation-job-gexp - this-forge-project - this-forge-laminar-job - genenetwork3-pylint - #:guix-daemon-uri %guix-daemon-uri))) - (forge-laminar-job - (name "genenetwork3-mypy") - (run (derivation-job-gexp - this-forge-project - this-forge-laminar-job - genenetwork3-mypy + (name "genenetwork3-all-tests") + (run (guix-channel-job-gexp + (list (channel + (name 'genenetwork3) + (url (forge-project-repository this-forge-project)) + (branch "main"))) + #:variables (list (variable-specification + (module '(genenetwork3-package)) + (name 'genenetwork3-all-tests))) #:guix-daemon-uri %guix-daemon-uri))) (forge-laminar-job (name "genenetwork3-build-xapian-index") diff --git a/genenetwork/development-helper.scm b/genenetwork/development-helper.scm index 627a80a..4e8c62b 100644 --- a/genenetwork/development-helper.scm +++ b/genenetwork/development-helper.scm @@ -1,5 +1,5 @@ ;;; genenetwork-machines --- Guix configuration for genenetwork machines -;;; Copyright © 2022 Arun Isaac +;;; Copyright © 2022, 2023 Arun Isaac ;;; Copyright © 2022 Frederick Muriuki Muriithi ;;; ;;; This file is part of genenetwork-machines. @@ -65,43 +65,6 @@ items." (test-system #$system '#$asd-files #f)) (mkdir-p #$output))))) -(define (genenetwork3-lint-gexp genenetwork3-source profile) - "Return a G-expression that runs GeneNetwork3 lint tests in PROFILE -with GENENETWORK3-SOURCE as the current directory. GENENETWORK3-SOURCE -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 #$genenetwork3-source) - (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" "main.py" "setup.py" "wsgi.py" "setup_commands" "tests" "gn3" "scripts" "sheepdog")) - (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 -- cgit v1.2.3