fix need to specify both CLONE_URL and RECIPE

This commit is contained in:
riscy 2020-02-29 16:32:09 -08:00
parent 328d9901fa
commit 448b664580
3 changed files with 27 additions and 31 deletions

View file

@ -3,17 +3,13 @@ language: python
python:
- "3.6"
# TODO: make it unnecessary to specify both CLONE_URL and RECIPE
env:
# Test a recipe before you even open a MELPA pull request:
- >-
CLONE_URL='https://github.com/riscy/shx-for-emacs'
RECIPE='(shx :repo "riscy/shx-for-emacs" :fetcher github)'
- >-
CLONE_URL='https://github.com/riscy/bifocal-mode'
RECIPE='(bifocal :repo "riscy/bifocal-mode" :fetcher github)'
- RECIPE='(shx :repo "riscy/shx-for-emacs" :fetcher github)'
- RECIPE='(bifocal :repo "riscy/bifocal-mode" :fetcher github)'
# If you already have a pull request open, specify as below:
- MELPA_PR_URL=https://github.com/melpa/melpa/pull/4749
# Some (older) MELPA PR's have errors, but we use them to test:
- >-
MELPA_PR_URL=https://github.com/melpa/melpa/pull/5004
EXPECT_ERROR=2

View file

@ -22,8 +22,8 @@ The checks are a combination of:
5. some elisp checks (in [[https://github.com/riscy/melpazoid/blob/master/melpazoid.el][melpazoid.el]])
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.
The license checker is currently very crude. The elisp checks are not foolproof,
sometimes opinionated, and may raise false positives.
The license checker (4) is currently very crude. The elisp checks (5) are not
foolproof, sometimes opinionated, and may raise false positives.
* Usage
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]].
@ -38,37 +38,39 @@ sometimes opinionated, and may raise false positives.
*** Test a recipe before you even open a pull request to MELPA
Modify the ~env~ field and specify your clone URL and your recipe:
#+begin_src yaml
env: >-
CLONE_URL=https://github.com/me/my-package-repo
RECIPE='(my-package :repo "me/my-package-repo" :fetcher github)'
env:
- RECIPE='(my-package :repo "me/my-package-repo" :fetcher github)'
#+end_src
Note the apostrophes around the RECIPE.
*** Test a MELPA pull request you've already opened
Modify the ~env~ field and specify your open MELPA PR:
#+begin_src yaml
env: >-
MELPA_PR_URL=https://github.com/melpa/melpa/pull/6713
env:
- MELPA_PR_URL=https://github.com/melpa/melpa/pull/6713
#+end_src
** Use it locally
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.
*** Test a MELPA PR
*** Test your recipe
#+begin_src bash
RECIPE='(shx :repo "riscy/shx-for-emacs" :fetcher github)' make
#+end_src
Note the apostrophes around the RECIPE.
*** Test an open MELPA PR
#+begin_src bash
MELPA_PR_URL=https://github.com/melpa/melpa/pull/6718 make
#+end_src
*** Test a remote package
#+begin_src bash
CLONE_URL=https://github.com/riscy/shx-for-emacs \
RECIPE='(shx :repo "riscy/shx-for-emacs" :fetcher github)' \
make
#+end_src
Note the apostrophes around the RECIPE.
*** Test a local package (work in progress)
#+begin_src bash
PKG_PATH=/path/to/package \
PKG_NAME=package-name \
make
#+end_src
*** 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

View file

@ -437,9 +437,11 @@ def yes_p(text: str) -> bool:
return not keep.startswith('n')
def check_remote_package(clone_address: str, recipe: str = ''):
def check_remote_package(recipe: str = ''):
"""Check a remotely-hosted package."""
name = _tokenize_recipe(recipe)[1]
with tempfile.TemporaryDirectory() as elisp_dir:
clone_address = _clone_address(name, recipe)
_clone(clone_address, _branch(recipe), into=elisp_dir)
run_checks(recipe, elisp_dir, clone_address)
@ -581,12 +583,8 @@ if __name__ == '__main__':
elif 'PKG_PATH' in os.environ and 'PKG_NAME' in os.environ:
check_local_package(os.environ['PKG_PATH'], os.environ['PKG_NAME'])
sys.exit(return_code())
elif 'CLONE_URL' in os.environ:
if 'RECIPE' in os.environ:
check_remote_package(os.environ['CLONE_URL'], os.environ['RECIPE'])
sys.exit(return_code())
else:
check_remote_package(os.environ['CLONE_URL'])
elif 'RECIPE' in os.environ:
check_remote_package(os.environ['RECIPE'])
sys.exit(return_code())
else:
check_melpa_pr_loop()