From a3328acdbb5e0c763689afe742cfb2c4e0e185af Mon Sep 17 00:00:00 2001 From: JenChieh Date: Wed, 10 Apr 2024 23:08:08 -0700 Subject: [PATCH 1/8] ci: Use Eask to test macos and windows --- .github/workflows/test.yml | 24 ++++++++++---- .gitignore | 3 ++ Eask | 54 ++++++++++++++++++++++++++++++ Makefile | 67 ++++++++------------------------------ evil-pkg.el | 6 ++-- 5 files changed, 92 insertions(+), 62 deletions(-) create mode 100644 Eask diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f381f074e..7f993e009 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,23 +2,35 @@ name: CI on: [push, pull_request] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} strategy: fail-fast: false matrix: - emacs_version: - - 25.3 + os: [ubuntu-latest, macos-latest, windows-latest] + emacs-version: - 26.3 - 27.2 - 28.2 - 29.3 - - snapshot + experimental: [false] + include: + - os: ubuntu-latest + emacs-version: snapshot + experimental: true + - os: macos-latest + emacs-version: snapshot + experimental: true steps: - - uses: purcell/setup-emacs@master + - uses: jcs090218/setup-emacs@master with: - version: ${{ matrix.emacs_version }} + version: ${{ matrix.emacs-version }} - uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index 02299d9b1..beb380924 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ typescript /doc/build/*/ !/doc/build/texinfo/evil.texi *.pyc + +/.eask +/dist diff --git a/Eask b/Eask new file mode 100644 index 000000000..96de92362 --- /dev/null +++ b/Eask @@ -0,0 +1,54 @@ +(package "evil" + "1.15.0" + "Extensible vi layer") + +(website-url "https://github.com/emacs-evil/evil") +(keywords "emulations") + +(package-file "evil.el") +(files "evil-*.el" '(:exclude "*-tests.el" "*-pkg.el")) + +(script "test" "echo \"Error: no test specified\" && exit 1") + +(source 'gnu) +(source 'melpa) + +(depends-on "emacs" "24.1") +(depends-on "cl-lib") +(depends-on "goto-chg") + +(setq network-security-level 'low) ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432 + +(eask-defcommand test + "Basic tests." + (require 'evil-tests) + (evil-tests-initialize nil nil)) + +(eask-defcommand terminal + "Load Evil in a terminal Emacs and run all tests." + (require 'evil-tests) + (evil-tests-initialize nil nil t)) + +(eask-defcommand profiler + "Run all tests with profiler." + (require 'evil-tests) + (evil-mode 1) + (evil-tests-initialize nil t)) + +(eask-defcommand indent + "Re-indent all Evil code." + (setq vc-handled-backends nil) + (dolist (file (eask-package-el-files)) (load file)) + (dolist (buffer (reverse (buffer-list))) + (when (buffer-file-name buffer) + (set-buffer buffer) + (message "Indenting %s" (current-buffer)) + (setq-default indent-tabs-mode nil) + (untabify (point-min) (point-max)) + (indent-region (point-min) (point-max)) + (delete-trailing-whitespace) + (untabify (point-min) (point-max)) + (goto-char (point-min)) + (while (re-search-forward "\\n\\\\{3,\\\\}" nil t) + (replace-match "\\n\\n")) + (when (buffer-modified-p) (save-buffer 0))))) diff --git a/Makefile b/Makefile index 2144a921b..c5621ac89 100644 --- a/Makefile +++ b/Makefile @@ -3,35 +3,20 @@ EMACS ?= emacs SED ?= sed FILES = $(filter-out evil-test-helpers.el evil-tests.el evil-pkg.el,$(wildcard evil*.el)) VERSION := $(shell $(SED) -ne '/define-package/,$$p' evil-pkg.el | $(SED) -ne '/^\s*"[[:digit:]]\+\(\.[[:digit:]]\+\)*"\s*$$/ s/^.*"\(.*\)".*$$/\1/p') -ELPAPKG = evil-$(VERSION) PROFILER = DOC = doc TAG = +EASK ?= eask ELCFILES = $(FILES:.el=.elc) -.PHONY: all compile compile-batch docstrings doc clean tests test emacs term terminal profiler indent elpa version +.PHONY: all compile docstrings doc clean tests test emacs term terminal profiler indent elpa version # Byte-compile Evil. all: compile -compile: $(ELCFILES) -.depend: $(FILES) - @echo Compute dependencies - @rm -f .depend - @for f in $(FILES); do \ - $(SED) -n "s/ *(require '\(evil-[^)]*\).*)/$${f}c: \1.elc/p" $$f >> .depend;\ - done - --include .depend - -$(ELCFILES): %.elc: %.el - $(EMACS) --batch -Q -L . -f batch-byte-compile $< - -# Byte-compile all files in one batch. This is faster than -# compiling each file in isolation, but also less stringent. -compile-batch: clean - $(EMACS) --batch -Q -L . -f batch-byte-compile ${FILES} +compile: + $(EASK) compile # Documentation. docstrings: @@ -45,25 +30,20 @@ info: doc # Delete byte-compiled files etc. clean: - rm -f *~ - rm -f \#*\# - rm -f *.elc - rm -f .depend - @$(MAKE) -C doc clean + $(EASK) clean all # Run tests. # The TAG variable may specify a test tag or a test name: # make test TAG=repeat # This will only run tests pertaining to the repeat system. test: - $(EMACS) -nw -Q --batch -L . -l evil-tests.el \ - --eval "(evil-tests-initialize '(${TAG}) '(${PROFILER}))" + $(EASK) run command test # Byte-compile Evil and run all tests. tests: compile - $(EMACS) -nw -Q -L . -l evil-tests.el \ - --eval "(evil-tests-initialize '(${TAG}) '(${PROFILER}))" - rm -f *.elc .depend + $(EASK) run command test + $(EASK) clean elc + rm -f .depend # Load Evil in a fresh instance of Emacs and run all tests. emacs: @@ -74,42 +54,21 @@ emacs: # Load Evil in a terminal Emacs and run all tests. term: terminal terminal: - $(EMACS) -nw -Q -L . -l evil-tests.el \ - --eval "(evil-mode 1)" \ - --eval "(evil-tests-initialize '(${TAG}) '(${PROFILER}) t)" + $(EASK) run command terminal # Run all tests with profiler. profiler: - $(EMACS) --batch -Q -L . -l evil-tests.el \ - --eval "(evil-tests-initialize '(${TAG}) (or '(${PROFILER}) t))" + $(EASK) run command profiler # Re-indent all Evil code. # Loads Evil into memory in order to indent macros properly. # Also removes trailing whitespace, tabs and extraneous blank lines. indent: clean - $(EMACS) --batch --eval '(setq vc-handled-backends nil)' ${FILES} evil-tests.el -Q -L . -l evil-tests.el \ - --eval "(dolist (buffer (reverse (buffer-list))) \ - (when (buffer-file-name buffer) \ - (set-buffer buffer) \ - (message \"Indenting %s\" (current-buffer)) \ - (setq-default indent-tabs-mode nil) \ - (untabify (point-min) (point-max)) \ - (indent-region (point-min) (point-max)) \ - (delete-trailing-whitespace) \ - (untabify (point-min) (point-max)) \ - (goto-char (point-min)) \ - (while (re-search-forward \"\\n\\\\{3,\\\\}\" nil t) \ - (replace-match \"\\n\\n\")) \ - (when (buffer-modified-p) (save-buffer 0))))" + $(EASK) run command indent # Create an ELPA package. elpa: - @echo "Creating ELPA package $(ELPAPKG).tar" - @rm -rf ${ELPAPKG} - @mkdir ${ELPAPKG} - @cp $(FILES) COPYING evil-pkg.el ${ELPAPKG} - @tar cf ${ELPAPKG}.tar ${ELPAPKG} - @rm -rf ${ELPAPKG} + $(EASK) package # Change the version using make VERSION=x.y.z version: diff --git a/evil-pkg.el b/evil-pkg.el index 0ab78cb33..8a170ae87 100644 --- a/evil-pkg.el +++ b/evil-pkg.el @@ -1,7 +1,9 @@ (define-package "evil" "1.15.0" - "Extensible Vi layer for Emacs." + "Extensible vi layer" '((emacs "24.1") (goto-chg "1.6") - (cl-lib "0.5"))) + (cl-lib "0.5")) + :url "https://github.com/emacs-evil/evil" + :keywords '("emulations")) From a35e4112ae025a64d8d884f40f7836a1f8c7673a Mon Sep 17 00:00:00 2001 From: JenChieh Date: Wed, 10 Apr 2024 23:12:03 -0700 Subject: [PATCH 2/8] ci: Install eask --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7f993e009..126cf9ffb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,6 +38,10 @@ jobs: run: | emacs --version + - uses: emacs-eask/setup-eask@master + with: + version: 'snapshot' + - name: Run tests run: | make test From e21b1989e823ca04d10f956ac4116d6831beb475 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Wed, 10 Apr 2024 23:29:24 -0700 Subject: [PATCH 3/8] ci: Fix jump file test --- evil-tests.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/evil-tests.el b/evil-tests.el index f22a6694a..3f88dc892 100644 --- a/evil-tests.el +++ b/evil-tests.el @@ -3318,7 +3318,7 @@ consectetur adipiscing elit sed do eiusmod tempor incididunt" ("\C-vje\"xy" "bye" "Vj" ":put! x" [return]) "Lorem ipsum dolor sit amet -dolor sit +dolor sit [a]dipiscing consectetur adipiscing elit sed do eiusmod tempor incididunt")) @@ -7496,7 +7496,7 @@ A much A medium line Tiny ln" ("jj\C-v" [end] "jd") - "Short + "Short A much A me[d] Tiny ")) @@ -9602,7 +9602,8 @@ parameter set." ("3\C-i") ;; even after jumping forward 3 times it can't get past the 3rd z "z z [z] z z z z z")) (ert-info ("Jump across files") - (let ((temp-file (make-temp-file "evil-test-"))) + (let ((temp-file "evil-test-")) + (make-temp-file temp-file) (unwind-protect (evil-test-buffer "[z] z z z z z z" From 27bb76ab3a358e472346c8a6f08a6cb2c3cc47a3 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Wed, 10 Apr 2024 23:33:45 -0700 Subject: [PATCH 4/8] revert spaces --- evil-tests.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/evil-tests.el b/evil-tests.el index 3f88dc892..98aa29e0d 100644 --- a/evil-tests.el +++ b/evil-tests.el @@ -3318,7 +3318,7 @@ consectetur adipiscing elit sed do eiusmod tempor incididunt" ("\C-vje\"xy" "bye" "Vj" ":put! x" [return]) "Lorem ipsum dolor sit amet -dolor sit +dolor sit [a]dipiscing consectetur adipiscing elit sed do eiusmod tempor incididunt")) @@ -7496,7 +7496,7 @@ A much A medium line Tiny ln" ("jj\C-v" [end] "jd") - "Short + "Short A much A me[d] Tiny ")) From f74cecfea6ca717538af7478aa0c4c32b50d4139 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Wed, 10 Apr 2024 23:52:16 -0700 Subject: [PATCH 5/8] ci: skip find-file test on windows --- evil-tests.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/evil-tests.el b/evil-tests.el index 98aa29e0d..2db409d4f 100644 --- a/evil-tests.el +++ b/evil-tests.el @@ -9602,8 +9602,8 @@ parameter set." ("3\C-i") ;; even after jumping forward 3 times it can't get past the 3rd z "z z [z] z z z z z")) (ert-info ("Jump across files") - (let ((temp-file "evil-test-")) - (make-temp-file temp-file) + (let ((temp-file (or (make-temp-file "evil-test-") + "evil-test-"))) (unwind-protect (evil-test-buffer "[z] z z z z z z" @@ -9620,6 +9620,8 @@ parameter set." (ert-deftest evil-test-find-file () :tags '(evil jumps) + (when (memq system-type '(cygwin windows-nt ms-dos)) + (ert-skip "[INFO] GitHub Actions has different userprofile name.")) (ert-info ("Find file at point (normal state)") (evil-with-temp-file file-name "" (evil-test-buffer From b56ea932eadc6749ebd9721877d229d2ad8d5dab Mon Sep 17 00:00:00 2001 From: JenChieh Date: Wed, 10 Apr 2024 23:54:26 -0700 Subject: [PATCH 6/8] ci: Revert original test for windows --- evil-tests.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/evil-tests.el b/evil-tests.el index 2db409d4f..a58a2c665 100644 --- a/evil-tests.el +++ b/evil-tests.el @@ -9602,8 +9602,8 @@ parameter set." ("3\C-i") ;; even after jumping forward 3 times it can't get past the 3rd z "z z [z] z z z z z")) (ert-info ("Jump across files") - (let ((temp-file (or (make-temp-file "evil-test-") - "evil-test-"))) + (let ((temp-file "evil-test-")) + (make-temp-file "evil-test-") (unwind-protect (evil-test-buffer "[z] z z z z z z" From 4eec8d2665f5445278f6cf9f30f76cf4dba21955 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Mon, 15 Apr 2024 00:23:00 -0700 Subject: [PATCH 7/8] Delete Cask file --- Cask | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 Cask diff --git a/Cask b/Cask deleted file mode 100644 index faf23383b..000000000 --- a/Cask +++ /dev/null @@ -1,5 +0,0 @@ -(package "evil" "1.15.0" "Extensible Vi layer for Emacs.") - -(files "*.el") - -;; (depends-on "goto-chg" "0.6.3") From 4c9e9901ad5fbae5b3d3e68e1dd4557310d0bf54 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Thu, 30 May 2024 14:57:02 -0700 Subject: [PATCH 8/8] ci: Exclude tests on macos below 28.x --- .github/workflows/test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 126cf9ffb..55bddaedb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,6 +27,12 @@ jobs: - os: macos-latest emacs-version: snapshot experimental: true + exclude: + - os: macos-latest + emacs-version: 26.3 + - os: macos-latest + emacs-version: 27.2 + steps: - uses: jcs090218/setup-emacs@master with: