diff options
Diffstat (limited to 'guix-data-service/web/revision')
-rw-r--r-- | guix-data-service/web/revision/controller.scm | 38 | ||||
-rw-r--r-- | guix-data-service/web/revision/html.scm | 75 |
2 files changed, 113 insertions, 0 deletions
diff --git a/guix-data-service/web/revision/controller.scm b/guix-data-service/web/revision/controller.scm index b45076b..53ec03a 100644 --- a/guix-data-service/web/revision/controller.scm +++ b/guix-data-service/web/revision/controller.scm @@ -43,6 +43,7 @@ #:use-module (guix-data-service model lint-checker) #:use-module (guix-data-service model lint-warning) #:use-module (guix-data-service model guix-revision) + #:use-module (guix-data-service model system-test) #:use-module (guix-data-service model nar) #:use-module (guix-data-service web revision html) #:export (revision-controller @@ -215,6 +216,15 @@ (render-unknown-revision mime-types conn commit-hash))) + (('GET "revision" commit-hash "system-tests") + (if (guix-commit-exists? conn commit-hash) + (render-revision-system-tests mime-types + conn + commit-hash + #:path-base path) + (render-unknown-revision mime-types + conn + commit-hash))) (('GET "revision" commit-hash "package-reproducibility") (if (guix-commit-exists? conn commit-hash) (render-revision-package-reproduciblity mime-types @@ -340,6 +350,34 @@ #:header-text header-text) #:extra-headers http-headers-for-unchanging-content))))) +(define* (render-revision-system-tests mime-types + conn + commit-hash + #:key + (path-base "/revision/") + (header-text + `("Revision " (samp ,commit-hash))) + (header-link + (string-append "/revision/" commit-hash))) + (let ((system-tests + (select-system-tests-for-guix-revision conn commit-hash))) + (case (most-appropriate-mime-type + '(application/json text/html) + mime-types) + ((application/json) + (render-json + '())) ; TODO + (else + (render-html + #:sxml (view-revision-system-tests + commit-hash + system-tests + (git-repositories-containing-commit conn + commit-hash) + #:path-base path-base + #:header-text header-text + #:header-link header-link)))))) + (define* (render-revision-package-reproduciblity mime-types conn commit-hash diff --git a/guix-data-service/web/revision/html.scm b/guix-data-service/web/revision/html.scm index a4e3f3a..ce8fc76 100644 --- a/guix-data-service/web/revision/html.scm +++ b/guix-data-service/web/revision/html.scm @@ -35,6 +35,7 @@ view-revision-packages view-revision-derivations view-revision-derivation-outputs + view-revision-system-tests view-revision-builds view-revision-lint-warnings unknown-revision)) @@ -648,6 +649,80 @@ "Next page"))) '()))))) +(define* (view-revision-system-tests commit-hash + system-tests + git-repositories + #:key (path-base "/revision/") + header-text header-link) + (layout + #:body + `(,(header) + (div + (@ (class "container")) + (div + (@ (class "row")) + (div + (@ (class "col-sm-12")) + (h3 (a (@ (style "white-space: nowrap;") + (href ,header-link)) + ,@header-text)))) + (div + (@ (class "row")) + (div + (@ (class "col-md-12")) + (h1 "System tests") + (table + (@ (class "table")) + (thead + (tr + (th "Name") + (th "Description") + (th "Location") + (th "Derivation") + (th "Build status"))) + (tbody + ,@(map + (match-lambda + ((name description + file line column-number + derivation-file-name + builds) + `(tr + (td ,name) + (td + ,(stexi->shtml + (texi-fragment->stexi description))) + (td ,@(map + (match-lambda + ((id label url cgit-url-base) + (if + (and cgit-url-base + (not (string-null? cgit-url-base))) + `(a (@ (href + ,(string-append + cgit-url-base "tree/" + file "?id=" commit-hash + "#n" (number->string line)))) + ,file + " (line: " ,line + ", column: " ,column-number ")") + '()))) + git-repositories)) + (td (a (@ (href ,derivation-file-name)) + ,(display-store-item-short derivation-file-name))) + (td ,@(map + (lambda (build) + (let ((build-server-id + (assoc-ref build "build_server_id"))) + `(a (@ (href + ,(simple-format + #f "/build-server/~A/build?derivation_file_name=~A" + build-server-id + derivation-file-name))) + ,(build-status-alist->build-icon build)))) + (peek builds)))))) + system-tests))))))))) + (define* (view-revision-package-reproducibility revision-commit-hash output-consistency) (layout |