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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,24 @@
# black, the super-great auto-formatter has decided that 88 is a good number.
# I'm inclined to agree, or not to dissagree.
max-line-length = 88
docstring-convention = google
exclude =
.git,
.tox,
.venv,
__pycache__,
dist,
test/*,
ignore =
# W503: line break before binary operator (this is no longer PEP8 compliant)
W503,
# E203: whitespace before ':' (this is not PEP8 compliant)
E203,
per-file-ignores =
# Package level __init__ files improve user experience by short cutting
# imports.
# F401: imported but unused
__init__.py:F401
src/htrun/*/__init__.py:F401
# We don't care about docstrings in test classes
src/htrun/host_tests/*: D
60 changes: 60 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Test greentea tools

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.9]

steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install tox
run: pip install tox

- name: Code Formatting and Static Analysis
run: tox -e linting


test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.9]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch history so setuptools-scm can calculate the version correctly
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install tox
run: pip install tox

- name: Run tests on ${{ matrix.os }} py ${{ matrix.python-version }}
run: tox -e py

- name: Create Coverage Report
run: |
set -xe
python -m pip install coverage[toml]
python -m coverage xml
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9

- name: Upload Coverage Report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9
uses: "codecov/codecov-action@v1"
with:
fail_ci_if_error: true
1 change: 1 addition & 0 deletions src/greentea/gtea/greentea_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def gt_log(self, text, print_text=True):
Args:
text: String to be logged.
print_text: Force log to be printed on screen.

Returns:
String with message.
"""
Expand Down
1 change: 1 addition & 0 deletions src/greentea/gtea/target_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def _platform_property_from_targets_json(targets, platform, property):
targets: Data structure from targets.json.
platform: Name of the platform.
property: Name of the property.

Returns:
Property value, None if not found.

Expand Down
1 change: 1 addition & 0 deletions src/greentea/gtea/tests_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def add_binary(self, path, binary_type, compare_log=None):
Args:
path: Path to the binary.
binary_type: Type of binary being added.
compare_log: Log to match output from.
"""
self.__binaries_by_flash_method[binary_type] = TestBinary(
path, binary_type, compare_log
Expand Down
20 changes: 11 additions & 9 deletions src/htrun/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
# SPDX-License-Identifier: Apache-2.0
#

"""The htrun package.

"""! @package htrun

Flash, reset and perform host supervised tests on Mbed enabled platforms.
Write your own programs (import this package) or use 'htrun'
command line tool instead.

Flash, reset and perform host supervised tests on Mbed enabled platforms.
Write your own programs (import this package) or use 'htrun' command line tool
instead.
"""

import imp
Expand All @@ -29,6 +27,7 @@


def get_plugin_caps(methods=None):
"""Return the capabilities of a plugin."""
if not methods:
methods = ["CopyMethod", "ResetMethod"]
result = {}
Expand All @@ -38,9 +37,12 @@ def get_plugin_caps(methods=None):


def init_host_test_cli_params():
"""! Function creates CLI parser object and returns populated options object.
@return Function returns 'options' object returned from OptionParser class
@details Options object later can be used to populate host test selector script.
"""Create CLI parser object and return populated options object.

Options object can be used to populate host test selector script.

Returns:
'options' object returned from OptionParser class.
"""
parser = OptionParser()

Expand Down
2 changes: 1 addition & 1 deletion src/htrun/host_tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# Copyright (c) 2021 Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""Base host test class."""

# base host test class
from .base_host_test import BaseHostTest, event_callback
Loading