mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-22 14:19:57 +08:00
ci(px4io): reject per-board IO binaries and keep check_px4io read-only
A board that still carries its own px4io binary in extras/ collided with the one added via CONFIG_BOARD_IO and failed CMake generate with a duplicate custom rule error. Several open board PRs add one, so fail configure with a message naming the file to delete instead. check_px4io copied the build output over the committed binaries, which leaves changed binaries behind when run with a different toolchain. Compare with cmp instead. The CI job now only runs check_px4io, which already builds both IO boards, instead of building them twice. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch>
This commit is contained in:
1 parent
de33bf96da
commit
1239c24f99
3 files changed
+15
-29
No files matched your search
@@ -55,7 +55,6 @@ jobs:
|
||||
name: IO Firmware Up To Date
|
||||
runs-on: [runs-on,runner=2cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false,extras=s3-cache]
|
||||
container:
|
||||
# keep in sync with the image named in the warning below
|
||||
image: ghcr.io/px4/px4-dev:v1.17.0-rc2
|
||||
steps:
|
||||
- uses: runs-on/action@v2
|
||||
@@ -65,29 +64,10 @@ jobs:
|
||||
- name: Configure Git Safe Directory
|
||||
run: git config --system --add safe.directory '*'
|
||||
|
||||
- name: Build px4io firmware
|
||||
- name: Build and compare px4io firmware
|
||||
env:
|
||||
PX4_SBOM_DISABLE: 1
|
||||
run: make px4io_update
|
||||
|
||||
- name: Compare with committed binaries
|
||||
env:
|
||||
PX4_SBOM_DISABLE: 1
|
||||
run: |
|
||||
if ! make check_px4io; then
|
||||
image="ghcr.io/px4/px4-dev:v1.17.0-rc2"
|
||||
echo "::error title=px4io firmware out of date::The committed px4io firmware does not match the current sources. Regenerate it with: PX4_DOCKER_REPO=${image} ./Tools/docker_run.sh 'make px4io_update'"
|
||||
{
|
||||
echo "### px4io firmware out of date"
|
||||
echo
|
||||
echo "The committed px4io firmware does not match what the current sources build to. Regenerate and commit it:"
|
||||
echo
|
||||
echo '```'
|
||||
echo "PX4_DOCKER_REPO=${image} ./Tools/docker_run.sh 'make px4io_update'"
|
||||
echo '```'
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
exit 1
|
||||
fi
|
||||
run: make check_px4io
|
||||
|
||||
tests:
|
||||
name: Unit Tests
|
||||
|
||||
@@ -340,19 +340,20 @@ uorb_graphs:
|
||||
# toolchain, so regenerate it in the px4-dev image used by the check_px4io CI job
|
||||
# (.github/workflows/checks.yml):
|
||||
# PX4_DOCKER_REPO=<that image> ./Tools/docker_run.sh 'make px4io_update'
|
||||
.PHONY: px4io_update check_px4io
|
||||
PX4IO_FIRMWARE_BINS := \
|
||||
boards/px4/io-v2/extras/px4_io-v2_default.bin \
|
||||
boards/cubepilot/io-v2/extras/cubepilot_io-v2_default.bin
|
||||
.PHONY: px4io_build px4io_update check_px4io
|
||||
|
||||
px4io_update:
|
||||
px4io_build:
|
||||
@$(MAKE) --no-print-directory px4_io-v2_default
|
||||
@$(MAKE) --no-print-directory cubepilot_io-v2_default
|
||||
|
||||
px4io_update: px4io_build
|
||||
cp build/px4_io-v2_default/px4_io-v2_default.bin boards/px4/io-v2/extras/
|
||||
cp build/cubepilot_io-v2_default/cubepilot_io-v2_default.bin boards/cubepilot/io-v2/extras/
|
||||
|
||||
check_px4io: px4io_update
|
||||
@git diff --exit-code --stat -- $(PX4IO_FIRMWARE_BINS) \
|
||||
# compares without touching the committed binaries
|
||||
check_px4io: px4io_build
|
||||
@cmp build/px4_io-v2_default/px4_io-v2_default.bin boards/px4/io-v2/extras/px4_io-v2_default.bin \
|
||||
&& cmp build/cubepilot_io-v2_default/cubepilot_io-v2_default.bin boards/cubepilot/io-v2/extras/cubepilot_io-v2_default.bin \
|
||||
|| { echo "px4io firmware is out of date, regenerate it with 'make px4io_update' (see Makefile)"; exit 1; }
|
||||
|
||||
bootloaders_update: \
|
||||
|
||||
@@ -296,6 +296,11 @@ foreach(board_extra_file ${OPTIONAL_BOARD_EXTRAS})
|
||||
# remove bootloader from extras
|
||||
list(REMOVE_ITEM OPTIONAL_BOARD_EXTRAS ${board_extra_file})
|
||||
endif()
|
||||
elseif(${extra_file_base_name} MATCHES "_io-v[0-9]+_default\\.bin$")
|
||||
# px4io firmware is no longer kept per board, see CONFIG_BOARD_IO below
|
||||
file(RELATIVE_PATH extra_file_relative_source ${PX4_SOURCE_DIR} ${board_extra_file})
|
||||
message(FATAL_ERROR "Delete ${extra_file_relative_source}: the px4io firmware is now taken from "
|
||||
"boards/<vendor>/<io board>/extras/ via CONFIG_BOARD_IO and must not be kept per board.")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
||||
Reference in new issue
Block a user