Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a command to run run_ci.sh in CONTRIBUTING.md #212

Open
kevinadhiguna opened this issue Mar 15, 2022 · 6 comments
Open

Add a command to run run_ci.sh in CONTRIBUTING.md #212

kevinadhiguna opened this issue Mar 15, 2022 · 6 comments

Comments

@kevinadhiguna
Copy link
Contributor

Hi, I would like to ask about this section.

Before submitting the pull request

You can test your changes locally with the script run_ci.sh in scripts directory.


I would like to add a command to run run_ci.sh :

Before submitting the pull request

You can test your changes locally with the script run_ci.sh in scripts directory. Run the command below in project root directory :

$ sh scripts/run_ci.sh

Reason

This is the content of run_ci.sh :

#!/bin/bash
# These are the same steps we are running in Travis CI

python tests/syntax_lint.py
flake8 --max-line-length=100 . && echo "PEP8 Passed"

If I execute sh run_ci.sh in scripts directory, it will throw an error :

/home/user/pyenv/versions/3.8.12/bin/python: can't open file 'tests/syntax_lint.py': [Errno 2] No such file or directory
PEP8 Passed

Proposed Solution

Either :

  1. Ask users to execute sh scripts/run_ci.sh in project root directory.

or

  1. Change run_ci.sh :
#!/bin/bash
# These are the same steps we are running in Travis CI

-python tests/syntax_lint.py
+python ../tests/syntax_lint.py
flake8 --max-line-length=100 . && echo "PEP8 Passed"

Thank you. Any suggestion is appreciated.

@bolshoytoster
Copy link

@kevinadhiguna if you make the path relative to the script then it could be run from anywhere, something like this:

python $(dirname "$0")/syntax_lint.py

$0 is how the user referenced the script, i.e. scripts/run_ci.sh and dirname gets rid of the filename.


Also, in your proposed change, you recommend running the script with sh but the file has a shebang for bash. In this case it doesn't matter much but it's best to stay consistent because (in most systems) they are slightly different.

@bregman-arie
Copy link
Owner

@kevinadhiguna do you plan to work on this issue? so we know who to assign it to

@kevinadhiguna
Copy link
Contributor Author

@bolshoytoster Thanks for the suggestion. However, do you mind telling what's wrong with this ?

run_ci.sh :

#!/bin/bash
# These are the same steps we are running in Travis CI

# python tests/syntax_lint.py
python $(dirname "$0")/syntax_lint.py
flake8 --max-line-length=100 . && echo "PEP8 Passed"

since the output gives an error saying :

/home/user/.pyenv/versions/3.8.13/bin/python: can't open file './syntax_lint.py': [Errno 2] No such file or directory
PEP8 Passed

@kevinadhiguna
Copy link
Contributor Author

@bregman-arie Sure, I am working on it.

@bolshoytoster
Copy link

@kevinadhiguna sorry, I must've read it wrong. I think it should be

python $(dirname "$0")/../tests/syntax_lint.py

@wasi4440
Copy link

wasi4440 commented Aug 1, 2022

run_ci.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants