Add build, lint Emacs steps to post-receive pipeline
TL;DR: - Define runEmacsScript to emacs/default.nix for ci/pipelines/post-receive - Write script.el to call (load init.el) and catch any errors - Lint Elisp with gonewest818/elisp-lint Also nice how Buildkite supports :gnu: emojis!
This commit is contained in:
		
							parent
							
								
									d67dbec7e8
								
							
						
					
					
						commit
						78172233f8
					
				
					 3 changed files with 75 additions and 1 deletions
				
			
		|  | @ -1,6 +1,16 @@ | ||||||
| { pkgs, ... }: | { briefcase, pkgs, ... }: | ||||||
| 
 | 
 | ||||||
| let | let | ||||||
|  |   elispLintSrc = builtins.fetchGit { | ||||||
|  |     url = "https://github.com/gonewest818/elisp-lint"; | ||||||
|  |     rev = "2b645266be8010a6a49c6d0ebf6a3ad5bd290ff4"; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   scriptEl = builtins.path { | ||||||
|  |     path = ./script.el; | ||||||
|  |     name = "script.el"; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|   pipeline.steps = [ |   pipeline.steps = [ | ||||||
|     { |     { | ||||||
|       key = "lint-secrets"; |       key = "lint-secrets"; | ||||||
|  | @ -13,6 +23,27 @@ let | ||||||
|       label = ":nix: build briefcase"; |       label = ":nix: build briefcase"; | ||||||
|       depends_on = "lint-secrets"; |       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"; |       key = "build-socrates"; | ||||||
|       command = '' |       command = '' | ||||||
|  |  | ||||||
							
								
								
									
										28
									
								
								ci/pipelines/script.el
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								ci/pipelines/script.el
									
										
									
									
									
										Normal file
									
								
							|  | @ -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)) | ||||||
|  | @ -148,6 +148,21 @@ let | ||||||
|       "$@" |       "$@" | ||||||
|   ''; |   ''; | ||||||
| in { | in { | ||||||
|  |   inherit initEl; | ||||||
|  | 
 | ||||||
|  |   # I need to start my Emacs from CI without the call to `--load ${initEl}`. | ||||||
|  |   runScript = script: pkgs.writeShellScript "run-emacs-script" '' | ||||||
|  |     export BRIEFCASE=$HOME/briefcase | ||||||
|  |     export PATH="${emacsBinPath}:$PATH" | ||||||
|  |     export EMACSLOADPATH="${wpcDir}:${vendorDir}:${wpcarrosEmacs.deps}/share/emacs/site-lisp" | ||||||
|  |     exec ${wpcarrosEmacs}/bin/emacs \ | ||||||
|  |       --no-site-file \ | ||||||
|  |       --no-site-lisp \ | ||||||
|  |       --no-init-file \ | ||||||
|  |       --script ${script} \ | ||||||
|  |       "$@" | ||||||
|  |   ''; | ||||||
|  | 
 | ||||||
|   # Use `nix-env -f '<briefcase>' emacs.glinux` to install `wpcarro-emacs` on |   # Use `nix-env -f '<briefcase>' emacs.glinux` to install `wpcarro-emacs` on | ||||||
|   # gLinux machines. This will ensure that X and GL linkage behaves as expected. |   # gLinux machines. This will ensure that X and GL linkage behaves as expected. | ||||||
|   glinux = withEmacsPath "/usr/bin/google-emacs"; |   glinux = withEmacsPath "/usr/bin/google-emacs"; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue