improve usage instructions and GitHub actions

This commit is contained in:
riscy 2020-04-26 17:51:19 -07:00
parent 801964e829
commit da796d18e0
4 changed files with 70 additions and 31 deletions

29
.github/workflows/melpazoid.yml vendored Normal file
View file

@ -0,0 +1,29 @@
# melpazoid <https://github.com/riscy/melpazoid> build checks.
# If your package is on GitHub, enable melpazoid's checks by copying this file
# to .github/workflows/melpazoid.yml and modifying RECIPE and EXIST_OK below.
name: melpazoid
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.6
uses: actions/setup-python@v1
with: { python-version: 3.6 }
- name: Install
run: |
python -m pip install --upgrade pip
sudo apt-get install emacs && emacs --version
git clone https://github.com/riscy/melpazoid.git ~/melpazoid
pip install ~/melpazoid
- name: Run
env:
# RECIPE is your recipe as written for MELPA:
RECIPE: (shx :repo "riscy/shx-for-emacs" :fetcher github)
# set this to false (or remove it) if the package isn't on MELPA:
EXIST_OK: true
run: echo $EXIST_OK && make -C ~/melpazoid

View file

@ -1,3 +1,4 @@
name: test
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:

View file

@ -29,55 +29,62 @@ The license checker (4) is currently very crude. The elisp checks (5) are not
foolproof, sometimes opinionated, and may raise false positives. foolproof, sometimes opinionated, and may raise false positives.
* Usage * Usage
You can [[https://github.com/riscy/melpazoid#fork-it-and-let-ci-do-the-work][fork it and let Travis-CI do the work]], or [[https://github.com/riscy/melpazoid#use-it-locally][use it locally]]. The best way to use melpazoid is to add it to your CI (GitHub actions,
** Fork it and let Travis-CI do the work Travis, etc.), but you can also use it locally.
If you don't want to install this software or its dependencies, you are ** Add it to GitHub actions
encouraged to fork this repository and let CI do the work. Then enable The very easiest is if your package is hosted on GitHub. Just run the
[[https://travis-ci.org][Travis-CI]] on your fork, or just open a pull request against this repository following from your project root:
(I won't merge it). The eventual build information will report any issues. #+begin_src bash
mkdir -p .github/workflows
Your fork will need to point to the Emacs package you want to build, which curl -o .github/workflows/melpazoid.yml \
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. https://raw.githubusercontent.com/riscy/melpazoid/master/.github/workflows/melpazoid.yml
*** Test a recipe before you even open a pull request to MELPA #+end_src
Modify the ~env~ field and specify your clone URL and your recipe: then edit the file (~.github/workflows/melpazoid.yml~) and change the values
#+begin_src yaml of ~RECIPE~ and ~EXIST_OK~ to fit. Instructions are in the file.
env: ** Add it to a Travis build
- RECIPE='(my-package :repo "me/my-package-repo" :fetcher github)' If you use Travis, the following is an example ~.travis.yml~ that runs
#+end_src melpazoid on a recipe:
Note the apostrophes around the RECIPE. #+begin_src yaml
*** Test a MELPA pull request you've already opened language: python
Modify the ~env~ field and specify your open MELPA PR: python: ['3.6']
#+begin_src yaml install:
env: - git clone https://github.com/riscy/melpazoid.git ~/melpazoid
- MELPA_PR_URL=https://github.com/melpa/melpa/pull/6713 - pip install ~/melpazoid
#+end_src env:
# NOTE: set EXIST_OK to false if the package is not yet on MELPA:
- RECIPE='(shx :repo "riscy/shx-for-emacs" :fetcher github)' EXIST_OK=true
script:
- make -C ~/melpazoid
#+end_src
remembering to modify ~RECIPE~ and ~EXIST_OK~ accordingly.
** Use it locally ** Use it locally
You will need Python ≥ 3.6 (and the ~requests~ package) and Docker. An image 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 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 default, it will be run with no network access. The output scroll will report
any discovered issues. any discovered issues.
*** Test the recipe for a hosted package *** Test an open MELPA PR
If you've already opened a PR against MELPA you can use:
#+begin_src bash
MELPA_PR_URL=https://github.com/melpa/melpa/pull/6718 make
#+end_src
*** Test a recipe
#+begin_src bash #+begin_src bash
RECIPE='(shx :repo "riscy/shx-for-emacs" :fetcher github)' make RECIPE='(shx :repo "riscy/shx-for-emacs" :fetcher github)' make
#+end_src #+end_src
Note the apostrophes around the RECIPE. Or test a specific branch: Note the apostrophes around the RECIPE. You can also test a specific branch:
#+begin_src bash #+begin_src bash
RECIPE='(shx :repo "riscy/shx-for-emacs" :fetcher github :branch "develop")' make RECIPE='(shx :repo "riscy/shx-for-emacs" :fetcher github :branch "develop")' make
#+end_src #+end_src
*** Test the recipe for a package on your machine *** Test a recipe for a package on your machine
#+begin_src bash #+begin_src bash
RECIPE='(shx :repo "riscy/shx-for-emacs" :fetcher github)' \ RECIPE='(shx :repo "riscy/shx-for-emacs" :fetcher github)' \
LOCAL_REPO='~/my-emacs-packages/shx-for-emacs' make LOCAL_REPO='~/my-emacs-packages/shx-for-emacs' make
#+end_src #+end_src
Instead of cloning from ~riscy/shx-for-emacs~ in this example, melpazoid Instead of cloning from ~riscy/shx-for-emacs~ in this example, melpazoid
will use the files in ~LOCAL_REPO~. will use the files in ~LOCAL_REPO~.
*** Test an open MELPA PR
#+begin_src bash
MELPA_PR_URL=https://github.com/melpa/melpa/pull/6718 make
#+end_src
*** Run in an unending loop *** Run in an unending loop
This currently only works in macOS; it monitors the clipboard This currently only works in macOS; it monitors the clipboard
for new MELPA PR's, then automatically runs the checks on them. for MELPA PR's, then automatically runs the checks.
#+begin_src bash #+begin_src bash
make make
#+end_src #+end_src

View file

@ -486,7 +486,9 @@ def print_related_packages(recipe: str):
for name in known_names[:10]: for name in known_names[:10]:
if name != package_name: if name != package_name:
print(f"- {name} {known_packages[name]}") print(f"- {name} {known_packages[name]}")
if package_name in known_packages and 'EXIST_OK' not in os.environ: if package_name not in known_packages:
return
if os.environ.get('EXIST_OK', '').lower() != 'true':
_fail(f"- '{package_name}' already exists: {known_packages[package_name]}") _fail(f"- '{package_name}' already exists: {known_packages[package_name]}")