Skip to content

Commit

Permalink
Merge pull request #585 from ros-infrastructure/build_tool_option
Browse files Browse the repository at this point in the history
add build tool option
  • Loading branch information
dirk-thomas authored Nov 8, 2018
2 parents 2bad658 + 6e6ab95 commit 080da03
Show file tree
Hide file tree
Showing 35 changed files with 444 additions and 156 deletions.
75 changes: 63 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,64 @@ sudo: false
env:
global:
- CONFIG_URL=https://raw.githubusercontent.com/ros-infrastructure/ros_buildfarm_config/production/index.yaml
- CONFIG2_URL=https://raw.githubusercontent.com/ros2/ros_buildfarm_config/ros2/index.yaml
- ROS_DISTRO_NAME=kinetic
- ROS2_DISTRO_NAME=bouncy
- OS_NAME=ubuntu
- OS_CODE_NAME=xenial
- OS_CODE_NAME2=bionic
- ARCH=amd64
- ROS_BUILDFARM_PULL_REQUEST_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH
matrix:
include:
- language: python
python: "3.6"
sudo: required
services:
- docker
env: JOB_TYPE=devel REPOSITORY_NAME=rcl ROSDISTRO_INDEX_URL=https://raw.githubusercontent.com/ros2/rosdistro/ros2/index-v4.yaml
before_script:
# install colcon for test results
- pip install colcon-core colcon-test-result
- python setup.py install
- mkdir job && cd job
- ln -s .. ros_buildfarm
script:
- generate_devel_script.py $CONFIG2_URL $ROS2_DISTRO_NAME default $REPOSITORY_NAME $OS_NAME $OS_CODE_NAME2 $ARCH > job.sh
- . job.sh -y
- (exit $test_result_RC)
- language: python
python: "3.6"
sudo: required
services:
- docker
env: JOB_TYPE=prerelease UNDERLAY_REPOSITORY_NAMES="ament_cmake_ros" OVERLAY_PACKAGE_NAMES=rcutils ROSDISTRO_INDEX_URL=https://raw.githubusercontent.com/ros2/rosdistro/ros2/index-v4.yaml
before_script:
# install colcon for test results
- pip install colcon-core colcon-test-result
- python setup.py install
- mkdir job && cd job
- ln -s .. ros_buildfarm
script:
- generate_prerelease_script.py $CONFIG2_URL $ROS2_DISTRO_NAME default $OS_NAME $OS_CODE_NAME2 $ARCH $UNDERLAY_REPOSITORY_NAMES --pkg $OVERLAY_PACKAGE_NAMES --output-dir .
- . prerelease.sh -y
- (exit $test_result_RC_underlay) && (exit $test_result_RC_overlay)
- language: python
python: "3.6"
sudo: required
services:
- docker
env: JOB_TYPE=devel BUILD_TOOL=colcon REPOSITORY_NAME=roscpp_core ROSDISTRO_INDEX_URL=https://raw.githubusercontent.com/ros2/rosdistro/ros2/index-v4.yaml
before_script:
# install colcon for test results
- pip install colcon-core colcon-test-result
- python setup.py install
- mkdir job && cd job
- ln -s .. ros_buildfarm
script:
- generate_devel_script.py $CONFIG_URL $ROS_DISTRO_NAME default $REPOSITORY_NAME $OS_NAME $OS_CODE_NAME $ARCH --build-tool $BUILD_TOOL > job.sh
- . job.sh -y
- (exit $test_result_RC)
- language: python
python: "3.6"
sudo: required
Expand All @@ -32,7 +83,7 @@ matrix:
- generate_devel_script.py $CONFIG_URL $ROS_DISTRO_NAME default $REPOSITORY_NAME $OS_NAME $OS_CODE_NAME $ARCH > job.sh
- . /opt/ros/indigo/setup.sh
- . job.sh -y
- (exit $catkin_test_results_RC)
- (exit $test_result_RC)
- language: python
python: "3.6"
sudo: required
Expand Down Expand Up @@ -81,7 +132,7 @@ matrix:
- generate_prerelease_script.py $CONFIG_URL $ROS_DISTRO_NAME default $OS_NAME $OS_CODE_NAME $ARCH $UNDERLAY_REPOSITORY_NAMES --pkg $OVERLAY_PACKAGE_NAMES --output-dir .
- . /opt/ros/indigo/setup.sh
- . prerelease.sh -y
- (exit $catkin_test_results_RC_underlay) && (exit $catkin_test_results_RC_overlay)
- (exit $test_result_RC_underlay) && (exit $test_result_RC_overlay)
- language: python
python: "3.6"
sudo: required
Expand All @@ -93,7 +144,7 @@ matrix:
- mkdir job && cd job
- ln -s .. ros_buildfarm
script:
- git clone -b dummy_package https://github.com/ros-infrastructure/ros_buildfarm catkin_workspace/src/ros_buildfarm
- git clone -b dummy_package https://github.com/ros-infrastructure/ros_buildfarm ws/src/ros_buildfarm
- generate_prerelease_script.py $CONFIG_URL $ROS_DISTRO_NAME default $OS_NAME $OS_CODE_NAME $ARCH --output-dir .
- ./prerelease.sh -y
- language: python
Expand Down Expand Up @@ -131,7 +182,7 @@ matrix:
- generate_devel_script.py $CONFIG_URL $ROS_DISTRO_NAME default $REPOSITORY_NAME $OS_NAME $OS_CODE_NAME $ARCH > job.sh
- . /opt/ros/indigo/setup.sh
- . job.sh -y
- (exit $catkin_test_results_RC)
- (exit $test_result_RC)
- language: python
python: "3.5"
sudo: required
Expand Down Expand Up @@ -180,7 +231,7 @@ matrix:
- generate_prerelease_script.py $CONFIG_URL $ROS_DISTRO_NAME default $OS_NAME $OS_CODE_NAME $ARCH $UNDERLAY_REPOSITORY_NAMES --pkg $OVERLAY_PACKAGE_NAMES --output-dir .
- . /opt/ros/indigo/setup.sh
- . prerelease.sh -y
- (exit $catkin_test_results_RC_underlay) && (exit $catkin_test_results_RC_overlay)
- (exit $test_result_RC_underlay) && (exit $test_result_RC_overlay)
- language: python
python: "3.5"
sudo: required
Expand All @@ -192,7 +243,7 @@ matrix:
- mkdir job && cd job
- ln -s .. ros_buildfarm
script:
- git clone -b dummy_package https://github.com/ros-infrastructure/ros_buildfarm catkin_workspace/src/ros_buildfarm
- git clone -b dummy_package https://github.com/ros-infrastructure/ros_buildfarm ws/src/ros_buildfarm
- generate_prerelease_script.py $CONFIG_URL $ROS_DISTRO_NAME default $OS_NAME $OS_CODE_NAME $ARCH --output-dir .
- ./prerelease.sh -y
- language: python
Expand Down Expand Up @@ -230,7 +281,7 @@ matrix:
- generate_devel_script.py $CONFIG_URL $ROS_DISTRO_NAME default $REPOSITORY_NAME $OS_NAME $OS_CODE_NAME $ARCH > job.sh
- . /opt/ros/indigo/setup.sh
- . job.sh -y
- (exit $catkin_test_results_RC)
- (exit $test_result_RC)
- language: python
python: "3.4"
sudo: required
Expand Down Expand Up @@ -279,7 +330,7 @@ matrix:
- generate_prerelease_script.py $CONFIG_URL $ROS_DISTRO_NAME default $OS_NAME $OS_CODE_NAME $ARCH $UNDERLAY_REPOSITORY_NAMES --pkg $OVERLAY_PACKAGE_NAMES --output-dir .
- . /opt/ros/indigo/setup.sh
- . prerelease.sh -y
- (exit $catkin_test_results_RC_underlay) && (exit $catkin_test_results_RC_overlay)
- (exit $test_result_RC_underlay) && (exit $test_result_RC_overlay)
- language: python
python: "3.4"
sudo: required
Expand All @@ -291,7 +342,7 @@ matrix:
- mkdir job && cd job
- ln -s .. ros_buildfarm
script:
- git clone -b dummy_package https://github.com/ros-infrastructure/ros_buildfarm catkin_workspace/src/ros_buildfarm
- git clone -b dummy_package https://github.com/ros-infrastructure/ros_buildfarm ws/src/ros_buildfarm
- generate_prerelease_script.py $CONFIG_URL $ROS_DISTRO_NAME default $OS_NAME $OS_CODE_NAME $ARCH --output-dir .
- ./prerelease.sh -y
- language: python
Expand Down Expand Up @@ -329,7 +380,7 @@ matrix:
- generate_devel_script.py $CONFIG_URL $ROS_DISTRO_NAME default $REPOSITORY_NAME $OS_NAME $OS_CODE_NAME $ARCH > job.sh
- . /opt/ros/indigo/setup.sh
- . job.sh -y
- (exit $catkin_test_results_RC)
- (exit $test_result_RC)
- language: python
python: "2.7"
sudo: required
Expand Down Expand Up @@ -381,7 +432,7 @@ matrix:
- generate_prerelease_script.py $CONFIG_URL $ROS_DISTRO_NAME default $OS_NAME $OS_CODE_NAME $ARCH $UNDERLAY_REPOSITORY_NAMES --pkg $OVERLAY_PACKAGE_NAMES --output-dir .
- . /opt/ros/indigo/setup.sh
- . prerelease.sh -y
- (exit $catkin_test_results_RC_underlay) && (exit $catkin_test_results_RC_overlay)
- (exit $test_result_RC_underlay) && (exit $test_result_RC_overlay)
- language: python
python: "2.7"
sudo: required
Expand All @@ -396,7 +447,7 @@ matrix:
- mkdir job && cd job
- ln -s .. ros_buildfarm
script:
- git clone -b dummy_package https://github.com/ros-infrastructure/ros_buildfarm catkin_workspace/src/ros_buildfarm
- git clone -b dummy_package https://github.com/ros-infrastructure/ros_buildfarm ws/src/ros_buildfarm
- generate_prerelease_script.py $CONFIG_URL $ROS_DISTRO_NAME default $OS_NAME $OS_CODE_NAME $ARCH --output-dir .
- ./prerelease.sh -y
- language: python
Expand Down
10 changes: 10 additions & 0 deletions doc/configuration_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ The following options are valid in version ``2`` (beside the generic options):
* ``jenkins_pull_request_job_priority``: the job priority of *pull request*
jobs.

* ``build_tool``: the build tool to use. The following are valid values:

* ``catkin_make_isolated`` (default)
* ``colcon``

* ``notifications``: a dictionary with the following keys:

* ``compiler_warnings``: boolean flag if compiler warnings should mark a job
Expand Down Expand Up @@ -318,6 +323,11 @@ The following options are valid in version ``2`` (beside the generic options):
``buildagent || <ROSDISTRO_NAME>_doc_<BUILD_FILE_NAME>``).
* ``jenkins_job_timeout``: the job timeout for *doc* jobs.

* ``build_tool``: the build tool to use. The following are valid values:

* ``catkin_make_isolated`` (default)
* ``colcon``

* ``notifications``: a dictionary with the following keys:

* ``committers``: a boolean flag if the committers should be notified (only
Expand Down
75 changes: 56 additions & 19 deletions doc/jobs/devel_jobs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,47 +63,75 @@ one to perform the *build-and-test* task.
Build and install
^^^^^^^^^^^^^^^^^

This task is performed by the script *catkin_make_isolated_and_install.py*.
This task is performed by the script *build_and_install.py*.
The environment will only contain the *build* dependencies declared by the
packages in the source repository.

The task performs the following steps:

* The content of the source repository is expected to be available in the
folder *catkin_workspace/src*.
folder *ws/src*.
* Removes any *build*, *devel* and *install* folders left over from previous
runs.
* Invokes
``catkin_make_isolated --install -DCATKIN_SKIP_TESTING=1 --catkin-make-args -j1``.
* Depending on the chosen build tool it invokes either of the two:

* ``catkin_make_isolated --install ...``
* ``colcon build --executor sequential --event-handlers console_direct+ ...``

The direct output allows the output to be streamed while it is progressing.
The sequential execution avoids interleaved output between packages.

Both commands use the environment variable ``MAKEFLAGS=-j1``.

The build is performed single threaded to achieve deterministic build results
(a different target order could break the build if it lacks correct target
dependencies).

Additionally the following CMake flags are being passed:
``--cmake-args -DBUILD_TESTING=0 -DCATKIN_SKIP_TESTING=1``.

Since the CMake option ``BUILD_TESTING`` is enabled by default it is
explicitly disabled.

Since the CMake option ``CATKIN_ENABLE_TESTING`` is not enabled explicitly
the packages must neither configure any tests nor use any test-only
dependencies.
The option ``CATKIN_SKIP_TESTING`` prevents CMake from failing if packages
violate this restriction and only outputs a CMake warning instead.

The build is performed single threaded to achieve deterministic build results
(a different target order could break the build if it lacks correct target
dependencies) and make errors easier to read.


Build and test
^^^^^^^^^^^^^^

This task is performed by the script *catkin_make_isolated_and_test.py*.
This task is performed by the script *build_and_test.py*.
The environment will only contain the *build*, *run* and *test* dependencies
declared by the packages in the source repository.

The task performs the following steps:

* The content of the source repository is expected to be available in the
folder *catkin_workspace/src*.
* Invokes
folder *ws/src*.
* Depending on the chosen build tool it invokes either of the two:

* ``catkin_make_isolated --catkin-make-args run_tests ...``
* ``colcon test --executor sequential --event-handlers console_direct+``

The direct output allows the output to be streamed while it is progressing.
The sequential execution avoids interleaved output between packages.

``catkin_make_isolated --cmake-args -DCATKIN_ENABLE_TESTING=1 -DCATKIN_SKIP_TESTING=0 -DCATKIN_TEST_RESULTS_DIR=path/to/catkin_workspace/test_results --catkin-make-args -j1 run_tests``.
Both commands use the environment variable ``MAKEFLAGS=-j1``.

The tests are performed single threaded to achieve deterministic test results
(otherwise some tests might affect each other).

Additionally the following CMake flags are being passed to reenable tests and
determine the location of the test results:
``--cmake-args -DCATKIN_ENABLE_TESTING=1 -DCATKIN_SKIP_TESTING=0 -DCATKIN_TEST_RESULTS_DIR=path/to/ws/test_results``.
For colcon the test result directory is additionally passed via
``--test-result-base``

The XUnit test results for each package will be created in the subfolder
*test_results* in the catkin workspace and be shown by Jenkins.
*test_results* in the workspace and be shown by Jenkins.


Known limitations
Expand All @@ -128,8 +156,8 @@ packages ``catkin_pkg``, ``rosdistro``).

When the generated script is being invoked in runs the *build-and-install* task
as well as the *build-and-test* task in separate Docker containers.
Additionally it invokes the tool ``catkin_test_results --all`` to output a
summary of all tests.
Additionally it invokes the tool ``catkin_test_results --all`` /
``colcon test-result --all`` to output a summary of all tests.


Example invocation
Expand Down Expand Up @@ -157,7 +185,9 @@ Instead of invoking the generated script it can also be *sourced*:
. devel_job_indigo_roscpp_core.sh
The return code of the invocation of `catkin_tests_results` is then available in the environment variable `catkin_test_results_RC`.
The return code of the invocation of ``catkin_tests_results`` /
``colcon test-result``is then available in the environment variable
``test_result_RC``.

Run the *devel* job on Travis
-----------------------------
Expand Down Expand Up @@ -187,13 +217,18 @@ The following .travis.yml template is a good starting point and is ready to be u
# or checkout a specific branch
#- git clone -b master https://github.com/ros-infrastructure/ros_buildfarm /tmp/ros_buildfarm
#- pip install /tmp/ros_buildfarm
# use either of the two following options depending on the chosen build tool
# checkout catkin for catkin_test_results script
- git clone https://github.com/ros/catkin /tmp/catkin
# install colcon for test results
- pip install colcon-core colcon-test-result
# run devel job for a ROS repository with the same name as this repo
- export REPOSITORY_NAME=`basename $TRAVIS_BUILD_DIR`
# use the code already checked out by Travis
- mkdir -p $JOB_PATH/catkin_workspace/src
- cp -R $TRAVIS_BUILD_DIR $JOB_PATH/catkin_workspace/src/
- mkdir -p $JOB_PATH/ws/src
- cp -R $TRAVIS_BUILD_DIR $JOB_PATH/ws/src/
# generate the script to run a devel job for that target and repo
- generate_devel_script.py https://raw.githubusercontent.com/ros-infrastructure/ros_buildfarm_config/production/index.yaml $ROS_DISTRO_NAME default $REPOSITORY_NAME $OS_NAME $OS_CODE_NAME $ARCH > $JOB_PATH/devel_job.sh
- cd $JOB_PATH
Expand All @@ -202,7 +237,9 @@ The following .travis.yml template is a good starting point and is ready to be u
- sh devel_job.sh -y
script:
# get summary of test results
- /tmp/catkin/bin/catkin_test_results $JOB_PATH/catkin_workspace/test_results --all
# use either of the two following options depending on the chosen build tool
- /tmp/catkin/bin/catkin_test_results $JOB_PATH/ws/test_results --all
- colcon test-result --test-result-base $JOB_PATH/ws/test_results --all
notifications:
email: false
Expand Down
12 changes: 7 additions & 5 deletions doc/jobs/prerelease_jobs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,14 @@ scripts which can be invoked manually in the same order:
workspace.
* ``prerelease_build_underlay.py`` runs the *build-and-install* task as well as
the *build-and-test* task on the underlay workspace.
It also invokes the tool ``catkin_test_results --all`` to output a
summary of all tests in the underlay workspace.
It also invokes the tool ``catkin_test_results --all`` /
``colcon test-result --all`` to output a summary of all tests in the underlay
workspace.
* ``prerelease_build_overlay.py`` runs the *build-and-test* task on the overlay
workspace.
It also invokes the tool ``catkin_test_results --all`` to output a
summary of all tests in the overlay workspace.
It also invokes the tool ``catkin_test_results --all`` /
``colcon test-result --all`` to output a summary of all tests in the overlay
workspace.

Run the *prerelease* job on Travis
----------------------------------
Expand Down Expand Up @@ -148,7 +150,7 @@ The following commands are all it takes to run a prerelease job for a custom rep
.. code:: sh
mkdir /tmp/prerelease && cd /tmp/prerelease
git clone -b dummy_package https://github.com/ros-infrastructure/ros_buildfarm catkin_workspace/src/ros_buildfarm
git clone -b dummy_package https://github.com/ros-infrastructure/ros_buildfarm ws/src/ros_buildfarm
generate_prerelease_script.py https://raw.githubusercontent.com/ros-infrastructure/ros_buildfarm_config/production/index.yaml kinetic default ubuntu xenial amd64 --output-dir .
# the argument -y suppresses the question if you want to continue with content already present in the workspace
./prerelease.sh -y
Expand Down
15 changes: 15 additions & 0 deletions ros_buildfarm/argument.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,18 @@ def add_argument_repository_names(parser):
'--repository-names',
nargs='+',
help='A space separated list of repository names')


def add_argument_build_tool(parser, required=False):
default_help = '' if required else ' (default: as set in the build file)'
parser.add_argument(
'--build-tool',
choices=('catkin_make_isolated', 'colcon'),
required=required,
help='The build tool to use' + default_help)


def add_argument_ros_version(parser):
parser.add_argument(
'--ros-version', type=int, required=True,
help='The major ROS version')
3 changes: 3 additions & 0 deletions ros_buildfarm/config/doc_build_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ def __init__(self, name, data):
if 'jenkins_job_timeout' in data:
self.jenkins_job_timeout = int(data['jenkins_job_timeout'])

self.build_tool = data.get('build_tool', 'catkin_make_isolated')
assert self.build_tool in ('catkin_make_isolated', 'colcon')

self.notify_committers = None
if 'notifications' in data:
if 'committers' in data['notifications']:
Expand Down
Loading

0 comments on commit 080da03

Please sign in to comment.