[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/graphql 8d45c98e9f 24/56: Run tests on Travis
From: |
ELPA Syncer |
Subject: |
[elpa] externals/graphql 8d45c98e9f 24/56: Run tests on Travis |
Date: |
Sat, 29 Oct 2022 13:57:54 -0400 (EDT) |
branch: externals/graphql
commit 8d45c98e9f396626a6fa5d00811b70905bd1f933
Author: Sean Allred <code@seanallred.com>
Commit: Sean Allred <code@seanallred.com>
Run tests on Travis
---
.gitignore | 1 +
.travis.yml | 21 ++++++++++
Makefile | 24 +++++++++++
test/make.el | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 181 insertions(+)
diff --git a/.gitignore b/.gitignore
index 28f0a7dc05..9d0a57f4f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
.cask/
+.elpa/
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000000..5171b30fc1
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,21 @@
+language: emacs-lisp
+sudo: false
+cache:
+- directories:
+ - "$HOME/emacs"
+matrix:
+ fast_finish: true
+ allow_failures:
+ - env: EMACS_VERSION=snapshot
+env:
+ matrix:
+ - EMACS_VERSION=25.1
+ - EMACS_VERSION=25.2
+ - EMACS_VERSION=25.3
+ - EMACS_VERSION=snapshot
+before_install:
+- make CI-setup
+install:
+- make install
+script:
+- make test
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000..e8bb6507a1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,24 @@
+EENVS := PACKAGE_FILE="graphql.el" PACKAGE_DEV_DEPS="" PACKAGE_SOURCES="gnu"
+EMAKE := $(EENVS) emacs -batch -l test/make.el --eval "(make (pop argv))"
+
+.PHONY: clean install compile test CI-setup
+
+clean:
+ rm -f *.elc
+ rm -rf .elpa/
+
+install: .elpa/
+.elpa/:
+ $(EMAKE) update
+
+compile: clean
+ $(EMAKE) compile
+
+test:
+ $(EMAKE) test
+
+CI-setup:
+ export PATH="$(HOME)/bin:$(PATH)"
+ wget
'https://raw.githubusercontent.com/flycheck/emacs-travis/master/emacs-travis.mk'
+ make -f emacs-travis.mk install_emacs
+ emacs --version
diff --git a/test/make.el b/test/make.el
new file mode 100644
index 0000000000..b7f7737efa
--- /dev/null
+++ b/test/make.el
@@ -0,0 +1,135 @@
+;;; Emacs-Make -- simple, transparent functionality for automated elisp testing
+;;; Based on
http://edkolev.github.io/posts/2017-09-10-travis-for-emacs-packages.html
+
+;;; Basic support for Caskfile syntax; override with environment variables:
+
+;; PACKAGE_FILE := the root file of your package
+;; PACKAGE_DEV_DEPS := list of development-environment dependencies separated
by spaces
+;; PACKAGE_SOURCES := list of package dependencies separated by spaces
+
+;;; You can debug emacs-make by setting the environment variable DEBUG.
+
+(setq debug-on-error (getenv "DEBUG"))
+
+(require 'package)
+(require 'subr-x)
+
+(defun make-get-directive-in-caskfile (directive &optional get-all)
+ "Get DIRECTIVE from the caskfile if it exists.
+If GET-ALL is non-nil, all instances of DIRECTIVE are collected
+into a list."
+ (let ((caskfile "Cask") expr found)
+ (when-let ((caskdir (locate-dominating-file default-directory caskfile))
+ (caskfile (expand-file-name caskfile caskdir)))
+ (with-temp-buffer
+ (insert-file-contents-literally caskfile)
+ (ignore-errors ; may not be able to find DIRECTIVE; don't let `read'
error out
+ (while (not (or (eobp) found))
+ (let ((e (read (current-buffer))))
+ (when (eq directive (car-safe e))
+ (if get-all
+ (push e expr)
+ (setq expr e
+ found t)))))))
+ (cond
+ (get-all expr)
+ (found (cdr-safe expr))))))
+
+(defconst make-package-file
+ (or (getenv "PACKAGE_FILE")
+ (car-safe (make-get-directive-in-caskfile 'package-file))
+ (error "No PACKAGE_FILE and no Caskfile found."))
+ "Main package file.")
+(defconst make-project-root
+ (locate-dominating-file default-directory make-package-file)
+ "Root directory of the project.")
+(defconst make-package-archives
+ (or (when-let ((deps (getenv "PACKAGE_SOURCES")))
+ (thread-last (split-string deps nil t)
+ (mapcar #'downcase)
+ (mapcar #'intern)))
+ (mapcar (lambda (source) (pcase source (`(source ,src) src)))
+ (make-get-directive-in-caskfile 'source t))
+ '(gnu))
+ "List of sources (symbols) to use.")
+(defconst make-dev-deps
+ (or (when-let ((deps (getenv "PACKAGE_DEV_DEPS")))
+ (thread-last (split-string deps nil t)
+ (mapcar #'downcase)
+ (mapcar #'intern)))
+ (mapcar (lambda (dep) (pcase dep (`(depends-on ,package) (intern
package))))
+ (make-get-directive-in-caskfile 'development)))
+ "List of package-symbols that are development dependencies.")
+
+(defconst make-package-archive-master-alist
+ '(("melpa" . "http://melpa.org/packages/")
+ ("gnu" . "http://elpa.gnu.org/packages/")))
+
+(defvar make-package-desc
+ (with-temp-buffer
+ (insert-file-contents-literally (expand-file-name make-package-file
make-project-root))
+ (package-buffer-info))
+ "A package-desc object for the current package.")
+
+(defun make (target)
+ "Run `make-TARGET' if bound."
+ (let ((fun (intern (format "make-%s" target))))
+ (unless (fboundp fun)
+ (error "%S target not found" target))
+ (message "Project file detected as: %S" make-package-file)
+ (message "Development dependencies detected as: %S" make-dev-deps)
+ (message "Running target %S with %S\n" target fun)
+ (funcall fun)))
+
+(defun make-test ()
+ "Run all tests in \"PACKAGE-NAME-test.el\"."
+ (let* ((project-tests-file (format "%S-test.el" (package-desc-name
make-package-desc)))
+ (project-tests-path (format "%s/test/" make-project-root)))
+
+ ;; add the package being tested to `load-path' so it can be required
+ (add-to-list 'load-path make-project-root)
+ (add-to-list 'load-path project-tests-path)
+
+ ;; load the file with tests
+ (load (expand-file-name project-tests-file project-tests-path) nil t)
+
+ ;; run the tests
+ (ert-run-tests-batch-and-exit)))
+
+(defun make-update ()
+ "Update required packages.
+Required packages include those that `make-package-file' lists as
+dependencies and those in `make-dev-deps'."
+ (let ((pkglist (append
+ make-dev-deps
+ (thread-last make-package-desc
+ (package-desc-reqs)
+ (mapcar #'car)
+ (delq 'emacs))))
+ (package-user-dir (expand-file-name (format ".elpa/%s/elpa"
emacs-version)))
+ (package-archives
+ (let (l)
+ (dolist (pair make-package-archive-master-alist)
+ (when (memq (intern (car pair)) make-package-archives)
+ (push pair l)))
+ l)))
+
+ (message "installing in %s..." package-user-dir)
+ (package-initialize)
+ (package-refresh-contents)
+
+ ;; install dependencies
+ (dolist (package pkglist)
+ (unless (package-installed-p package)
+ (ignore-errors
+ (package-install package))))
+
+ ;; upgrade dependencies
+ (save-window-excursion
+ (package-list-packages t)
+ (condition-case _
+ (progn
+ (package-menu-mark-upgrades)
+ (package-menu-execute t))
+ (error
+ (message "All packages up to date"))))))
- [elpa] externals/graphql df311b3e31 42/56: Remove '$' from planned features; it is implemented in README, (continued)
- [elpa] externals/graphql df311b3e31 42/56: Remove '$' from planned features; it is implemented in README, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql 82354bb5af 45/56: Run lints as part of CI, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql 44af7744d5 48/56: Ignore generated files, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql 6c4c5abb26 49/56: Remove defunct test/make.el, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql b64ab8d585 53/56: Do not suggest packaging `examples.el', ELPA Syncer, 2022/10/29
- [elpa] externals/graphql e2b309689f 55/56: Add 'clean' target, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql 5ca5f50b5e 56/56: Update MELPA badge to new url, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql d1a8e478b3 21/56: Finish renaming test file, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql 98f9131b27 29/56: Use graphql-encode instead of removed graphql--encode, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql 32933981a9 32/56: Add support for specifying GraphQL lists using Lisp vector syntax, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql 8d45c98e9f 24/56: Run tests on Travis,
ELPA Syncer <=
- [elpa] externals/graphql 57a3dfe5bf 33/56: Correct capitalization, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql b3db1ff740 34/56: Response form should mirror input form when using macros, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql 3eb2416913 36/56: Make sure 'plain' cons cell keys are not cons cells themselves, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql d71e6b218c 39/56: Require subr-x for thread-last in examples.el, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql 8b29e7e335 41/56: Fix emacs build on CI, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql 093c761981 43/56: Switch to the real Emake, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql 4338f9b280 44/56: Fix checkdoc and package-lint errors, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql 4a6e055723 46/56: Test 26.1 on CI, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql ea85c2b32b 47/56: Allow makefile to be run locally without duplication, ELPA Syncer, 2022/10/29
- [elpa] externals/graphql a9ab8d7186 50/56: Fix version check, ELPA Syncer, 2022/10/29