Skip to content

Commit

Permalink
Add Action for validating package.xml files (#70)
Browse files Browse the repository at this point in the history
Adds an Action that can be used in all of our Harmonic packages to check that the versions in CMake and package.xml are consistent. This also adds validation using `ament_xmllint`, but it's temporarily disabled until its naming requirements are relaxed.
---------

Signed-off-by: Addisu Z. Taddese <[email protected]>
  • Loading branch information
azeey authored Apr 10, 2024
1 parent 6d0ffe5 commit a43edd5
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions validate_package_xml/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'Validate package.xml'
description: 'Validate package.xml file'
runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v4

# TODO(azeey) Uncomment once https://github.com/ros-infrastructure/rep/pull/400
# is merged and the .xsd changes have propagated to ament_xmllint.
# - name: package.xml syntax validation
# shell: bash
# run: |
# echo "Install ament-xmllint"
# sudo apt-get install -y python3-venv libxml2-utils
# python3 -m venv .venv
# source .venv/bin/activate
# pip install ament-xmllint
# ament_xmllint package.xml 2>&1 | tee $GITHUB_STEP_SUMMARY

- name: package.xml and CMake versions match
shell: bash
run: |
echo "Extract version numbers and compare"
echo '## CMake and Package.xml Versions' >> $GITHUB_STEP_SUMMARY
package_xml_version=$(sed -nE 's/\s*<version>([0-9.]*)<\/version>\s*/\1/p' package.xml)
echo "Version in package.xml: ${package_xml_version}" | tee -a $GITHUB_STEP_SUMMARY
cmake_version=$(sed -nE 's/^project.*VERSION\s*([0-9.]*).*/\1/p' CMakeLists.txt)
echo "Version in CMake: ${cmake_version}" | tee -a $GITHUB_STEP_SUMMARY
[ $package_xml_version = $cmake_version ]

0 comments on commit a43edd5

Please sign in to comment.