diff options
author | Frederick Muriuki Muriithi | 2023-08-14 11:43:17 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-09-16 06:38:01 +0300 |
commit | 64d81df4ce47a8977b37baf1a68ca983c2dd99a1 (patch) | |
tree | cd1b2bce386359d69a7821cd169490db0d4d8dd2 /genenetwork | |
parent | 006852e5a6c14531d3462625814941e14b4597c6 (diff) | |
download | gn-machines-64d81df4ce47a8977b37baf1a68ca983c2dd99a1.tar.gz |
Add CI/CD definitions for gn-auth
Diffstat (limited to 'genenetwork')
-rw-r--r-- | genenetwork/development-helper.scm | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/genenetwork/development-helper.scm b/genenetwork/development-helper.scm index 81bfc3b..627a80a 100644 --- a/genenetwork/development-helper.scm +++ b/genenetwork/development-helper.scm @@ -101,3 +101,40 @@ with genenetwork3 dependencies." (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 +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))))) |