Skip to content

Commit

Permalink
Use Eldev (#669)
Browse files Browse the repository at this point in the history
Closes #666
  • Loading branch information
p4v4n authored Nov 5, 2023
1 parent 525fc1b commit 481ca48
Show file tree
Hide file tree
Showing 13 changed files with 162 additions and 160 deletions.
151 changes: 113 additions & 38 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,131 @@
version: 2.1

# Default actions to perform on each Emacs version
default: &default-steps
steps:
- checkout
- run: apt-get update && apt-get install make
- run: make elpa
- run: emacs --version
- run: make test
# Make sure to run test-checks before test-bytecomp, as test-bytecomp autogenerates
# files which won't pass test-checks.
- run: make test-checks
- run: make test-bytecomp
orbs:
win: circleci/[email protected]

commands:
setup:
steps:
- checkout
- run:
name: Install Eldev
command: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/circle-eldev > x.sh && source ./x.sh

setup-macos:
steps:
- checkout
- run:
name: Install Emacs latest
command: |
brew install homebrew/cask/emacs
- run:
name: Install Eldev
command: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/circle-eldev > x.sh && source ./x.sh

setup-windows:
steps:
- checkout
- run:
name: Install Eldev
command: |
# Remove expired DST Root CA X3 certificate. Workaround
# for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51038
# bug on Emacs 27.2.
gci cert:\LocalMachine\Root\DAC9024F54D8F6DF94935FB1732638CA6AD77C13
gci cert:\LocalMachine\Root\DAC9024F54D8F6DF94935FB1732638CA6AD77C13 | Remove-Item
(iwr https://raw.github.com/doublep/eldev/master/webinstall/circle-eldev.ps1).Content | powershell -command -
test:
steps:
- run:
name: Run regression tests
command: eldev -dtT -p test
lint:
steps:
- run:
name: Lint
command: eldev lint -c
compile:
steps:
- run:
name: Check for byte-compilation errors
command: eldev -dtT compile --warnings-as-errors

# Enumerated list of Emacs versions
jobs:
test-emacs-25:
test-ubuntu-emacs-26:
docker:
- image: silex/emacs:25-ci-cask
- image: silex/emacs:26-ci
entrypoint: bash
<<: *default-steps

test-emacs-26:
steps:
- setup
- test
- lint
- compile
test-ubuntu-emacs-27:
docker:
- image: silex/emacs:26-ci-cask
- image: silex/emacs:27-ci
entrypoint: bash
<<: *default-steps

test-emacs-27:
steps:
- setup
- test
- lint
- compile
test-ubuntu-emacs-28:
docker:
- image: silex/emacs:27-ci-cask
- image: silex/emacs:28-ci
entrypoint: bash
<<: *default-steps

test-emacs-28:
steps:
- setup
- test
- lint
- compile
test-ubuntu-emacs-29:
docker:
- image: silex/emacs:28-ci-cask
- image: silex/emacs:29-ci
entrypoint: bash
<<: *default-steps

test-emacs-master:
steps:
- setup
- test
- lint
- compile
test-ubuntu-emacs-master:
docker:
- image: silex/emacs:master-ci-cask
- image: silex/emacs:master-ci
entrypoint: bash
<<: *default-steps
steps:
- setup
- test
- lint
- compile
test-macos-emacs-latest:
macos:
xcode: "14.2.0"
steps:
- setup-macos
- test
- lint
- compile
test-windows-emacs-latest:
executor: win/default
steps:
- run:
name: Install Emacs latest
command: |
choco install emacs
- setup-windows
- test
- lint
- compile

workflows:
version: 2
version: 2.1
ci-test-matrix:
jobs:
- test-emacs-25
- test-emacs-26
- test-emacs-27
- test-emacs-28
- test-emacs-master
- test-ubuntu-emacs-26
- test-ubuntu-emacs-27
- test-ubuntu-emacs-28
- test-ubuntu-emacs-29
- test-ubuntu-emacs-master
- test-windows-emacs-latest
- test-macos-emacs-latest:
requires:
- test-ubuntu-emacs-29
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
elpa*
/clojure-mode-autoloads.el
/clojure-mode-pkg.el

/.eldev
/Eldev-local
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ and description in grammatically correct, complete sentences.
## Development setup

1. Fork and clone the repository.
1. Install [Cask][7].
1. Run `cask install` in the repository folder.
1. Install [Eldev][7].
1. Run `eldev build` in the repository folder.
1. Run tests with `make test`.

**Note:** macOS users should make sure that the `emacs` command resolves the version of Emacs they've installed
Expand All @@ -53,5 +53,5 @@ See [this article][8] for more details.
[4]: https://help.github.com/articles/using-pull-requests
[5]: https://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
[6]: https://github.com/clojure-emacs/clojure-mode/blob/master/CHANGELOG.md
[7]: https://github.com/cask/cask
[7]: https://github.com/emacs-eldev/eldev
[8]: https://emacsredux.com/blog/2015/05/09/emacs-on-os-x/
9 changes: 0 additions & 9 deletions Cask

This file was deleted.

26 changes: 26 additions & 0 deletions Eldev
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
; -*- mode: emacs-lisp; lexical-binding: t -*-

(eldev-require-version "1.6")

(eldev-use-package-archive 'gnu-elpa)
(eldev-use-package-archive 'nongnu-elpa)
(eldev-use-package-archive 'melpa)

(eldev-use-plugin 'autoloads)

(eldev-add-extra-dependencies 'test 'paredit 's 'buttercup)

(setq byte-compile-docstring-max-column 240)
(setq checkdoc-force-docstrings-flag nil)
(setq checkdoc-permit-comma-termination-flag t)
(setq checkdoc--interactive-docstring-flag nil)

(setf eldev-lint-default '(elisp))

(with-eval-after-load 'elisp-lint
;; We will byte-compile with Eldev.
(setf elisp-lint-ignored-validators '("package-lint" "fill-column" "byte-compile" "checkdoc")
enable-local-variables :safe
elisp-lint-indent-specs '((define-clojure-indent . 0))))

(setq eldev-project-main-file "clojure-mode.el")
47 changes: 11 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,42 +1,17 @@
CASK = cask
export EMACS ?= emacs
EMACSFLAGS =

PKGDIR := $(shell EMACS=$(EMACS) $(CASK) package-directory)

SRCS = $(wildcard *.el)
OBJS = $(SRCS:.el=.elc)

.PHONY: compile test clean elpa

all: compile

elpa-$(EMACS):
$(CASK) install
$(CASK) update
touch $@

elpa: elpa-$(EMACS)

elpaclean:
rm -f elpa*
rm -rf .cask # Clean packages installed for development

compile: elpa
$(CASK) build
.PHONY: clean compile lint test all
.DEFAULT_GOAL := all

clean:
rm -f $(OBJS) clojure-mode-autoloads.el
eldev clean

test: $(PKGDIR)
$(CASK) exec buttercup
lint: clean
eldev lint -c

test-checks:
$(CASK) exec $(EMACS) --no-site-file --no-site-lisp --batch \
-l test/test-checks.el ./
# Checks for byte-compilation warnings.
compile: clean
eldev -dtT compile --warnings-as-errors

test-bytecomp: $(SRCS:.el=.elc-test)
test: clean
eldev -dtT -p test

%.elc-test: %.el elpa
$(CASK) exec $(EMACS) --no-site-file --no-site-lisp --batch \
-l test/clojure-mode-bytecomp-warnings.el $<
all: clean compile lint test
4 changes: 2 additions & 2 deletions clojure-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -3129,7 +3129,7 @@ Assumes cursor is at beginning of function."
"Add an arity to a function.
Assumes cursor is at beginning of function."
(let ((beg-line (what-line))
(let ((beg-line (line-number-at-pos))
(end (save-excursion (forward-sexp)
(point))))
(down-list 2)
Expand All @@ -3141,7 +3141,7 @@ Assumes cursor is at beginning of function."
(insert "[")
(save-excursion (insert "])\n(")))
((looking-back "\\[" 1) ;; single-arity fn
(let* ((same-line (string= beg-line (what-line)))
(let* ((same-line (= beg-line (line-number-at-pos)))
(new-arity-text (concat (when same-line "\n") "([")))
(save-excursion
(goto-char end)
Expand Down
40 changes: 0 additions & 40 deletions test/clojure-mode-bytecomp-warnings.el

This file was deleted.

1 change: 1 addition & 0 deletions test/clojure-mode-convert-collection-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

(require 'clojure-mode)
(require 'buttercup)
(require 'test-helper "test/utils/test-helper")

(describe "clojure-convert-collection-to-map"
(when-refactoring-it "should convert a list to a map"
Expand Down
1 change: 1 addition & 0 deletions test/clojure-mode-refactor-add-arity-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

(require 'clojure-mode)
(require 'buttercup)
(require 'test-helper "test/utils/test-helper")

(describe "clojure-add-arity"

Expand Down
2 changes: 1 addition & 1 deletion test/clojure-mode-util-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
(bb-edn-src (expand-file-name "src" temp-dir)))
(write-region "{}" nil bb-edn)
(make-directory bb-edn-src)
(expect (clojure-project-dir bb-edn-src)
(expect (expand-file-name (clojure-project-dir bb-edn-src))
:to-equal (file-name-as-directory temp-dir))))))

(describe "clojure-project-relative-path"
Expand Down
Loading

0 comments on commit 481ca48

Please sign in to comment.