Skip to content

Commit c3281c3

Browse files
committed
Make the CI setup closer to that of clojure-mode
1 parent 7ff6c8f commit c3281c3

File tree

4 files changed

+117
-1
lines changed

4 files changed

+117
-1
lines changed

.circleci/config.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ default: &default-steps
77
- run: apt-get update && apt-get install make
88
- run: make elpa
99
- run: emacs --version
10-
- run: ./run-tests-ci.sh
10+
- run: make test
11+
# Make sure to run test-checks before test-bytecomp, as test-bytecomp autogenerates
12+
# files which won't pass test-checks.
13+
- run: make test-checks
14+
- run: make test-bytecomp
1115

1216
# Enumerated list of Emacs versions
1317
jobs:

Makefile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
CASK = cask
2+
export EMACS ?= emacs
3+
EMACSFLAGS =
4+
5+
PKGDIR := $(shell EMACS=$(EMACS) $(CASK) package-directory)
6+
7+
SRCS = $(wildcard *.el)
8+
OBJS = $(SRCS:.el=.elc)
9+
10+
.PHONY: compile test clean elpa
11+
12+
all: compile
13+
14+
elpa-$(EMACS):
15+
$(CASK) install
16+
$(CASK) update
17+
touch $@
18+
19+
elpa: elpa-$(EMACS)
20+
21+
elpaclean:
22+
rm -f elpa*
23+
rm -rf .cask # Clean packages installed for development
24+
25+
compile: elpa
26+
$(CASK) build
27+
28+
clean:
29+
rm -f $(OBJS)
30+
31+
test: $(PKGDIR)
32+
$(CASK) ecukes "$@" --no-win
33+
34+
test-checks:
35+
$(CASK) exec $(EMACS) --no-site-file --no-site-lisp --batch \
36+
-l test/test-checks.el ./
37+
38+
test-bytecomp: $(SRCS:.el=.elc-test)
39+
40+
%.elc-test: %.el elpa
41+
$(CASK) exec $(EMACS) --no-site-file --no-site-lisp --batch \
42+
-l test/clojure-mode-bytecomp-warnings.el $
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
;;; clj-refactor-bytecomp-warnings.el --- Check for byte-compilation problems
2+
3+
;; Copyright © 2012-2020 Bozhidar Batsov and contributors
4+
;;
5+
;; This program is free software: you can redistribute it and/or modify
6+
;; it under the terms of the GNU General Public License as published by
7+
;; the Free Software Foundation, either version 3 of the License, or
8+
;; (at your option) any later version.
9+
10+
;; This program is distributed in the hope that it will be useful,
11+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
;; GNU General Public License for more details.
14+
15+
;; You should have received a copy of the GNU General Public License
16+
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
18+
;; This file is not part of GNU Emacs.
19+
20+
;;; Commentary:
21+
22+
;; This is a script to be loaded while visiting a `clj-refactor' source file.
23+
;; It will prepare all requirements and then byte-compile the file and signal an
24+
;; error on any warning. For example:
25+
;;
26+
;; emacs -Q --batch -l test/clj-refactor-bytecomp-warnings.el clj-refactor.el
27+
28+
;; This assumes that all `clj-refactor' dependencies are already on the package
29+
;; dir (probably from running `cask install').
30+
31+
(setq load-prefer-newer t)
32+
(add-to-list 'load-path (expand-file-name "./"))
33+
(require 'package)
34+
(package-generate-autoloads 'clj-refactor default-directory)
35+
(package-initialize)
36+
(load-file "clj-refactor-autoloads.el")
37+
(setq byte-compile-error-on-warn t)
38+
(batch-byte-compile)
39+
40+
;;; clj-refactor-bytecomp-warnings.el ends here

test/test-checks.el

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
;; This is a script to be loaded from the root `clj-refactor' directory. It will
2+
;; prepare all requirements and then run `check-declare-directory' on
3+
;; `default-directory'. For example: emacs -Q --batch -l test/test-checkdoc.el
4+
5+
;; This assumes that all `clj-refactor' dependencies are already on the package
6+
;; dir (probably from running `cask install').
7+
8+
(add-to-list 'load-path (expand-file-name "./"))
9+
(require 'package)
10+
(require 'check-declare)
11+
(package-initialize)
12+
13+
;; disable some annoying (or non-applicable) checkdoc checks
14+
(setq checkdoc-package-keywords-flag nil)
15+
(setq checkdoc-arguments-in-order-flag nil)
16+
(setq checkdoc-verb-check-experimental-flag nil)
17+
18+
(let ((files (directory-files default-directory t
19+
"\\`[^.].*\\.el\\'" t)))
20+
21+
;; `checkdoc-file' was introduced in Emacs 25
22+
(when (fboundp 'checkdoc-file)
23+
(dolist (file files)
24+
(checkdoc-file file))
25+
(when (get-buffer "*Warnings*")
26+
(message "Failing due to checkdoc warnings...")
27+
(kill-emacs 1)))
28+
29+
(when (apply #'check-declare-files files)
30+
(kill-emacs 1)))

0 commit comments

Comments
 (0)