Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
A Full Guide To Releasing With Catkin
Description: This tutorial is an attempt to summarize all steps that should be fulfilled to release a package based on Catkin on a modern distribution (Indigo). It does not only cover what is needed to do a release once your code is complete but also how your code and catkin setup should look like in order to be able to do a successful release.Keywords: catkin, release
Tutorial Level: ADVANCED
Contents
This tutorial is an attempt to summarize all steps that should be fulfilled to release a package based on Catkin on a modern distribution (Indigo). It does not cover only what is needed to do a release once your code is complete but also how your code and catkin setup should look like in order to be able to do a successful release.
What will be released are all packages that are found in your repository. If you have packages in this repository that depend on package in another repository you also want to release, you should release them together.
Build locally
"catkin_make -DCMAKE_BUILD_TYPE=RelWithDebInfo -j1" should build! See catkin. Remove the devel and build directories before running.
Test locally
No result should fail when running "catkin_make -DCMAKE_BUILD_TYPE=Debug run_tests".
Code-Level Test
Use a unit-test if your code can be tested without the need of a ROS master.
C++
In package.xml do nothing except adding dependencies in test_depend if the dependency is not already in build_depend. In CMakeLists.txt add something similar to
catkin_add_gtest(mypackage-utest test/utest.cpp)
See gtest, catkin, format 2 or catkin, legacy format.
Python
In package.xml:
1 <test_depend>python-nose</test_depend>
In CMakeLists.txt:
catkin_add_nosetests(path/to/my_test.py)
The Python script should be not executable.
See unittest#Code-level_Python_Unit_Tests, catkin documentation, format 2, or catkin documentation, legacy format.
Node-Level Test
Use rostest to test with a ROS master and possibly other nodes.
C++
In package.xml:
1 <build_depend>rostest</build_depend>
In CMakeLists.txt, contrary to what the official documentation states (as of 2015-01), add:
if (CATKIN_ENABLE_TESTING) find_package(rostest REQUIRED) add_rostest_gtest(mynode_test test/mynode.test test/test_mynode.cpp [more cpp files]) target_link_libraries(mynode_test ${catkin_LIBRARIES}) endif()
See rostest/Writing#Add_rostests_in_CMakeLists.txt.
Python
In package.xml:
1 <build_depend>rostest</build_depend>
In CMakeLists.txt, contrary to what the official documentation states (as of 2015-01), add:
if (CATKIN_ENABLE_TESTING) find_package(rostest REQUIRED) add_rostest(test/mytest.test) endif()
The Python script called in mytest.test must be executable.
See rostest/Writing#Add_rostests_in_CMakeLists.txt.
Test with data files
Within the source directory
See http://answers.ros.org/question/59779/data-files-for-catkin-gtest/.
External
See catkin documentation, format 2 or catkin documentation, legacy format.
Check dependencies
"rosdep check mypackage" should not report any error. Please note that errors about unmet dependencies for packages that will be part of the release can be ignored.
In the case that a dependency is unmet, i.e. if it is not in the adequate file in https://github.com/ros/rosdistro/tree/master/rosdep, you have to add it there by following these instructions: rosdep documentation.
Add install instructions
See catkin documentation, format 2 or catkin documentation, legacy format.
Prepare the documentation
Write code comment with Doxygen formatting. Add your repository into distribution.yaml with a doc: section to automatically generate the online documentation (message API, code API). See rosdistro/Tutorials/Indexing Your ROS Repository for Documentation Generation. Note that this can be done easierly during the release step.
Make a prerelease test
Locally
See jenkins_tools#run_chroot_local.
On the buildfarm
See bloom/Tutorials/PrereleaseTest.