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

Feature/github2 #23

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion .github/problem-matchers/autotestwarn.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"severity": "warning",
"pattern": [
{
"regexp": "^(.*)(WARN|WARNING):(.*)$",
"regexp": "^(?!.*ExcludedError)(.*)(WARN|WARNING):(.*)$",
"column": 1,
"code": 2,
"message": 3
Expand Down
4 changes: 2 additions & 2 deletions .github/problem-matchers/python.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"owner": "python-problem-matcher",
"pattern": [
{
"regexp": "^.*File \\\"([^\\\"]|.*)\\\", line (\\d+).*",
"regexp": "^.*File \\\"((?!Attempt)[^\\\"]|.*)\\\", line (\\d+).*",
"file": 1,
"line": 2
},
{
"regexp": "^.*raise.*$"
},
{
"regexp": "^\\s*(.*)\\s*$",
"regexp": "^\\s*((?!Attempt).*)\\s*$",
"message": 1
}
]
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/test_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ jobs:
name: focal
- os: ubuntu
name: jammy
- os: ubuntu
name: mantic
- os: ubuntu
name: noble
- os: archlinux
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/test_size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
13 changes: 8 additions & 5 deletions Tools/autotest/vehicle_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
26 changes: 24 additions & 2 deletions Tools/scripts/build_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -62,17 +76,25 @@ 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
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
13 changes: 12 additions & 1 deletion Tools/scripts/build_tests/test_ccache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 15 additions & 0 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down
Loading