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 GitHub actions #320

Merged
merged 13 commits into from
Jul 22, 2021
Merged

Add GitHub actions #320

merged 13 commits into from
Jul 22, 2021

Conversation

rwalton-arm
Copy link
Contributor

@rwalton-arm rwalton-arm commented Jul 15, 2021

Add a github actions workflow.

Fix flake8 errors with docstrings and exceptions.

Modify flake8 config:

  • ignore directories we don't want to check.
  • ignore docstring warnings in test classes.
  • ignore "unused imports" in __init__.py files

@rwalton-arm rwalton-arm marked this pull request as ready for review July 15, 2021 12:22
LDong-Arm
LDong-Arm previously approved these changes Jul 15, 2021
Copy link

@LDong-Arm LDong-Arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rwalton-arm rwalton-arm force-pushed the add_github_actions branch 2 times, most recently from eb50a56 to 730b75a Compare July 16, 2021 10:05
We passed the package name `greentea` to setuptools to discover the
current package version. This failed because the package name is
actually `mbed-greentea`.
Ignore "imported but unused" warnings for __init__.py files as it's a
common pattern to use __init__.py to export the public API of a package.

Ignore directories we don't want flake8 to traverse.

Ignore docstring errors in the host tests. Docstrings in test
classes are less important than docstrings in production code.
src/htrun/host_tests_conn_proxy/conn_primitive_serial.py Outdated Show resolved Hide resolved
src/htrun/host_tests_conn_proxy/conn_primitive.py Outdated Show resolved Hide resolved
src/htrun/host_tests_conn_proxy/conn_proxy.py Outdated Show resolved Hide resolved
src/htrun/host_tests_conn_proxy/conn_proxy.py Outdated Show resolved Hide resolved
src/htrun/host_tests_runner/host_test_default.py Outdated Show resolved Hide resolved
src/htrun/host_tests_runner/host_test_default.py Outdated Show resolved Hide resolved
src/htrun/host_tests_runner/target_base.py Outdated Show resolved Hide resolved
src/htrun/host_tests/base_host_test.py Outdated Show resolved Hide resolved
@rwalton-arm rwalton-arm requested a review from Patater July 21, 2021 11:25
@rwalton-arm rwalton-arm force-pushed the add_github_actions branch 2 times, most recently from dd176de to d60a8cf Compare July 22, 2021 08:32
src/htrun/host_tests_plugins/__init__.py Outdated Show resolved Hide resolved
src/htrun/host_tests_plugins/host_test_plugins.py Outdated Show resolved Hide resolved
Convert the docstrings to google style and fix the flake8 errors.
Remove unused imports flagged by flake8.
Simplify the logic and remove an unused variable.
Previously we tried to print an undefined variable during exception
handling. We used a bare `except` statement which would suppress all
possible exceptions including SystemExit and KeyboardInterrupt, print an
"Unexpected error" message and forward the exception further up the
stack. This does not seem like desirable behaviour, when a user hits
CTRL-C they probably don't need to see an "Unexpected error" message in
the log. Instead we now catch any exceptions derived from `Exception`
(still not ideal) and print the error message from it.

In another case we defined a local variable for an exception but it
wasn't used, so remove it.
Use raw strings which treat backslashes as literal characters to pass to
the re module.
Catch the "base" non-interpreter exception instead of using bare except.

We need to rework the error handling to only handle errors we care
about. Instead of trying to trap all possible errors, which is an
antipattern in exception based error handling.
Checking True or False by value makes no sense, they are not values.
Instead we should check if we have an "instance" of the True or False
objects.
The workflow contains two matrices to run on PRs:
- lint: code formatting and static analysis
- test: unit tests and code coverage
@Patater Patater merged commit f727e92 into ARMmbed:master Jul 22, 2021
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

Successfully merging this pull request may close these issues.

Fix flake8 errors for htrun Set up Greentea host tools PR testing (GitHub Actions)
3 participants