diff --git a/.github/problem-matchers/autotestwarn.json b/.github/problem-matchers/autotestwarn.json index 6aa77a7ece6ba..1fa9bd1d8abd1 100644 --- a/.github/problem-matchers/autotestwarn.json +++ b/.github/problem-matchers/autotestwarn.json @@ -6,7 +6,7 @@ "severity": "warning", "pattern": [ { - "regexp": "^(.*)(WARN|WARNING):(.*)$", + "regexp": "^(?!.*ExcludedError)(.*)(WARN|WARNING):(.*)$", "column": 1, "code": 2, "message": 3 diff --git a/.github/problem-matchers/python.json b/.github/problem-matchers/python.json index a14ab2dd7610b..c40a205f05429 100644 --- a/.github/problem-matchers/python.json +++ b/.github/problem-matchers/python.json @@ -5,7 +5,7 @@ "owner": "python-problem-matcher", "pattern": [ { - "regexp": "^.*File \\\"([^\\\"]|.*)\\\", line (\\d+).*", + "regexp": "^.*File \\\"((?!Attempt)[^\\\"]|.*)\\\", line (\\d+).*", "file": 1, "line": 2 }, @@ -13,7 +13,7 @@ "regexp": "^.*raise.*$" }, { - "regexp": "^\\s*(.*)\\s*$", + "regexp": "^\\s*((?!Attempt).*)\\s*$", "message": 1 } ] diff --git a/.github/workflows/test_environment.yml b/.github/workflows/test_environment.yml index 1442f2baa8097..c84151418d985 100644 --- a/.github/workflows/test_environment.yml +++ b/.github/workflows/test_environment.yml @@ -32,8 +32,6 @@ jobs: name: focal - os: ubuntu name: jammy - - os: ubuntu - name: mantic - os: ubuntu name: noble - os: archlinux diff --git a/.github/workflows/test_size.yml b/.github/workflows/test_size.yml index 30e7f4bba2a4d..fe83756a3a759 100644 --- a/.github/workflows/test_size.yml +++ b/.github/workflows/test_size.yml @@ -268,7 +268,7 @@ jobs: shell: bash run: | cd pr/ - Tools/scripts/pretty_diff_size.py -m $GITHUB_WORKSPACE/base_branch_bin -s $GITHUB_WORKSPACE/pr_bin + Tools/scripts/build_tests/pretty_diff_size.py -m $GITHUB_WORKSPACE/base_branch_bin -s $GITHUB_WORKSPACE/pr_bin - name: Feature compare with ${{ github.event.pull_request.base.ref }} shell: bash @@ -301,8 +301,26 @@ jobs: Tools/scripts/extract_features.py "$EF_BASE_BRANCH_BINARY" -nm "${BIN_PREFIX}nm" >features-base_branch.txt Tools/scripts/extract_features.py "$EF_PR_BRANCH_BINARY" -nm "${BIN_PREFIX}nm" >features-pr.txt diff -u features-base_branch.txt features-pr.txt || true + diff_output=$(diff -u features-base_branch.txt features-pr.txt || true) + echo "### Features Diff Output" >> $GITHUB_STEP_SUMMARY + if [ -n "$diff_output" ]; then + echo '```diff' >> $GITHUB_STEP_SUMMARY + echo "$diff_output" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + else + echo "No differences found." >> $GITHUB_STEP_SUMMARY + fi - name: Checksum compare with ${{ github.event.pull_request.base.ref }} shell: bash run: | diff -r $GITHUB_WORKSPACE/base_branch_bin_no_versions $GITHUB_WORKSPACE/pr_bin_no_versions --exclude=*.elf --exclude=*.apj || true + diff_output=$(diff -r $GITHUB_WORKSPACE/base_branch_bin_no_versions $GITHUB_WORKSPACE/pr_bin_no_versions --exclude=*.elf --exclude=*.apj || true || true) + echo "### Checksum Diff Output" >> $GITHUB_STEP_SUMMARY + if [ -n "$diff_output" ]; then + echo '```diff' >> $GITHUB_STEP_SUMMARY + echo "$diff_output" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + else + echo "No differences found." >> $GITHUB_STEP_SUMMARY + fi diff --git a/Tools/autotest/vehicle_test_suite.py b/Tools/autotest/vehicle_test_suite.py index 7767ab811c2c7..352cf2709cea1 100644 --- a/Tools/autotest/vehicle_test_suite.py +++ b/Tools/autotest/vehicle_test_suite.py @@ -3318,7 +3318,7 @@ def try_symlink_tlog(self): os.link(self.logfile, self.buildlog) except OSError as error: self.progress("OSError [%d]: %s" % (error.errno, error.strerror)) - self.progress("WARN: Failed to create link: %s => %s, " + self.progress("ExcludedError WARN: Failed to create link: %s => %s, " "will copy tlog manually to target location" % (self.logfile, self.buildlog)) self.copy_tlog = True @@ -8793,9 +8793,12 @@ def run_one_test(self, test, interact=False, suppress_stdout=False): self.progress("Run attempt failed. Retrying") return self.run_one_test_attempt(test, interact=interact, attempt=1, suppress_stdout=suppress_stdout) - def print_exception_caught(self, e, send_statustext=True): - self.progress("Exception caught: %s" % - self.get_exception_stacktrace(e)) + def print_exception_caught(self, e, send_statustext=True, attempt=1): + attempt_str = "" + if attempt > 1: + attempt_str = f"Attempt {attempt}" + + self.progress("%s Exception caught: %s" % (attempt_str, self.get_exception_stacktrace(e))) path = None try: path = self.current_onboard_log_filepath() @@ -8878,7 +8881,7 @@ def run_one_test_attempt(self, test, interact=False, attempt=1, suppress_stdout= test_function(**test_kwargs) except Exception as e: - self.print_exception_caught(e) + self.print_exception_caught(e, attempt=attempt) ex = e # reset the message hooks; we've failed-via-exception and # can't expect the hooks to have been cleaned up diff --git a/Tools/scripts/build_ci.sh b/Tools/scripts/build_ci.sh index 5872135233fb1..e109f47b00959 100755 --- a/Tools/scripts/build_ci.sh +++ b/Tools/scripts/build_ci.sh @@ -10,6 +10,7 @@ if [ -z "$GITHUB_ACTIONS" ] || [ "$GITHUB_ACTIONS" != "true" ]; then fi if [ "$CI" = "true" ]; then + echo "::group::Build_ci.sh Setup" export PIP_ROOT_USER_ACTION=ignore fi @@ -42,16 +43,29 @@ echo "Compiler: $c_compiler" pymavlink_installed=0 mavproxy_installed=0 +if [ "$CI" = "true" ]; then + echo "::endgroup::" +fi + function install_pymavlink() { + if [ "$CI" = "true" ]; then + echo "::group::pymavlink install" + fi if [ $pymavlink_installed -eq 0 ]; then echo "Installing pymavlink" git submodule update --init --recursive --depth 1 (cd modules/mavlink/pymavlink && python3 -m pip install --progress-bar off --cache-dir /tmp/pip-cache --user .) pymavlink_installed=1 fi + if [ "$CI" = "true" ]; then + echo "::endgroup::" + fi } function install_mavproxy() { + if [ "$CI" = "true" ]; then + echo "::group::mavproxy install" + fi if [ $mavproxy_installed -eq 0 ]; then echo "Installing MAVProxy" pushd /tmp @@ -62,7 +76,10 @@ function install_mavproxy() { popd mavproxy_installed=1 # now uninstall the version of pymavlink pulled in by MAVProxy deps: - python3 -m pip uninstall -y pymavlink + python3 -m pip uninstall -y pymavlink --cache-dir /tmp/pip-cache + fi + if [ "$CI" = "true" ]; then + echo "::endgroup::" fi } @@ -70,9 +87,14 @@ function run_autotest() { NAME="$1" BVEHICLE="$2" RVEHICLE="$3" - + if [ "$CI" = "true" ]; then + echo "::group::cpuinfo" + fi # report on what cpu's we have for later log review if needed cat /proc/cpuinfo + if [ "$CI" = "true" ]; then + echo "::endgroup::" + fi install_mavproxy install_pymavlink diff --git a/Tools/scripts/pretty_diff_size.py b/Tools/scripts/build_tests/pretty_diff_size.py similarity index 89% rename from Tools/scripts/pretty_diff_size.py rename to Tools/scripts/build_tests/pretty_diff_size.py index 79598d706fb22..59d0c1eadeacb 100755 --- a/Tools/scripts/pretty_diff_size.py +++ b/Tools/scripts/build_tests/pretty_diff_size.py @@ -90,6 +90,21 @@ def print_table(summary_data_list_second, summary_data_list_master): print_data.append(col_data) print(tabulate(print_data, headers=["Binary Name", "Text [B]", "Data [B]", "BSS (B)", "Total Flash Change [B] (%)", "Flash Free After PR (B)"])) + # Get the GitHub Actions summary file path + summary_file = os.getenv('GITHUB_STEP_SUMMARY') + if summary_file: + # Append the output to the summary file + with open(summary_file, 'a') as f: + f.write("### Diff summary\n") + f.write(tabulate(print_data, headers=[ + "Binary Name", + "Text [B]", + "Data [B]", + "BSS (B)", + "Total Flash Change [B] (%)", + "Flash Free After PR (B)" + ], tablefmt="github")) + f.write("\n") def extract_binaries_size(path): diff --git a/Tools/scripts/build_tests/test_ccache.py b/Tools/scripts/build_tests/test_ccache.py index c0d5543d1ebd0..9abdb22badef6 100755 --- a/Tools/scripts/build_tests/test_ccache.py +++ b/Tools/scripts/build_tests/test_ccache.py @@ -65,11 +65,22 @@ def build_board(boardname): build_board(boards[0]) subprocess.run(["ccache", "-z"]) build_board(boards[1]) -subprocess.run(["ccache", "-s"]) +result = subprocess.run(["ccache", "-s"], capture_output=True, text=True) +print(result.stdout) + +# Get the GitHub Actions summary file path +summary_file = os.getenv('GITHUB_STEP_SUMMARY') post = ccache_stats() hit_pct = 100 * post[0] / float(post[0]+post[1]) print("ccache hit percentage: %.1f%% %s" % (hit_pct, post)) +if summary_file: + # Append the output to the summary file + with open(summary_file, 'a') as f: + f.write(f"### ccache -s Output with {boards}\n") + f.write(f"```\n{result.stdout}\n```\n") + f.write(f"### ccache hit percentage (min {args.min_cache_pct})\n") + f.write("ccache hit percentage: %.1f%% %s\n" % (hit_pct, post)) if hit_pct < args.min_cache_pct: print("ccache hits too low, need %d%%" % args.min_cache_pct) sys.exit(1) diff --git a/wscript b/wscript index fff0a563f2111..2d01864f22bde 100644 --- a/wscript +++ b/wscript @@ -82,6 +82,10 @@ Build.BuildContext.execute = ardupilotwaf.ap_autoconfigure(Build.BuildContext.ex Configure.ConfigurationContext.post_recurse = ardupilotwaf.ap_configure_post_recurse() +# Get the GitHub Actions summary file path +is_ci = os.getenv('CI') + + def _set_build_context_variant(board): for c in Context.classes: if not issubclass(c, Build.BuildContext): @@ -476,6 +480,8 @@ def _collect_autoconfig_files(cfg): cfg.files.append(p) def configure(cfg): + if is_ci: + print(f"::group::Waf Configure") # we need to enable debug mode when building for gconv, and force it to sitl if cfg.options.board is None: cfg.options.board = 'sitl' @@ -651,6 +657,8 @@ def configure(cfg): cfg.remove_target_list() _collect_autoconfig_files(cfg) + if is_ci: + print("::endgroup::") def collect_dirs_to_recurse(bld, globs, **kw): dirs = [] @@ -876,6 +884,8 @@ def _load_pre_build(bld): brd.pre_build(bld) def build(bld): + if is_ci: + print(f"::group::Waf Build") config_hash = Utils.h_file(bld.bldnode.make_node('ap_config.h').abspath()) bld.env.CCDEPS = config_hash bld.env.CXXDEPS = config_hash @@ -911,6 +921,11 @@ def build(bld): _build_recursion(bld) _build_post_funs(bld) + if is_ci: + def print_ci_endgroup(bld): + print(f"::endgroup::") + bld.add_post_fun(print_ci_endgroup) + ardupilotwaf.build_command('check', program_group_list='all',