-
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
Changes from 6 commits
508e94d
23b8907
3b6448f
5e0d7ed
f0d6a62
23d35a6
3611a9e
4f0f86a
8416bfe
b9e66ea
643a7f7
c6c3ea8
0a93908
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Unit tests & Build Testapp | ||
|
||
on: ['push', 'pull_request'] | ||
|
||
jobs: | ||
|
||
flake8: | ||
name: Flake8 tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout python-for-android | ||
uses: actions/checkout@master | ||
- name: Set up Python 3.7 | ||
uses: actions/setup-python@v1.1.0 | ||
with: | ||
python-version: 3.7 | ||
- name: Run flake8 | ||
# we use exactly the same exceptions than tox.ini file | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. why not a There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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 |
||
|
||
linting: | ||
name: Pytest [Python ${{ matrix.python-version }} | ${{ matrix.os }}] | ||
needs: flake8 | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
python-version: [3.6, 3.7] | ||
os: [ubuntu-latest, macOs-latest] | ||
steps: | ||
- name: Checkout python-for-android | ||
uses: actions/checkout@master | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1.1.0 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -U virtualenv pytest pytest-cov backports.tempfile pyOpenSSL coveralls | ||
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 commentThe 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? |
||
- name: Coveralls | ||
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 commentThe 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 commentThe 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 commentThe 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":
|
||
|
||
build: | ||
name: Build testapp | ||
needs: [flake8] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout python-for-android | ||
uses: actions/checkout@master | ||
- name: Pull docker image | ||
run: | | ||
make docker/pull | ||
- name: Build apk for Python 3 arm64-v8a | ||
run: | | ||
make docker/run/make/testapps/python3/arm64-v8a |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from unittest import mock | ||
from platform import system | ||
from tests.recipes.recipe_ctx import RecipeCtx | ||
|
||
|
||
|
@@ -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 commentThe 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 |
||
) | ||
|
||
sh_command_calls = ["./configure"] | ||
|
@@ -48,7 +49,7 @@ def test_get_recipe_env( | |
some internal methods has been called. | ||
""" | ||
mock_find_executable.return_value = self.expected_compiler.format( | ||
android_ndk=self.ctx._ndk_dir | ||
android_ndk=self.ctx._ndk_dir, system=system().lower() | ||
) | ||
mock_glob.return_value = ["llvm"] | ||
mock_check_recipe_choices.return_value = sorted( | ||
|
@@ -85,7 +86,7 @@ def test_build_arch( | |
mock_current_directory, | ||
): | ||
mock_find_executable.return_value = self.expected_compiler.format( | ||
android_ndk=self.ctx._ndk_dir | ||
android_ndk=self.ctx._ndk_dir, system=system().lower() | ||
) | ||
mock_glob.return_value = ["llvm"] | ||
|
||
|
@@ -133,7 +134,7 @@ def test_build_arch( | |
mock_current_directory, | ||
): | ||
mock_find_executable.return_value = self.expected_compiler.format( | ||
android_ndk=self.ctx._ndk_dir | ||
android_ndk=self.ctx._ndk_dir, system=system().lower() | ||
) | ||
mock_glob.return_value = ["llvm"] | ||
|
||
|
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 👍