Add regression-guard tests for validation steps, CMake parser, and ro… #136
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Python Unit Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| container: ros:jazzy-ros-base | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libxml2-dev libxslt-dev | |
| sudo apt-get install -y pip | |
| sudo apt-get install -y python3-rosdep | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install --no-cache-dir lxml coverage | |
| python -m pip install . --break-system-packages | |
| - name: Update rosdep | |
| run: | | |
| rosdep update | |
| - name: Run unit tests with coverage (always emit XML) | |
| env: | |
| PYTHONPATH: ${{ github.workspace }} | |
| run: | | |
| set +e | |
| python3 -m coverage run --branch --source=package_xml_validation \ | |
| -m unittest discover -s tests -p "test_*.py" -t . | |
| status=$? | |
| # Always generate reports so Codecov has something to ingest | |
| python3 -m coverage xml -o coverage.xml || true | |
| python3 -m coverage report -m || true | |
| python3 -m coverage html || true | |
| exit $status | |
| - name: Upload coverage HTML as artifact | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-html | |
| path: htmlcov | |
| - name: Upload to Codecov | |
| if: always() | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: coverage.xml | |
| verbose: true |