This repository uses GitHub Actions for continuous integration and deployment.
Automated testing workflow that runs on every push and pull request.
- Status: Warning only (won't fail the workflow)
- Checks:
flake8: Python code style (PEP 8)pep257: Docstring style (PEP 257)
- Environment: Ubuntu 22.04, Python 3.10
- Working Directory:
src/neupan_ros2/
- Status: Will fail on errors
- Environment: Ubuntu 22.04, ROS2 Humble
- Steps:
- Install NumPy 1.26.x from apt (matching production)
- Install NeuPAN from GitHub source: https://github.com/hanruihua/NeuPAN
- Build ROS2 workspace with
colcon build - Run tests with
colcon test
- Artifacts: Build logs and test results (7-day retention)
- ✅ Push to
mainormasterbranch - ✅ Pull requests to
mainormasterbranch - ✅ Manual trigger via GitHub UI
python3-numpy(1.26.x from Ubuntu 22.04 apt)python3-pipgit- ROS2 Humble
- NeuPAN - Installed from GitHub source
The build-and-test job runs in an official ROS2 Docker container:
- Image:
ros:humble-ros-base-jammy - Base OS: Ubuntu 22.04 (Jammy Jellyfish)
- ROS Distribution: ROS2 Humble Hawksbill
- Pre-installed: ROS2 base packages, Colcon build tools
This ensures reproducible builds that match the target deployment environment.
The workflow uses GitHub Actions cache to significantly speed up builds:
Cache Key: sys-deps-v3-<hash of package.xml files>
Caches:
/var/cache/apt/archives- Downloaded apt packages/var/lib/apt/lists- Package lists/usr/local/lib/python3.10/dist-packages- System Python packages
Impact: Reduces apt package downloads from ~2min to ~10sec on cache hit
Cache Key: pip-v2-<hash of setup.py and package.xml>
Caches:
~/.cache/pip- Pip package cache directory
Impact: Speeds up pip installations
Cache Key: neupan-v3-<hash of workflow file>
Caches:
/tmp/NeuPAN- Complete NeuPAN installation
Impact: Reduces NeuPAN install from ~3min to ~30sec on cache hit
Note: Cache invalidates only when workflow changes, as NeuPAN version is pinned.
- First run (cold cache): ~3-4 minutes
- Subsequent runs (warm cache): ~30-60 seconds
- Cache hit rate: ~90% for typical development workflow
- Go to the Actions tab in GitHub
- Select the workflow run
- View job results and logs
- Download artifacts if needed
- Go to Actions → ROS2 CI
- Click Run workflow
- Select branch and click Run workflow
All actions are from official and popular repositories:
actions/checkout@v4- GitHub officialactions/setup-python@v5- GitHub officialactions/upload-artifact@v4- GitHub officialros-tooling/setup-ros@v0.7- ROS officialros-tooling/action-ros-ci@v0.3- ROS official
Related configuration files in src/neupan_ros2/:
.flake8- Flake8 configuration (max line length: 99).pylintrc- Pylint configurationsetup.cfg- Package configurationtest/test_pep257.py- PEP257 test with ignore rules
If the build fails:
- Check the build logs in the workflow run
- Download the
build-logsartifact for detailed information - Ensure NeuPAN is properly installed
The workflow uses NumPy 1.26.x from apt to match Ubuntu 22.04:
sudo apt-get install python3-numpyIf you need a different version, modify the workflow accordingly.
Before pushing, you can test locally:
# Code style (from src/neupan_ros2/)
cd src/neupan_ros2
python -m pytest test/test_flake8.py -v
python -m pytest test/test_pep257.py -v# ROS2 build (from workspace root)
cd <workspace>
colcon build --packages-select neupan_ros2
colcon test --packages-select neupan_ros2You can test the GitHub Actions workflow locally using act:
# Using curl
curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
# Or using package manager
# Ubuntu/Debian
curl -s https://api.github.com/repos/nektos/act/releases/latest \
| grep "browser_download_url.*linux_amd64.tar.gz" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi - -O /tmp/act.tar.gz
sudo tar xf /tmp/act.tar.gz -C /usr/local/bin act# Run entire workflow
act -j build-and-test
# Run with specific Docker platform
act -j build-and-test -P ubuntu-latest=ros:humble-ros-base-jammy
# Run with bind mount (for testing with local changes)
act -j build-and-test -P ubuntu-latest=ros:humble-ros-base-jammy --bind- Docker required: Act runs workflows in Docker containers
- Build directory: Clean
build/,install/,log/before running with--bindto avoid CMake cache issues - Limitations: Some GitHub-specific features may not work identically
- Artifacts: Download artifacts won't work in local act runs
# Clean build artifacts before act testing
rm -rf build install log
# Run with verbose output
act -j build-and-test --verbose
# List available workflows
act -lAdd this to your README.md to show the CI status:
[](https://github.com/<username>/<repo>/actions/workflows/ros2-ci.yml)