mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-11 07:18:45 +08:00
96461cdd7d
Build all targets / Scan for Board Targets (push) Waiting to run
Build all targets / Build Group [${{ matrix.group }}] (push) Blocked by required conditions
Build all targets / Upload Artifacts to S3 (push) Blocked by required conditions
Build all targets / Create Release and Upload Artifacts (push) Blocked by required conditions
Checks / build (NO_NINJA_BUILD=1 px4_fmu-v5_default) (push) Waiting to run
Checks / build (NO_NINJA_BUILD=1 px4_sitl_default) (push) Waiting to run
Checks / build (check_format) (push) Waiting to run
Checks / build (check_newlines) (push) Waiting to run
Checks / build (module_documentation) (push) Waiting to run
Checks / build (px4_fmu-v2_default stack_check) (push) Waiting to run
Checks / build (px4_sitl_allyes) (push) Waiting to run
Checks / build (shellcheck_all) (push) Waiting to run
Checks / build (tests) (push) Waiting to run
Checks / build (tests_coverage) (push) Waiting to run
Checks / build (validate_module_configs) (push) Waiting to run
Clang Tidy / build (push) Waiting to run
MacOS build / build (px4_fmu-v5_default) (push) Waiting to run
MacOS build / build (px4_sitl) (push) Waiting to run
Ubuntu environment build / Build and Test (ubuntu:22.04) (push) Waiting to run
Ubuntu environment build / Build and Test (ubuntu:24.04) (push) Waiting to run
Container build / Build and Push Container (push) Waiting to run
EKF Update Change Indicator / unit_tests (push) Waiting to run
Failsafe Simulator Build / build (failsafe_web) (push) Waiting to run
FLASH usage analysis / Analyzing px4_fmu-v5x (push) Waiting to run
FLASH usage analysis / Analyzing px4_fmu-v6x (push) Waiting to run
FLASH usage analysis / Publish Results (push) Blocked by required conditions
MAVROS Mission Tests / build (map[mission:MC_mission_box vehicle:iris]) (push) Waiting to run
MAVROS Mission Tests / build (map[mission:rover_mission_1 vehicle:rover]) (push) Waiting to run
MAVROS Offboard Tests / build (map[test_file:mavros_posix_tests_offboard_posctl.test vehicle:iris]) (push) Waiting to run
Nuttx Target with extra env config / build (px4_fmu-v5_default) (push) Waiting to run
Python CI Checks / build (push) Waiting to run
ROS Translation Node Tests / Build and test (map[ros_version:humble ubuntu:jammy]) (push) Waiting to run
ROS Translation Node Tests / Build and test (map[ros_version:jazzy ubuntu:noble]) (push) Waiting to run
SITL Tests / Testing PX4 tailsitter (push) Waiting to run
SITL Tests / Testing PX4 iris (push) Waiting to run
SITL Tests / Testing PX4 standard_vtol (push) Waiting to run
These can be changed without version increment
77 lines
2.8 KiB
Bash
Executable File
77 lines
2.8 KiB
Bash
Executable File
#! /bin/bash
|
|
# Copy a git diff between two commits if msg versioning is added
|
|
|
|
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
|
|
PX4_SRC_DIR="$DIR/.."
|
|
|
|
BASE_COMMIT="$1"
|
|
HEAD_COMMIT="$2"
|
|
if [ -z "${BASE_COMMIT}" ] || [ -z "${HEAD_COMMIT}" ]
|
|
then
|
|
echo "Usage: $0 <base_commit> <head_commit>"
|
|
exit 1
|
|
fi
|
|
|
|
failed=0
|
|
|
|
# Iterate git diff files between BASE_COMMIT and HEAD_COMMIT
|
|
modified_files="$(git --no-pager diff --no-color --name-only --diff-filter=M "${BASE_COMMIT}"..."${HEAD_COMMIT}")"
|
|
all_files="$( git --no-pager diff --no-color --name-only "${BASE_COMMIT}"..."${HEAD_COMMIT}")"
|
|
for file in ${modified_files}
|
|
do
|
|
if [[ "$file" == msg/versioned/*.msg ]]; then
|
|
echo "Modified msg file: ${file}"
|
|
# A modified versioned .msg file requires:
|
|
# - Incrementing the version
|
|
# - An old .msg version exists
|
|
# - A translation header exists and is included
|
|
|
|
# Ignore changes to comments or constants
|
|
content_a=$(git show "${BASE_COMMIT}:${file}" | grep -o '^[^#]*' | grep -v =)
|
|
content_b=$(git show "${HEAD_COMMIT}:${file}" | grep -o '^[^#]*' | grep -v =)
|
|
if [ "${content_a}" == "${content_b}" ]; then
|
|
echo "No version update required for ${file}"
|
|
continue
|
|
fi
|
|
|
|
diff=$(git --no-pager diff --no-color --diff-filter=M "${BASE_COMMIT}"..."${HEAD_COMMIT}" -- "${file}")
|
|
old_version=$(echo "${diff}" | sed -n 's/^-uint32 MESSAGE_VERSION = \([0-9]*\).*/\1/p')
|
|
new_version=$(echo "${diff}" | sed -n 's/^+uint32 MESSAGE_VERSION = \([0-9]*\).*/\1/p')
|
|
|
|
# Check that the version is incremented
|
|
if [ -z "${new_version}" ] || [ -z "${old_version}" ]; then
|
|
echo "ERROR: Missing version update for ${file}"
|
|
failed=1
|
|
else
|
|
if [ $((new_version-old_version)) -ne 1 ]; then
|
|
echo "ERROR: Version not incremented by +1 for ${file}"
|
|
failed=1
|
|
fi
|
|
fi
|
|
|
|
# Check that an old version exists
|
|
filename=$(basename -- "$file")
|
|
filename="${filename%.*}"
|
|
old_version_file="px4_msgs_old/msg/${filename}V${old_version}.msg"
|
|
if [[ "${all_files}" != *"${old_version_file}"* ]]; then
|
|
echo "ERROR: Old message version does not exist for ${file} (missing ${old_version_file})"
|
|
failed=1
|
|
fi
|
|
|
|
# Check that a translation header got added by checking for a modification to all_translations.h
|
|
# If it is changed, we assume a new header got added too, so we don't explicitly check for that
|
|
if [[ "${modified_files}" != *"translations/all_translations.h"* ]]; then
|
|
echo "ERROR: missing modification to translations/all_translations.h"
|
|
failed=1
|
|
fi
|
|
fi
|
|
done
|
|
|
|
if [ ${failed} -ne 0 ]; then
|
|
echo ""
|
|
echo "ERROR: missing message versioning due to changed .msg file(s) (see above)"
|
|
echo "Check the documentation under https://docs.px4.io/main/en/ros2/px4_ros2_msg_translation_node.html for how to add a new version"
|
|
exit 1
|
|
fi
|