about summary refs log tree commit diff
path: root/ci
diff options
context:
space:
mode:
Diffstat (limited to 'ci')
-rw-r--r--ci/pipelines/post-receive.nix33
-rw-r--r--ci/pipelines/script.el28
2 files changed, 60 insertions, 1 deletions
diff --git a/ci/pipelines/post-receive.nix b/ci/pipelines/post-receive.nix
index 3f14dfade557..d41c3b67b328 100644
--- a/ci/pipelines/post-receive.nix
+++ b/ci/pipelines/post-receive.nix
@@ -1,6 +1,16 @@
-{ pkgs, ... }:
+{ briefcase, pkgs, ... }:
 
 let
+  elispLintSrc = builtins.fetchGit {
+    url = "https://github.com/gonewest818/elisp-lint";
+    rev = "2b645266be8010a6a49c6d0ebf6a3ad5bd290ff4";
+  };
+
+  scriptEl = builtins.path {
+    path = ./script.el;
+    name = "script.el";
+  };
+
   pipeline.steps = [
     {
       key = "lint-secrets";
@@ -14,6 +24,27 @@ let
       depends_on = "lint-secrets";
     }
     {
+      key = "init-emacs";
+      command = ''
+        ${briefcase.emacs.runScript scriptEl} ${briefcase.emacs.initEl}
+      '';
+      label = ":gnu: initialize Emacs";
+      depends_on = "build-briefcase";
+    }
+    {
+      key = "lint-emacs";
+      command = ''
+        ${briefcase.emacs.nixos}/bin/wpcarros-emacs \
+          --quick \
+          --batch \
+          --load ${elispLintSrc}/elisp-lint.el \
+          --funcall elisp-lint-files-batch \
+          "$@"
+      '';
+      label = ":gnu: lint Emacs";
+      depends_on = "init-emacs";
+    }
+    {
       key = "build-socrates";
       command = ''
         nix-build '<nixpkgs/nixos>' \
diff --git a/ci/pipelines/script.el b/ci/pipelines/script.el
new file mode 100644
index 000000000000..45b5ea688500
--- /dev/null
+++ b/ci/pipelines/script.el
@@ -0,0 +1,28 @@
+;; This script initializes Emacs and exits with either a zero or non-zero status
+;; depending on whether or not Emacs initialized without logging warnings or
+;; encountering errors.
+;;
+;; This script reads the location of init.el as the last argument in `argv'.
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Dependencies
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(require 'dash)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Script
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(condition-case err
+    (load (-last-item argv))
+  (error
+   (message "Encountered an error while attempting to load init.el: %s" err)
+   (kill-emacs 1)))
+
+(if (bufferp "*Warnings*")
+    (progn
+      (with-current-buffer "*Warnings*"
+        (message "Encountered warnings in *Warnings* buffer: %s" (buffer-string)))
+      (kill-emacs 1))
+  (kill-emacs 0))