Skip to content

Commit

Permalink
Uses ros-action-ci in build.yaml workflow. (#67)
Browse files Browse the repository at this point in the history
* Uses ros-action-ci in build.yaml workflow.

* Modifies tests to use compile definitions.

Signed-off-by: Franco Cipollone <[email protected]>
  • Loading branch information
francocipollone authored Jun 16, 2022
1 parent 9667048 commit 1645672
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 121 deletions.
8 changes: 8 additions & 0 deletions .github/dependencies.repos
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ repositories:
type: git
url: https://github.com/ToyotaResearchInstitute/ament_cmake_doxygen
version: main
maliput:
type: git
url: https://github.com/maliput/maliput
version: main
maliput_py:
type: git
url: https://github.com/maliput/maliput_py
version: main
pybind11:
type: git
url: https://github.com/RobotLocomotion/pybind11.git
Expand Down
92 changes: 9 additions & 83 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: gcc

on:
push:
pull_request:
branches:
- main
Expand All @@ -9,7 +10,6 @@ on:
env:
PACKAGE_NAME: maliput_dragway
ROS_DISTRO: foxy
ROS_WS: maliput_ws

jobs:
compile_and_test:
Expand All @@ -18,86 +18,12 @@ jobs:
container:
image: ubuntu:20.04
steps:
# setup-ros first since it installs git, which is needed to fetch all branches from actions/checkout
- uses: ros-tooling/[email protected]
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ros-tooling/[email protected]
- uses: ros-tooling/[email protected]
id: action_ros_ci_step
with:
path: ${{ env.ROS_WS }}/src/${{ env.PACKAGE_NAME }}
# clone private dependencies
- uses: actions/checkout@v2
with:
repository: ToyotaResearchInstitute/maliput
fetch-depth: 0
path: ${{ env.ROS_WS }}/src/maliput
token: ${{ secrets.MALIPUT_TOKEN }}
- uses: actions/checkout@v2
with:
repository: ToyotaResearchInstitute/maliput_py
fetch-depth: 0
path: ${{ env.ROS_WS }}/src/maliput_py
token: ${{ secrets.MALIPUT_TOKEN }}
- name: check if dependencies have a matching branch
shell: bash
working-directory: ${{ env.ROS_WS }}/src
run: ./${PACKAGE_NAME}/.github/try_vcs_checkout ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} .
# clone public dependencies
- name: vcs import
shell: bash
working-directory: ${{ env.ROS_WS }}
run: vcs import src < src/${PACKAGE_NAME}/.github/dependencies.repos
- run: colcon graph
shell: bash
working-directory: ${{ env.ROS_WS }}
- name: rosdep install
shell: bash
working-directory: ${{ env.ROS_WS }}
run: |
rosdep update --include-eol-distros;
rosdep install -i -y --rosdistro ${ROS_DISTRO} --skip-keys "pybind11" --from-paths src
# Build libraries.
- name: colcon build libraries
shell: bash
working-directory: ${{ env.ROS_WS }}
run: |
. /opt/ros/${ROS_DISTRO}/setup.bash;
colcon build --packages-up-to ${PACKAGE_NAME} \
--event-handlers=console_direct+ \
--cmake-args -DBUILD_TESTING=OFF -DBUILD_DOCS=OFF;
# Build tests for current package.
- name: colcon build tests
shell: bash
working-directory: ${{ env.ROS_WS }}
run: |
. /opt/ros/${ROS_DISTRO}/setup.bash;
colcon build --packages-select ${PACKAGE_NAME} \
--event-handlers=console_direct+ \
--cmake-args -DBUILD_TESTING=ON -DBUILD_DOCS=OFF;
# Test package.
- name: colcon test
shell: bash
working-directory: ${{ env.ROS_WS }}
run: |
. /opt/ros/${ROS_DISTRO}/setup.bash;
. install/setup.bash;
colcon test --packages-select ${PACKAGE_NAME} --event-handlers=console_direct+;
colcon test-result --verbose;
# Build documentation.
- name: colcon build doxygen documentation
shell: bash
working-directory: ${{ env.ROS_WS }}
run: |
. /opt/ros/${ROS_DISTRO}/setup.bash;
colcon build --packages-up-to ${PACKAGE_NAME} \
--event-handlers=console_direct+ \
--cmake-args -DBUILD_TESTING=OFF -DBUILD_DOCS=ON;
# Test doxygen documentation.
- name: colcon test doxygen documentation
shell: bash
working-directory: ${{ env.ROS_WS }}
run: |
. /opt/ros/${ROS_DISTRO}/setup.bash;
. install/setup.bash;
colcon test --packages-select ${PACKAGE_NAME} \
--ctest-args ' -R' ' maliput_dragway_doxygen_warnings' \
--event-handlers=console_direct+;
colcon test-result --verbose;
package-name: ${{ env.PACKAGE_NAME }}
target-ros2-distro: ${{ env.ROS_DISTRO }}
vcs-repo-file-url: ${GITHUB_WORKSPACE}/.github/dependencies.repos
rosdep-skip-keys: pybind11
25 changes: 6 additions & 19 deletions .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,10 @@ jobs:
LDFLAGS: -fuse-ld=lld-8
steps:
# setup-ros first since it installs git, which is needed to fetch all branches from actions/checkout
- uses: ros-tooling/setup-ros@0.2.1
- uses: actions/checkout@v2
- uses: ros-tooling/setup-ros@v0.3
- uses: actions/checkout@v3
with:
path: ${{ env.ROS_WS }}/src/${{ env.PACKAGE_NAME }}
# clone private dependencies
- uses: actions/checkout@v2
with:
repository: ToyotaResearchInstitute/maliput
fetch-depth: 0
path: ${{ env.ROS_WS }}/src/maliput
token: ${{ secrets.MALIPUT_TOKEN }}
- uses: actions/checkout@v2
with:
repository: ToyotaResearchInstitute/maliput_py
fetch-depth: 0
path: ${{ env.ROS_WS }}/src/maliput_py
token: ${{ secrets.MALIPUT_TOKEN }}
- name: check if dependencies have a matching branch
shell: bash
working-directory: ${{ env.ROS_WS }}/src
run: ./${PACKAGE_NAME}/.github/try_vcs_checkout ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} .
- name: clang 8 install
shell: bash
run: ${{ env.ROS_WS }}/src/${{ env.PACKAGE_NAME }}/.github/clang_suite_installation.sh
Expand All @@ -63,6 +46,10 @@ jobs:
shell: bash
working-directory: ${{ env.ROS_WS }}
run: vcs import src < src/${PACKAGE_NAME}/.github/dependencies.repos
- name: check if dependencies have a matching branch
shell: bash
working-directory: ${{ env.ROS_WS }}/src
run: ./${PACKAGE_NAME}/.github/try_vcs_checkout ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} .
- run: colcon graph
shell: bash
working-directory: ${{ env.ROS_WS }}
Expand Down
25 changes: 6 additions & 19 deletions .github/workflows/scan_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,10 @@ jobs:
LDFLAGS: -fuse-ld=lld-8
steps:
# setup-ros first since it installs git, which is needed to fetch all branches from actions/checkout
- uses: ros-tooling/setup-ros@0.2.1
- uses: actions/checkout@v2
- uses: ros-tooling/setup-ros@v0.3
- uses: actions/checkout@v3
with:
path: ${{ env.ROS_WS }}/src/${{ env.PACKAGE_NAME }}
# clone private dependencies
- uses: actions/checkout@v2
with:
repository: ToyotaResearchInstitute/maliput
fetch-depth: 0
path: ${{ env.ROS_WS }}/src/maliput
token: ${{ secrets.MALIPUT_TOKEN }}
- uses: actions/checkout@v2
with:
repository: ToyotaResearchInstitute/maliput_py
fetch-depth: 0
path: ${{ env.ROS_WS }}/src/maliput_py
token: ${{ secrets.MALIPUT_TOKEN }}
- name: check if dependencies have a matching branch
shell: bash
working-directory: ${{ env.ROS_WS }}/src
run: ./${PACKAGE_NAME}/.github/try_vcs_checkout ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} .
- name: clang 8 install
shell: bash
run: ${{ env.ROS_WS }}/src/${{ env.PACKAGE_NAME }}/.github/clang_suite_installation.sh
Expand All @@ -52,6 +35,10 @@ jobs:
shell: bash
working-directory: ${{ env.ROS_WS }}
run: vcs import src < src/${PACKAGE_NAME}/.github/dependencies.repos
- name: check if dependencies have a matching branch
shell: bash
working-directory: ${{ env.ROS_WS }}/src
run: ./${PACKAGE_NAME}/.github/try_vcs_checkout ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} .
- run: colcon graph
shell: bash
working-directory: ${{ env.ROS_WS }}
Expand Down
6 changes: 6 additions & 0 deletions test/plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ macro(add_dependencies_to_test target)
ENABLE_EXPORTS ON
)

set(ROAD_NETWORK_PLUGIN ${CMAKE_INSTALL_PREFIX}/lib/plugins/)
target_compile_definitions(${target}
PRIVATE
DEF_ROAD_NETWORK_PLUGIN="${ROAD_NETWORK_PLUGIN}"
)

target_link_libraries(${target}
maliput_dragway::maliput_dragway
maliput::plugin
Expand Down
3 changes: 3 additions & 0 deletions test/plugin/road_network_plugin_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdlib.h>

#include <map>
#include <memory>
#include <string>
Expand All @@ -50,6 +52,7 @@ namespace dragway {
namespace {

GTEST_TEST(RoadNetworkLoader, VerifyRoadNetworkPlugin) {
setenv("MALIPUT_PLUGIN_PATH", DEF_ROAD_NETWORK_PLUGIN, 1);
const plugin::MaliputPlugin::Id kDragwayPluginId{"maliput_dragway"};
static constexpr double kTolerance{1e-15};
const std::map<std::string, std::string> rg_dragway_properties{
Expand Down

0 comments on commit 1645672

Please sign in to comment.