2020-02-22 18:43:05 -08:00
#+TITLE : melpazoid 🤖
2020-02-22 15:16:32 -08:00
#+OPTIONS : toc:3 author:t creator:nil num:nil
#+AUTHOR : Chris Rayner
2020-02-22 11:48:06 -08:00
#+EMAIL : dchrisrayner@gmail.com
2020-02-22 18:56:03 -08:00
[[https://travis-ci.org/riscy/melpazoid ][https://travis-ci.org/riscy/melpazoid.svg?branch=master ]]
2020-02-22 11:48:06 -08:00
2020-02-22 15:16:32 -08:00
/melpazoid/ is a bundle of scripts for testing Emacs packages, primarily
2020-02-22 18:48:19 -08:00
submissions to [[https://github.com/melpa/ ][MELPA ]]. I've been using this to help check MELPA [[https://github.com/melpa/melpa/pulls ][pull requests ]].
The ambition is checks that run in a "clean" environment, either through CI or
through a container on your local machine.
2020-02-22 11:48:06 -08:00
2020-02-22 18:48:19 -08:00
This is a work in progress -- feedback and pull requests are welcome ([[https://github.com/riscy/melpazoid/search?q=TODO&unscoped_q=TODO][search for
TODO]]s, [[https://github.com/riscy/melpazoid/issues ][raise an issue ]], whatever). Note my current aim is to make this code
2020-02-22 18:34:35 -08:00
simpler before I make it any more complicated.
2020-02-22 17:18:00 -08:00
The checks are a combination of:
2020-02-22 18:34:35 -08:00
1. [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Byte-Compilation.html#Byte-Compilation ][byte-compile-file ]]
2020-02-22 17:18:00 -08:00
2. [[https://www.emacswiki.org/emacs/CheckDoc ][checkdoc ]]
3. [[https://github.com/purcell/package-lint ][package-lint ]]
2020-02-22 18:34:35 -08:00
4. a license checker (in [[https://github.com/riscy/melpazoid/blob/master/melpazoid.py ][melpazoid.py ]])
5. some elisp checks (in [[https://github.com/riscy/melpazoid/blob/master/melpazoid.el ][melpazoid.el ]])
2020-02-22 17:18:00 -08:00
2020-02-29 18:14:09 -08:00
1--4 are on the [[https://github.com/melpa/melpa/blob/master/.github/PULL_REQUEST_TEMPLATE.md ][MELPA checklist ]], so you should always try to get those right. In
normal circumstances the build will exit with a failure if there is any
byte-compile or package-lint `error` -- leeway is given for any `warning`.
2020-02-29 16:32:09 -08:00
The license checker (4) is currently very crude. The elisp checks (5) are not
foolproof, sometimes opinionated, and may raise false positives.
2020-02-22 17:18:00 -08:00
2020-02-22 23:31:54 -08:00
* Usage
2020-02-22 18:43:05 -08:00
You can [[https://github.com/riscy/melpazoid#fork-it-and-let-ci-do-the-work ][fork it and let CI do the work ]], or [[https://github.com/riscy/melpazoid#use-it-locally ][use it locally ]].
2020-02-22 17:18:00 -08:00
** Fork it and let CI do the work
If you don't want to install this software or its dependencies, you are
2020-02-22 18:43:05 -08:00
encouraged to fork this repository and let CI do the work. Then enable
[[https://travis-ci.org ][Travis-CI ]] on your fork, or just open a pull request against this repository
(I won't merge it). The eventual build information will report any issues.
2020-02-22 17:18:00 -08:00
Your fork will need to point to the Emacs package you want to build, which
2020-02-22 18:48:19 -08:00
can be done by modifying the [[https://github.com/riscy/melpazoid/blob/master/.travis.yml#L6 ][.travis.yml ]] file in one of the following ways.
2020-02-22 17:18:00 -08:00
*** Test a recipe before you even open a pull request to MELPA
2020-02-22 18:34:35 -08:00
Modify the ~env~ field and specify your clone URL and your recipe:
2020-02-22 17:18:00 -08:00
#+begin_src yaml
2020-02-29 16:32:09 -08:00
env:
- RECIPE='(my-package :repo "me/my-package-repo" :fetcher github)'
2020-02-22 17:18:00 -08:00
#+end_src
2020-02-26 23:39:04 -08:00
Note the apostrophes around the RECIPE.
2020-02-22 17:18:00 -08:00
*** Test a MELPA pull request you've already opened
Modify the ~env~ field and specify your open MELPA PR:
#+begin_src yaml
2020-02-29 16:32:09 -08:00
env:
- MELPA_PR_URL=https://github.com/melpa/melpa/pull/6713
2020-02-22 17:18:00 -08:00
#+end_src
** Use it locally
2020-02-22 18:43:05 -08:00
You will need Python ≥ 3.6 (and the ~requests~ package) and Docker. An image
will be built with (hopefully) all of your requirements installed. By
default, it will be run with no network access. The output scroll will report
any discovered issues.
2020-02-29 16:32:09 -08:00
*** Test your recipe
2020-02-22 15:16:32 -08:00
#+begin_src bash
2020-02-29 16:32:09 -08:00
RECIPE='(shx :repo "riscy/shx-for-emacs" :fetcher github)' make
2020-02-22 15:16:32 -08:00
#+end_src
2020-02-29 16:32:09 -08:00
Note the apostrophes around the RECIPE.
*** Test an open MELPA PR
2020-02-22 15:16:32 -08:00
#+begin_src bash
2020-02-29 16:32:09 -08:00
MELPA_PR_URL=https://github.com/melpa/melpa/pull/6718 make
2020-02-22 15:16:32 -08:00
#+end_src
*** Test a local package (work in progress)
#+begin_src bash
2020-02-22 23:31:54 -08:00
PKG_PATH=/path/to/package \
PKG_NAME=package-name \
2020-02-22 15:16:32 -08:00
make
#+end_src
2020-02-29 16:32:09 -08:00
*** Run in an unending loop
This currently only works in macOS; it monitors the clipboard
for new MELPA PR's, then automatically runs the checks on them.
#+begin_src bash
make
#+end_src