Skip to content

Commit

Permalink
compile is part of CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen Bin committed May 26, 2022
1 parent 116b976 commit 38ebbc2
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
SHELL = /bin/sh
EMACS ?= emacs
PROFILER =
EMACS_BATCH_OPTS=--batch -Q -l find-file-in-project.el
RM = @rm -rf

.PHONY: test
.PHONY: test clean test compile

# Delete byte-compiled files etc.
clean:
rm -f *~
rm -f \#*\#
rm -f *.elc
$(RM) *~
$(RM) \#*\#
$(RM) *.elc

compile: clean
@$(EMACS) $(EMACS_BATCH_OPTS) -l tests/my-byte-compile.el 2>&1 | grep -E "([Ee]rror|[Ww]arning):" && exit 1 || exit 0

# Run tests.
test: clean
! $(EMACS) -Q -batch -l find-file-in-project.el --eval "(byte-compile-file \"find-file-in-project.el\")" 2>&1 | grep "Warning: the function"
$(EMACS) -Q -batch -l ert -l find-file-in-project.el -l tests/ffip-tests.el
test: compile
@$(EMACS) $(EMACS_BATCH_OPTS) -l tests/ffip-tests.el
43 changes: 43 additions & 0 deletions tests/my-byte-compile.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
;;; my-elint.el --- syntax check the code -*- lexical-binding: t -*-

;; Copyright (C) 2022 Chen Bin
;;
;; Author: Chen Bin <chenbin.sh@gmail.com>

;; This file is NOT part of GNU Emacs.

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <https://www.gnu.org/licenses/>.

;;; Commentary:
;; Syntax check the code. It's used in Emacs cli.
;;

;;; Code:

(require 'find-lisp)

(let ((files (find-lisp-find-files-internal
"."
(lambda (file dir)
(and (not (file-directory-p (expand-file-name file dir)))
(string-match "\\.el$" file)
(not (string-match "\\.dir-locals\\.el" file))))
(lambda (dir parent)
(not (or (member dir '("." ".." ".git" ".svn" "deps" "tests"))
(file-symlink-p (expand-file-name dir parent))))))))
(dolist (file files)
(byte-compile-file file)))

(provide 'my-byte-compile)
;;; my-elint.el ends here

0 comments on commit 38ebbc2

Please sign in to comment.