From 282346701684acd058d032a6013b3d1d7dfe53c3 Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Tue, 10 Oct 2023 14:30:46 +0200 Subject: [PATCH 1/7] Tools: add junit output for autotest --- Tools/autotest/autotest.py | 9 +++++-- Tools/autotest/common.py | 51 +++++++++++++++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/Tools/autotest/autotest.py b/Tools/autotest/autotest.py index 84c5884e070db..fec0c53114e8d 100755 --- a/Tools/autotest/autotest.py +++ b/Tools/autotest/autotest.py @@ -382,7 +382,7 @@ def run_specific_test(step, *args, **kwargs): a = Test(a) print("Got %s" % (a.name)) if a.name == test: - return (tester.autotest(tests=[a], allow_skips=False), tester) + return tester.autotest(tests=[a], allow_skips=False, step_name=step), tester print("Failed to find test %s on %s" % (test, testname)) sys.exit(1) @@ -506,6 +506,7 @@ def run_step(step): "sup_binaries": supplementary_binaries, "reset_after_every_test": opts.reset_after_every_test, "build_opts": copy.copy(build_opts), + "generate_junit": opts.junit, } if opts.speedup is not None: fly_opts["speedup"] = opts.speedup @@ -516,7 +517,7 @@ def run_step(step): global tester tester = tester_class_map[step](binary, **fly_opts) # run the test and return its result and the tester itself - return (tester.autotest(), tester) + return tester.autotest(None, step_name=step), tester # handle "test.Copter.CPUFailsafe" etc: specific_test_to_run = find_specific_test_to_run(step) @@ -884,6 +885,10 @@ def format_epilog(self, formatter): action='store_true', default=False, help='configure with --Werror') + parser.add_option("--junit", + default=False, + action='store_true', + help='Generate Junit XML tests report') group_build = optparse.OptionGroup(parser, "Build options") group_build.add_option("--no-configure", diff --git a/Tools/autotest/common.py b/Tools/autotest/common.py index 14d6142fccfea..f5bc595d813bc 100644 --- a/Tools/autotest/common.py +++ b/Tools/autotest/common.py @@ -18,6 +18,9 @@ import sys import time import traceback +from datetime import datetime +from typing import List + import pexpect import fnmatch import operator @@ -1466,6 +1469,7 @@ def __init__(self, test): self.reason = None self.exception = None self.debug_filename = None + self.time_elapsed = 0.0 # self.passed = False def __str__(self): @@ -1478,7 +1482,8 @@ def __str__(self): ret += " (" + str(self.exception) + ")" if self.debug_filename is not None: ret += " (see " + self.debug_filename + ")" - + if self.time_elapsed is not None: + ret += " (duration " + self.time_elapsed + "s)" return ret @@ -1512,6 +1517,7 @@ def __init__(self, ubsan_abort=False, num_aux_imus=0, dronecan_tests=False, + generate_junit=False, build_opts={}): self.start_time = time.time() @@ -1540,6 +1546,12 @@ def __init__(self, self.ubsan_abort = ubsan_abort self.build_opts = build_opts self.num_aux_imus = num_aux_imus + self.generate_junit = generate_junit + if generate_junit: + try: + import junitparser + except ImportError as e: + raise ImportError(f"Junit export need junitparser package.\n {e} \nTry: python -m pip install junitparser") self.mavproxy = None self._mavproxy = None # for auto-cleanup on failed tests @@ -7968,6 +7980,7 @@ def run_one_test_attempt(self, test, interact=False, attempt=1, suppress_stdout= passed = False result = Result(test) + result.time_elapsed = self.test_timings[desc] ardupilot_alive = False try: @@ -11271,7 +11284,7 @@ def assert_current_onboard_log_contains_message(self, messagetype): if not self.current_onboard_log_contains_message(messagetype): raise NotAchievedException("Current onboard log does not contain message %s" % messagetype) - def run_tests(self, tests): + def run_tests(self, tests) -> List[Result]: """Autotest vehicle in SITL.""" if self.run_tests_called: raise ValueError("run_tests called twice") @@ -13497,7 +13510,7 @@ def post_tests_announcements(self): print("Had to force-reset SITL %u times" % (self.forced_post_test_sitl_reboots,)) - def autotest(self, tests=None, allow_skips=True): + def autotest(self, tests=None, allow_skips=True, step_name=None): """Autotest used by ArduPilot autotest CI.""" if tests is None: tests = self.tests() @@ -13538,9 +13551,41 @@ def autotest(self, tests=None, allow_skips=True): print(str(failure)) self.post_tests_announcements() + if self.generate_junit: + if step_name is None: + step_name = "Unknown_step_name" + step_name.replace(".", "_") + self.create_junit_report(step_name, results, skip_list) return len(self.fail_list) == 0 + def create_junit_report(self, test_name: str, results: List[Result], skip_list: list[tuple[Test, dict[str, str]]]) -> None: + """Generate Junit report from the autotest results""" + from junitparser import TestCase, TestSuite, JUnitXml, Skipped, Failure + frame = self.vehicleinfo_key() + xml_filename = f"autotest_result_{frame}_{test_name}_junit.xml" + self.progress(f"Writing test result in jUnit format to {xml_filename}\n") + + suites = TestSuite("ArduPilot Autotest") + suites.timestamp = datetime.now().replace(microsecond=0).isoformat() + suite = TestSuite(f"Autotest {frame} {test_name}") + for result in results: + case = TestCase(f"{result.test.name}", f"{frame}", result.time_elapsed) + # f"{result.test.description}" + # case.file ## TODO : add file properties to match test location + if not result.passed: + case.result = [Failure(f"see {result.debug_filename}", f"{result.exception}")] + suite.add_testcase(case) + for skipped in skip_list: + (test, reason) = skipped + case = TestCase(f"{test.name}", f"{test.function}") + case.result = [Skipped(f"Skipped : {reason}")] + # Add suite to JunitXml + xml = JUnitXml() + xml.add_testsuite(suites) + xml.add_testsuite(suite) + xml.write(xml_filename, pretty=True) + def mavfft_fttd(self, sensor_type, sensor_instance, since, until): '''display fft for raw ACC data in current logfile''' From a06557a007bd53a5bed632f9ce7fd702a6da3633 Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Thu, 19 Oct 2023 22:38:53 +0200 Subject: [PATCH 2/7] Tools: add junitparser to default install skip-checks: true --- Tools/environment_install/install-prereqs-mac.sh | 2 +- Tools/environment_install/install-prereqs-ubuntu.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tools/environment_install/install-prereqs-mac.sh b/Tools/environment_install/install-prereqs-mac.sh index 906ad0022a0bd..5471e6f175e6e 100755 --- a/Tools/environment_install/install-prereqs-mac.sh +++ b/Tools/environment_install/install-prereqs-mac.sh @@ -159,7 +159,7 @@ if [[ $DO_AP_STM_ENV -eq 1 ]]; then install_arm_none_eabi_toolchain fi -PYTHON_PKGS="future lxml pymavlink MAVProxy pexpect geocoder flake8 empy dronecan" +PYTHON_PKGS="future lxml pymavlink MAVProxy pexpect geocoder flake8 junitparser empy dronecan" # add some Python packages required for commonly-used MAVProxy modules and hex file generation: if [[ $SKIP_AP_EXT_ENV -ne 1 ]]; then PYTHON_PKGS="$PYTHON_PKGS intelhex gnureadline" diff --git a/Tools/environment_install/install-prereqs-ubuntu.sh b/Tools/environment_install/install-prereqs-ubuntu.sh index 65c84f229b850..6fa833120a0ff 100755 --- a/Tools/environment_install/install-prereqs-ubuntu.sh +++ b/Tools/environment_install/install-prereqs-ubuntu.sh @@ -153,7 +153,7 @@ fi # Lists of packages to install BASE_PKGS="build-essential ccache g++ gawk git make wget valgrind screen" PYTHON_PKGS="future lxml pymavlink pyserial MAVProxy pexpect geocoder empy ptyprocess dronecan" -PYTHON_PKGS="$PYTHON_PKGS flake8" +PYTHON_PKGS="$PYTHON_PKGS flake8 junitparser" # add some Python packages required for commonly-used MAVProxy modules and hex file generation: if [[ $SKIP_AP_EXT_ENV -ne 1 ]]; then From ce6431b27c99215f6d9cf3ccd8d572293478f694 Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Thu, 19 Oct 2023 22:40:06 +0200 Subject: [PATCH 3/7] .ignore: remove junit xml files --- .dockerignore | 1 + .gitignore | 1 + 2 files changed, 2 insertions(+) diff --git a/.dockerignore b/.dockerignore index d7de4ddfc3cde..7b3ececc07c4e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -28,3 +28,4 @@ mav.* !Tools/environment_install/install-prereqs-ubuntu.sh !Tools/environment_install/install-prereqs-arch.sh !Tools/completion +autotest_result_*_junit.xml \ No newline at end of file diff --git a/.gitignore b/.gitignore index 42d336cd2a66e..7046032dcd48a 100644 --- a/.gitignore +++ b/.gitignore @@ -164,3 +164,4 @@ venv/ ENV/ env.bak/ venv.bak/ +autotest_result_*_junit.xml From 05dc8fa2fdd13d069c1599b8b8603cc9591b16e8 Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Thu, 19 Oct 2023 22:41:50 +0200 Subject: [PATCH 4/7] Tools: make CI output junit xml results --- Tools/scripts/build_ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/scripts/build_ci.sh b/Tools/scripts/build_ci.sh index 4ae65daff8212..3011ce83d2b55 100755 --- a/Tools/scripts/build_ci.sh +++ b/Tools/scripts/build_ci.sh @@ -89,7 +89,7 @@ function run_autotest() { if [ "$NAME" == "Examples" ]; then w="$w --speedup=5 --timeout=14400 --debug --no-clean" fi - Tools/autotest/autotest.py --show-test-timings --waf-configure-args="$w" "$BVEHICLE" "$RVEHICLE" + Tools/autotest/autotest.py --show-test-timings --junit --waf-configure-args="$w" "$BVEHICLE" "$RVEHICLE" ccache -s && ccache -z } From 1a4133744087315e6c667fcda40d6d64f0d85040 Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Thu, 19 Oct 2023 22:50:25 +0200 Subject: [PATCH 5/7] .github: move containers to v0.1.1 to include junitparser --- .github/workflows/test_ccache.yml | 2 +- .github/workflows/test_chibios.yml | 2 +- .github/workflows/test_coverage.yml | 2 +- .github/workflows/test_linux_sbc.yml | 2 +- .github/workflows/test_replay.yml | 2 +- .github/workflows/test_scripting.yml | 2 +- .github/workflows/test_scripts.yml | 2 +- .github/workflows/test_sitl_blimp.yml | 4 ++-- .github/workflows/test_sitl_copter.yml | 8 ++++---- .github/workflows/test_sitl_periph.yml | 4 ++-- .github/workflows/test_sitl_plane.yml | 4 ++-- .github/workflows/test_sitl_rover.yml | 4 ++-- .github/workflows/test_sitl_sub.yml | 4 ++-- .github/workflows/test_sitl_tracker.yml | 4 ++-- .github/workflows/test_size.yml | 2 +- .github/workflows/test_unit_tests.yml | 2 +- 16 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/test_ccache.yml b/.github/workflows/test_ccache.yml index fabff75687c47..36ca816eaadf1 100644 --- a/.github/workflows/test_ccache.yml +++ b/.github/workflows/test_ccache.yml @@ -126,7 +126,7 @@ concurrency: jobs: build: runs-on: ubuntu-22.04 - container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.0 + container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.1 strategy: fail-fast: false # don't cancel if a job from the matrix fails matrix: diff --git a/.github/workflows/test_chibios.yml b/.github/workflows/test_chibios.yml index 97a405eec79f0..09f6d5a10ee88 100644 --- a/.github/workflows/test_chibios.yml +++ b/.github/workflows/test_chibios.yml @@ -134,7 +134,7 @@ concurrency: jobs: build: runs-on: ubuntu-22.04 - container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.0 + container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.1 strategy: fail-fast: false # don't cancel if a job from the matrix fails matrix: diff --git a/.github/workflows/test_coverage.yml b/.github/workflows/test_coverage.yml index 508e2cb99cf39..2e07da61098eb 100644 --- a/.github/workflows/test_coverage.yml +++ b/.github/workflows/test_coverage.yml @@ -15,7 +15,7 @@ jobs: build: runs-on: ubuntu-22.04 container: - image: ardupilot/ardupilot-dev-${{ matrix.type }}:v0.1.0 + image: ardupilot/ardupilot-dev-${{ matrix.type }}:v0.1.1 options: --privileged strategy: fail-fast: false # don't cancel if a job from the matrix fails diff --git a/.github/workflows/test_linux_sbc.yml b/.github/workflows/test_linux_sbc.yml index 1c2259f3532a1..9c10af1e95187 100644 --- a/.github/workflows/test_linux_sbc.yml +++ b/.github/workflows/test_linux_sbc.yml @@ -135,7 +135,7 @@ concurrency: jobs: build: runs-on: ubuntu-22.04 - container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.0 + container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.1 strategy: fail-fast: false # don't cancel if a job from the matrix fails matrix: diff --git a/.github/workflows/test_replay.yml b/.github/workflows/test_replay.yml index 1cd0b1c6afb60..aace7b06c686b 100644 --- a/.github/workflows/test_replay.yml +++ b/.github/workflows/test_replay.yml @@ -148,7 +148,7 @@ concurrency: jobs: build: runs-on: ubuntu-22.04 - container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.0 + container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.1 strategy: fail-fast: false # don't cancel if a job from the matrix fails matrix: diff --git a/.github/workflows/test_scripting.yml b/.github/workflows/test_scripting.yml index c8d4b17c8255b..8f6a4d0b91c88 100644 --- a/.github/workflows/test_scripting.yml +++ b/.github/workflows/test_scripting.yml @@ -22,7 +22,7 @@ concurrency: jobs: test-scripting: runs-on: ubuntu-22.04 - container: ardupilot/ardupilot-dev-base:v0.1.0 + container: ardupilot/ardupilot-dev-base:v0.1.1 steps: # git checkout the PR - uses: actions/checkout@v3 diff --git a/.github/workflows/test_scripts.yml b/.github/workflows/test_scripts.yml index 1728f5facd1db..c106c293f9bd1 100644 --- a/.github/workflows/test_scripts.yml +++ b/.github/workflows/test_scripts.yml @@ -9,7 +9,7 @@ concurrency: jobs: build: runs-on: ubuntu-22.04 - container: ardupilot/ardupilot-dev-base:v0.1.0 + container: ardupilot/ardupilot-dev-base:v0.1.1 strategy: fail-fast: false # don't cancel if a job from the matrix fails matrix: diff --git a/.github/workflows/test_sitl_blimp.yml b/.github/workflows/test_sitl_blimp.yml index 7343f4b81ebde..b346efdcbe699 100644 --- a/.github/workflows/test_sitl_blimp.yml +++ b/.github/workflows/test_sitl_blimp.yml @@ -207,9 +207,9 @@ jobs: autotest: needs: build # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 container: - image: ardupilot/ardupilot-dev-base:v0.0.29 + image: ardupilot/ardupilot-dev-base:v0.1.1 options: --privileged --cap-add=SYS_PTRACE --security-opt apparmor=unconfined --security-opt seccomp=unconfined strategy: fail-fast: false # don't cancel if a job from the matrix fails diff --git a/.github/workflows/test_sitl_copter.yml b/.github/workflows/test_sitl_copter.yml index 9783a04c3d9ac..c2133a5a1d499 100644 --- a/.github/workflows/test_sitl_copter.yml +++ b/.github/workflows/test_sitl_copter.yml @@ -161,7 +161,7 @@ concurrency: jobs: build: runs-on: ubuntu-22.04 - container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.0 + container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.1 strategy: fail-fast: false # don't cancel if a job from the matrix fails matrix: @@ -207,7 +207,7 @@ jobs: needs: build # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build runs-on: ubuntu-22.04 container: - image: ardupilot/ardupilot-dev-base:v0.1.0 + image: ardupilot/ardupilot-dev-base:v0.1.1 options: --privileged --cap-add=SYS_PTRACE --security-opt apparmor=unconfined --security-opt seccomp=unconfined strategy: fail-fast: false # don't cancel if a job from the matrix fails @@ -275,7 +275,7 @@ jobs: build-gcc-heli: runs-on: ubuntu-22.04 container: - image: ardupilot/ardupilot-dev-base:v0.1.0 + image: ardupilot/ardupilot-dev-base:v0.1.1 options: --privileged --cap-add=SYS_PTRACE --security-opt apparmor=unconfined --security-opt seccomp=unconfined steps: # git checkout the PR @@ -310,7 +310,7 @@ jobs: autotest-heli: needs: build-gcc-heli # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build runs-on: ubuntu-22.04 - container: ardupilot/ardupilot-dev-base:v0.1.0 + container: ardupilot/ardupilot-dev-base:v0.1.1 strategy: fail-fast: false # don't cancel if a job from the matrix fails matrix: diff --git a/.github/workflows/test_sitl_periph.yml b/.github/workflows/test_sitl_periph.yml index d3bd91ff2c4fd..d53bbc54a2b9a 100644 --- a/.github/workflows/test_sitl_periph.yml +++ b/.github/workflows/test_sitl_periph.yml @@ -160,7 +160,7 @@ concurrency: jobs: build-gcc-ap_periph: runs-on: ubuntu-22.04 - container: ardupilot/ardupilot-dev-periph:v0.1.0 + container: ardupilot/ardupilot-dev-periph:v0.1.1 steps: # git checkout the PR - uses: actions/checkout@v3 @@ -201,7 +201,7 @@ jobs: needs: build-gcc-ap_periph # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build runs-on: ubuntu-22.04 container: - image: ardupilot/ardupilot-dev-periph:v0.1.0 + image: ardupilot/ardupilot-dev-periph:v0.1.1 options: --privileged strategy: fail-fast: false # don't cancel if a job from the matrix fails diff --git a/.github/workflows/test_sitl_plane.yml b/.github/workflows/test_sitl_plane.yml index 24a48476c102a..66bb9a7ebf3b1 100644 --- a/.github/workflows/test_sitl_plane.yml +++ b/.github/workflows/test_sitl_plane.yml @@ -162,7 +162,7 @@ concurrency: jobs: build: runs-on: ubuntu-22.04 - container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.0 + container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.1 strategy: fail-fast: false # don't cancel if a job from the matrix fails matrix: @@ -208,7 +208,7 @@ jobs: needs: build # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build runs-on: ubuntu-22.04 container: - image: ardupilot/ardupilot-dev-base:v0.1.0 + image: ardupilot/ardupilot-dev-base:v0.1.1 options: --privileged --cap-add=SYS_PTRACE --security-opt apparmor=unconfined --security-opt seccomp=unconfined strategy: fail-fast: false # don't cancel if a job from the matrix fails diff --git a/.github/workflows/test_sitl_rover.yml b/.github/workflows/test_sitl_rover.yml index 5ca2fa60ace72..a6f3d669b3276 100644 --- a/.github/workflows/test_sitl_rover.yml +++ b/.github/workflows/test_sitl_rover.yml @@ -161,7 +161,7 @@ concurrency: jobs: build: runs-on: ubuntu-22.04 - container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.0 + container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.1 strategy: fail-fast: false # don't cancel if a job from the matrix fails matrix: @@ -207,7 +207,7 @@ jobs: needs: build # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build runs-on: ubuntu-22.04 container: - image: ardupilot/ardupilot-dev-base:v0.1.0 + image: ardupilot/ardupilot-dev-base:v0.1.1 options: --privileged --cap-add=SYS_PTRACE --security-opt apparmor=unconfined --security-opt seccomp=unconfined strategy: fail-fast: false # don't cancel if a job from the matrix fails diff --git a/.github/workflows/test_sitl_sub.yml b/.github/workflows/test_sitl_sub.yml index 57d69d575d2f4..cbe5aaddf1b02 100644 --- a/.github/workflows/test_sitl_sub.yml +++ b/.github/workflows/test_sitl_sub.yml @@ -164,7 +164,7 @@ concurrency: jobs: build: runs-on: ubuntu-22.04 - container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.0 + container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.1 strategy: fail-fast: false # don't cancel if a job from the matrix fails matrix: @@ -210,7 +210,7 @@ jobs: needs: build # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build runs-on: ubuntu-22.04 container: - image: ardupilot/ardupilot-dev-base:v0.1.0 + image: ardupilot/ardupilot-dev-base:v0.1.1 options: --privileged --cap-add=SYS_PTRACE --security-opt apparmor=unconfined --security-opt seccomp=unconfined strategy: fail-fast: false # don't cancel if a job from the matrix fails diff --git a/.github/workflows/test_sitl_tracker.yml b/.github/workflows/test_sitl_tracker.yml index c869fb2d66a6a..8191e57483bf5 100644 --- a/.github/workflows/test_sitl_tracker.yml +++ b/.github/workflows/test_sitl_tracker.yml @@ -164,7 +164,7 @@ concurrency: jobs: build: runs-on: ubuntu-22.04 - container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.0 + container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.1 strategy: fail-fast: false # don't cancel if a job from the matrix fails matrix: @@ -210,7 +210,7 @@ jobs: needs: build # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build runs-on: ubuntu-22.04 container: - image: ardupilot/ardupilot-dev-base:v0.1.0 + image: ardupilot/ardupilot-dev-base:v0.1.1 options: --privileged --cap-add=SYS_PTRACE --security-opt apparmor=unconfined --security-opt seccomp=unconfined strategy: fail-fast: false # don't cancel if a job from the matrix fails diff --git a/.github/workflows/test_size.yml b/.github/workflows/test_size.yml index 84bb5bb154ec8..03758fc24748b 100644 --- a/.github/workflows/test_size.yml +++ b/.github/workflows/test_size.yml @@ -61,7 +61,7 @@ concurrency: jobs: build: runs-on: ubuntu-22.04 - container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.0 + container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.1 strategy: fail-fast: false # don't cancel if a job from the matrix fails matrix: diff --git a/.github/workflows/test_unit_tests.yml b/.github/workflows/test_unit_tests.yml index f843f07960b87..02b174336f945 100644 --- a/.github/workflows/test_unit_tests.yml +++ b/.github/workflows/test_unit_tests.yml @@ -101,7 +101,7 @@ jobs: build: runs-on: ubuntu-22.04 container: - image: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.0 + image: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.1 options: --user 1001 strategy: fail-fast: false # don't cancel if a job from the matrix fails From 5a6c0d79115ff1b56f70b02cf8c5847d2e3332e3 Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Thu, 19 Oct 2023 23:11:17 +0200 Subject: [PATCH 6/7] Tools: fix flake8 issue --- Tools/autotest/common.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tools/autotest/common.py b/Tools/autotest/common.py index f5bc595d813bc..54add15e00dc1 100644 --- a/Tools/autotest/common.py +++ b/Tools/autotest/common.py @@ -20,6 +20,7 @@ import traceback from datetime import datetime from typing import List +import importlib.util import pexpect import fnmatch @@ -1549,7 +1550,9 @@ def __init__(self, self.generate_junit = generate_junit if generate_junit: try: - import junitparser + spec = importlib.util.find_spec("junitparser") + if spec is None: + raise ImportError except ImportError as e: raise ImportError(f"Junit export need junitparser package.\n {e} \nTry: python -m pip install junitparser") From f24f8b75a04109e688870cbf5bb1c76b0b7bdaf6 Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Thu, 19 Oct 2023 22:42:49 +0200 Subject: [PATCH 7/7] .github: use a junit report for simpler PR checks --- .github/workflows/test-report.yml | 52 +++++++++++++++++++++++++ .github/workflows/test_sitl_blimp.yml | 6 +++ .github/workflows/test_sitl_copter.yml | 14 +++++++ .github/workflows/test_sitl_plane.yml | 6 +++ .github/workflows/test_sitl_rover.yml | 6 +++ .github/workflows/test_sitl_sub.yml | 6 +++ .github/workflows/test_sitl_tracker.yml | 6 +++ .github/workflows/test_unit_tests.yml | 7 ++++ 8 files changed, 103 insertions(+) create mode 100644 .github/workflows/test-report.yml diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml new file mode 100644 index 0000000000000..e20701e3d9258 --- /dev/null +++ b/.github/workflows/test-report.yml @@ -0,0 +1,52 @@ +name: 'Test Report' +on: + workflow_run: + workflows: [ + 'test unit tests and sitl building', + 'test blimp', + 'test plane', + 'test rover', + 'test sub', + 'test tracker', + 'test copter' ] # runs after CI workflow + types: + - completed + +permissions: + contents: read + actions: read + checks: write + +jobs: + report: + runs-on: ubuntu-latest +# strategy: +# fail-fast: false # don't cancel if a job from the matrix fails +# matrix: +# config: [ +# sitltest-plane, +# sitltest-quadplane, +# sitltest-copter-tests1a, +# sitltest-copter-tests1b, +# sitltest-copter-tests1c, +# sitltest-copter-tests1d, +# sitltest-copter-tests1e, +# sitltest-copter-tests2a, +# sitltest-copter-tests2b, +# sitltest-heli, +# sitltest-blimp, +# sitltest-rover, +# sitltest-sailboat, +# sitltest-balancebot, +# sitltest-sub, +# sitltest-tracker, +# base-unit-tests, +# ] + + steps: + - uses: dorny/test-reporter@v1 + with: + artifact: /test-results-junit-(.*)/ # artifact name + name: Tests Report $1 # Name of the check run which will be created + path: '*.xml' # Path to test results (inside artifact .zip) + reporter: java-junit # Format of test results diff --git a/.github/workflows/test_sitl_blimp.yml b/.github/workflows/test_sitl_blimp.yml index b346efdcbe699..ba32da000d9c9 100644 --- a/.github/workflows/test_sitl_blimp.yml +++ b/.github/workflows/test_sitl_blimp.yml @@ -268,3 +268,9 @@ jobs: path: /__w/ardupilot/ardupilot/logs retention-days: 7 + - uses: actions/upload-artifact@v3 # upload test results + if: success() || failure() # run this step even if previous step failed + with: + name: test-results-junit-${{matrix.config}} + path: /__w/ardupilot/ardupilot/autotest_result_*_junit.xml + retention-days: 1 diff --git a/.github/workflows/test_sitl_copter.yml b/.github/workflows/test_sitl_copter.yml index c2133a5a1d499..681fdf31698a3 100644 --- a/.github/workflows/test_sitl_copter.yml +++ b/.github/workflows/test_sitl_copter.yml @@ -272,6 +272,13 @@ jobs: path: /__w/ardupilot/ardupilot/logs retention-days: 7 + - uses: actions/upload-artifact@v3 # upload test results + if: success() || failure() # run this step even if previous step failed + with: + name: test-results-junit + path: /__w/ardupilot/ardupilot/autotest_result_*_junit.xml + retention-days: 1 + build-gcc-heli: runs-on: ubuntu-22.04 container: @@ -367,3 +374,10 @@ jobs: name: BIN-${{matrix.config}} path: /__w/ardupilot/ardupilot/logs retention-days: 7 + + - uses: actions/upload-artifact@v3 # upload test results + if: success() || failure() # run this step even if previous step failed + with: + name: test-results-junit-${{matrix.config}} + path: /__w/ardupilot/ardupilot/autotest_result_*_junit.xml + retention-days: 1 diff --git a/.github/workflows/test_sitl_plane.yml b/.github/workflows/test_sitl_plane.yml index 66bb9a7ebf3b1..1e5e369fbfaf5 100644 --- a/.github/workflows/test_sitl_plane.yml +++ b/.github/workflows/test_sitl_plane.yml @@ -268,3 +268,9 @@ jobs: path: /__w/ardupilot/ardupilot/logs retention-days: 7 + - uses: actions/upload-artifact@v3 # upload test results + if: success() || failure() # run this step even if previous step failed + with: + name: test-results-junit-${{matrix.config}} + path: /__w/ardupilot/ardupilot/autotest_result_*_junit.xml + retention-days: 1 diff --git a/.github/workflows/test_sitl_rover.yml b/.github/workflows/test_sitl_rover.yml index a6f3d669b3276..23c82ccfcca70 100644 --- a/.github/workflows/test_sitl_rover.yml +++ b/.github/workflows/test_sitl_rover.yml @@ -268,3 +268,9 @@ jobs: path: /__w/ardupilot/ardupilot/logs retention-days: 7 + - uses: actions/upload-artifact@v3 # upload test results + if: success() || failure() # run this step even if previous step failed + with: + name: test-results-junit-${{matrix.config}} + path: /__w/ardupilot/ardupilot/autotest_result_*_junit.xml + retention-days: 1 diff --git a/.github/workflows/test_sitl_sub.yml b/.github/workflows/test_sitl_sub.yml index cbe5aaddf1b02..5f8d6d9470461 100644 --- a/.github/workflows/test_sitl_sub.yml +++ b/.github/workflows/test_sitl_sub.yml @@ -269,3 +269,9 @@ jobs: path: /__w/ardupilot/ardupilot/logs retention-days: 7 + - uses: actions/upload-artifact@v3 # upload test results + if: success() || failure() # run this step even if previous step failed + with: + name: test-results-junit-${{matrix.config}} + path: /__w/ardupilot/ardupilot/autotest_result_*_junit.xml + retention-days: 1 diff --git a/.github/workflows/test_sitl_tracker.yml b/.github/workflows/test_sitl_tracker.yml index 8191e57483bf5..8376887e9ea25 100644 --- a/.github/workflows/test_sitl_tracker.yml +++ b/.github/workflows/test_sitl_tracker.yml @@ -269,3 +269,9 @@ jobs: path: /__w/ardupilot/ardupilot/logs retention-days: 7 + - uses: actions/upload-artifact@v3 # upload test results + if: success() || failure() # run this step even if previous step failed + with: + name: test-results-junit-${{matrix.config}} + path: /__w/ardupilot/ardupilot/autotest_result_*_junit.xml + retention-days: 1 diff --git a/.github/workflows/test_unit_tests.yml b/.github/workflows/test_unit_tests.yml index 02b174336f945..ce9d868e146e7 100644 --- a/.github/workflows/test_unit_tests.yml +++ b/.github/workflows/test_unit_tests.yml @@ -155,3 +155,10 @@ jobs: name: fail-${{ matrix.toolchain }}-${{matrix.config}} path: /tmp/buildlogs retention-days: 14 + + - uses: actions/upload-artifact@v3 # upload test results + if: success() || failure() # run this step even if previous step failed + with: + name: test-results-junit-${{ matrix.toolchain }}-${{matrix.config}} + path: /__w/ardupilot/ardupilot/autotest_result_*_junit.xml + retention-days: 1