napari / cookiecutter-napari-plugin

Cookiecutter for napari plugins
BSD 3-Clause "New" or "Revised" License
67 stars 39 forks source link

introduce shorter timeout in test.yml #175

Closed martinschorb closed 4 months ago

martinschorb commented 5 months ago

When playing around with a repository created from this template, a GUI test ended up in an infinite loop. The default timeout of 6h and the 3x3 matrix to test different OSes and Python version then leads to a quick exhaustion of the time available for Github actions. Since this repo is directed to beginners, I assume this can happen more often, so I propose a shorter timeout to minimize such problems.

Thanks!

Czaki commented 5 months ago

Sounds like a good idea, but I think that we may want to put information about timeout somewhere (maybe in readme with link to github docs?)

martinschorb commented 5 months ago

Maybe 30 minutes is a bit tight looking at the results from the last run. Should we choose 45 or 60?

Czaki commented 5 months ago

Ok. I think wrongly understood you initially. I think that you want to set timeout in {{cookiecutter.plugin_name}}/.github/workflows/test_and_deploy.yml file.

Because this workflow file is used in template output.

Or you have a problem with running tests of this repository?

martinschorb commented 5 months ago

Sorry, my mistake. You initially got it right, but I obviously modified the wrong file. Let me fix this.

martinschorb commented 5 months ago

Any idea what is going on here? Looks like a git problem when setting up the plugin.

DragaDoncila commented 5 months ago

Hmm @martinschorb I think what's happening is that the workflow file has lost its newline at the end of the file, so the pre-commit that runs on the built plugin fails. You should be able to fix it by adding a newline back to the end of test_and_deploy.yml.

AJFSalomon commented 5 months ago

Hmm @martinschorb I think what's happening is that the workflow file has lost its newline at the end of the file, so the pre-commit that runs on the built plugin fails. You should be able to fix it by adding a newline back to the end of test_and_deploy.yml.

Actually, I think it's the opposite: a newline has been added at the end of test_and_deploy.yml that wasn't there before. I am really not sure how this works or why the tests fail in the current state, but I would try to remove it and see if the tests pass.

I tried to do the modification myself, but I couldn't push the changes to this PR. Maybe @martinschorb or @Czaki can do it.

AJFSalomon commented 5 months ago

I went through the test logs and I think the problem comes from the end of the generated `test_and_deploy.yml' file, pre-commit fails with the "fix end of files" hook. I think the cookiecutter is producing an excess new line:

E           Failed: pre-commit failed with output:
E           check docstring is first.................................................Passed
E           fix end of files.........................................................Failed
E           - hook id: end-of-file-fixer
E           - exit code: 1
E           - files were modified by this hook
E           
E           Fixing .github/workflows/test_and_deploy.yml
E           
E           trim trailing whitespace.................................................Passed
E           check yaml...............................................................Passed
E           ruff.....................................................................Passed
E           black....................................................................Passed
E           napari-plugin-checks.....................................................Passed
E           pre-commit hook(s) made changes.
E           If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.
E           To run `pre-commit` as part of git workflow, use `pre-commit install`.
E           All changes made by hooks:
E           diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml
E           index d6e4adb..fcef2b4 100644
E           --- a/.github/workflows/test_and_deploy.yml
E           +++ b/.github/workflows/test_and_deploy.yml
E           @@ -89,4 +89,3 @@ jobs:
E                      git tag
E                      python -m build .
E                      twine upload dist/*
E           -
E           
E           errror:

tests/test_create_template.py:119: Failed
______________________ test_pre_commit_validity[y-y-n-n] _______________________