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: python:
- "3.6" - "3.6"
# TODO: make it unnecessary to specify both CLONE_URL and RECIPE
env: env:
# Test a recipe before you even open a MELPA pull request: # Test a recipe before you even open a MELPA pull request:
- >- - RECIPE='(shx :repo "riscy/shx-for-emacs" :fetcher github)'
CLONE_URL='https://github.com/riscy/shx-for-emacs' - RECIPE='(bifocal :repo "riscy/bifocal-mode" :fetcher github)'
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)'
# If you already have a pull request open, specify as below: # If you already have a pull request open, specify as below:
- MELPA_PR_URL=https://github.com/melpa/melpa/pull/4749 - 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 MELPA_PR_URL=https://github.com/melpa/melpa/pull/5004
EXPECT_ERROR=2 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]]) 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. 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, The license checker (4) is currently very crude. The elisp checks (5) are not
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 CI do the work]], or [[https://github.com/riscy/melpazoid#use-it-locally][use it locally]]. 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 *** Test a recipe before you even open a pull request to MELPA
Modify the ~env~ field and specify your clone URL and your recipe: Modify the ~env~ field and specify your clone URL and your recipe:
#+begin_src yaml #+begin_src yaml
env: >- env:
CLONE_URL=https://github.com/me/my-package-repo - RECIPE='(my-package :repo "me/my-package-repo" :fetcher github)'
RECIPE='(my-package :repo "me/my-package-repo" :fetcher github)'
#+end_src #+end_src
Note the apostrophes around the RECIPE. Note the apostrophes around the RECIPE.
*** Test a MELPA pull request you've already opened *** Test a MELPA pull request you've already opened
Modify the ~env~ field and specify your open MELPA PR: Modify the ~env~ field and specify your open MELPA PR:
#+begin_src yaml #+begin_src yaml
env: >- env:
MELPA_PR_URL=https://github.com/melpa/melpa/pull/6713 - MELPA_PR_URL=https://github.com/melpa/melpa/pull/6713
#+end_src #+end_src
** 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 your recipe
*** Test a MELPA PR #+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 #+begin_src bash
MELPA_PR_URL=https://github.com/melpa/melpa/pull/6718 make MELPA_PR_URL=https://github.com/melpa/melpa/pull/6718 make
#+end_src #+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) *** Test a local package (work in progress)
#+begin_src bash #+begin_src bash
PKG_PATH=/path/to/package \ PKG_PATH=/path/to/package \
PKG_NAME=package-name \ PKG_NAME=package-name \
make make
#+end_src #+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') 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.""" """Check a remotely-hosted package."""
name = _tokenize_recipe(recipe)[1]
with tempfile.TemporaryDirectory() as elisp_dir: with tempfile.TemporaryDirectory() as elisp_dir:
clone_address = _clone_address(name, recipe)
_clone(clone_address, _branch(recipe), into=elisp_dir) _clone(clone_address, _branch(recipe), into=elisp_dir)
run_checks(recipe, elisp_dir, clone_address) 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: elif 'PKG_PATH' in os.environ and 'PKG_NAME' in os.environ:
check_local_package(os.environ['PKG_PATH'], os.environ['PKG_NAME']) check_local_package(os.environ['PKG_PATH'], os.environ['PKG_NAME'])
sys.exit(return_code()) sys.exit(return_code())
elif 'CLONE_URL' in os.environ: elif 'RECIPE' in os.environ:
if 'RECIPE' in os.environ: check_remote_package(os.environ['RECIPE'])
check_remote_package(os.environ['CLONE_URL'], os.environ['RECIPE'])
sys.exit(return_code())
else:
check_remote_package(os.environ['CLONE_URL'])
sys.exit(return_code()) sys.exit(return_code())
else: else:
check_melpa_pr_loop() check_melpa_pr_loop()