-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Introduce github-actions (push & pull_requests) #2025
Conversation
Because the compiler path depends on the platform where the tests are run.
The CI tests for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work 👏
I'm not familiar with github-actions yet. My only concern is its pretty recent and we don't have much hindsight about the tool.
Also I wish we didn't repeat ourselves and leveraged tox
or Makefile
more if possible
.github/workflows/push.yml
Outdated
run: | | ||
python -m pip install --upgrade pip | ||
pip install -U flake8 | ||
flake8 --ignore=E123,E124,E126,E226,E402,E501,W503,W504 pythonforandroid/ tests/ ci/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not a tox -e flake8
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aaa...yes...that should work, honestly, I had a different idea about flake8 tests (and never finished that) ...let me explain...
With some gh-actions
, we can interact with the web ui interface of github, so, I was thinking that it would be great that the detected PEP8 errors could be notified automatically at PRs ...mmm...better check this action to get a better idea: https://github.com/suo/flake8-github-action . So... I did not implement this because that flake8 action cannot be configured (at least for now, but it could be another options...needs investigation)
So, said this, we could give it a try to the tox command (I will try this when I have some time), but I would keep one eye on this flake8 action mentioned above, because we could have some improvements here...specially thinking on PR reviewers...it seems that the red cross
in travis tests, somehow and sometimes, is not seen, right? 😆
.github/workflows/push.yml
Outdated
pip install -e . | ||
- name: Tests | ||
run: | | ||
python -m pytest tests/ --ignore tests/test_pythonpackage.py --cov pythonforandroid/ --cov-branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm missing why we don't run these through tox since it's already configured with dependencies and run commands? Is running tox cumbersome with github-actions?
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout python-for-android | ||
uses: actions/checkout@master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the branch be develop
here and the other places? Or this is not related to the p4a branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aaa...first of all, I'm not an gh-actions expert at all, but, I will try to put some light in here, so here we go:
gh-actions
works based on events (In this PR we listen and react topush
andpull_requests
github events...so we kind of imitate travis behaviour). But, there is a lot of events that we can use, just check this if you want to get more detailed info about events.gh-actions
is not just a name, it's a set of repos: https://github.com/actions. Those repos can be used by any other repo.
Said this, when we call the line:
uses: actions/checkout@master
What are we doing is executing the code located at: https://github.com/actions/checkout, which simply will run the proper git commands, so our workflow can access the content of our repo. The @master
just point to the version that we use for the specific github action (master branch in this case but it could be a release...).
Ok, hope that this clarifies a little this particular gh-actions
thing 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it clarifies, I was exactly not sure if this branch was our or the tooling one, thanks 👍
.github/workflows/push.yml
Outdated
run: | | ||
python -m coveralls | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Travis this isn't required somehow because Coveralls has some "magic integration" that makes it seamless. Is it for sure required with github-actions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for trying out. I also link the actual log output here "for posterity":
Not on Travis or CircleCI. You have to provide either repo_token in .coveralls.yml or set the COVERALLS_REPO_TOKEN env var.
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.7.5/x64/lib/python3.7/site-packages/coveralls/cli.py", line 61, in main
service_name=options['--service'])
File "/opt/hostedtoolcache/Python/3.7.5/x64/lib/python3.7/site-packages/coveralls/api.py", line 58, in __init__
self.ensure_token()
File "/opt/hostedtoolcache/Python/3.7.5/x64/lib/python3.7/site-packages/coveralls/api.py", line 67, in ensure_token
self.config_filename))
coveralls.exception.CoverallsException: Not on Travis or CircleCI. You have to provide either repo_token in .coveralls.yml or set the COVERALLS_REPO_TOKEN env var.
##[error]Process completed with exit code 1.
@@ -13,7 +14,7 @@ class BaseTestForMakeRecipe(RecipeCtx): | |||
|
|||
recipe_name = None | |||
expected_compiler = ( | |||
"{android_ndk}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang" | |||
"{android_ndk}/toolchains/llvm/prebuilt/{system}-x86_64/bin/clang" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So basically unit test was failing in osx? Maybe it could be a PR on its own with these fixes
397b3c0
to
3611a9e
Compare
We also remove the env var `COVERALLS_REPO_TOKEN`, so we test if coveralls is working with `gh-actions` Note: Since Python 2 it's almost at the end of his life we only perform the Python3 tests, but we still have the travis tests for Python 2
468d647
to
4f0f86a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for giving it a try and addressing the comments.
I think it's looking good enough already
.github/workflows/push.yml
Outdated
tox -e py3 -- tests/ --ignore tests/test_pythonpackage.py | ||
- name: Send Coverage to coveralls | ||
run: | | ||
coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since coveralls
is also part of our tox.ini
, I'm wondering if this one could also be merged.
Or maybe better, we could try reusing the Makefile
which is already dealing with --ignore tests/test_pythonpackage.py
and coveralls report in the test
target.
https://github.com/kivy/python-for-android/blob/b27ff0b/Makefile#L29-L31
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I like it, this way the dilemma of deciding when we should send the report to coveralls it will be solved, since CI
environment variable will only exist for travis, so no report will be send with gh-actions unless we change that in the makefile
by the gh-actions equivalent (which is GITHUB_ACTIONS
...for the record 😉).
Thanks again @AndreMiras 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice it looks simpler. Good to know for the env variable
The coveralls report will only be send with our travis tests, since the `CI` environment variable it will only exist for travis.
BTW, I think that we should include the update: Let's try it, and see what happens with one of those heavy recipes... |
The purpose of this commit is to test the rebuild updated recipes behaviour with a long time consuming recipe
As expected, the test for
Ahahaha, but it succeed with gh-actions 😄 |
This reverts commit c6c3ea8, to keep travis happy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM: Nice to also see it in action with rebuild_updated_recipes
.
Ok then, I think that we can merge this already, but before, here I leave the last gh-actions CI test, corresponding to the last commit (remember that all the Please @AndreMiras, do the merge for this one (or give me the order to do the squash/merge and I will do it), since you had some concerns about this |
I'm happy with it that's why it's approved, I let you the pleasure to hit that (squash &) merge button 👍 |
Done, here we have it, also accessible via the |
I just want to share some of our travis tests but for
gh-actions
:In here we perform the same tox tests that we do in travis but for linux and MacOs (for python versions 3.6 and 3.7...so we use a matrix) plus an flake8 test (which will make stop all the other tests if not succeed).
Regarding testsapp, we only perform one of the tests (Python3 for arm64-v8a in ubuntu with docker), so we make less tests than travis regarding testapps. The good thing of this is that we run the tox tests in MacOs, which make me notice that we had wrong some of our tests so we solve this in here.
Why introduce
gh-actions
?Well, because it's one more asset that we can use, and this is only one small part of what can be achieved with
gh-actions
. IMHO, I think that we can benefit fromgh-actions
, I wouldn't remove travis tests at all, but I would usegh-actions
for any operation that requires to use passwords, since it's more easy to deal than with travis. In matter fact, I already used agithub.secret
(COVERALLS_REPO_TOKEN
, to send coveralls report), that we may need to setup for kivy (I'm not sure of this...it maybe already added to kivy organization...).Note: I leave this PR in
WIP
status because:gh-actions
for p4a...maybe the kivy/p4a team doesn't want this at all...we will see...travis
and withgh-actions
...probably we only want to send the reports with one of the services...so this PR may require some adjustments...gh-actions
was a little clumsy...gh-actions
was still in beta status...now are official but it still may be a little clumsy...I suppose that it will get better with time...)Some references: