From 818167c378ea70b97d8546c693bc2534cc2efa7a Mon Sep 17 00:00:00 2001 From: Jon Binney Date: Sat, 19 Jun 2021 12:29:22 -0400 Subject: [PATCH 1/4] Bash script to run tests in CI --- .github/workflows/ros1_ci.yml | 23 ++++------------------- ci.sh | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 19 deletions(-) create mode 100755 ci.sh diff --git a/.github/workflows/ros1_ci.yml b/.github/workflows/ros1_ci.yml index e03efdd9..53920706 100644 --- a/.github/workflows/ros1_ci.yml +++ b/.github/workflows/ros1_ci.yml @@ -1,4 +1,4 @@ -name: CMake +name: Build and run ROS tests on: push: @@ -6,31 +6,16 @@ on: pull_request: branches: [ kinetic-devel ] -env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - jobs: build: - # The CMake configure and build commands are platform agnostic and should work equally - # well on Windows or Mac. You can convert this to a matrix build if you need - # cross-platform coverage. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix runs-on: ubuntu-latest - + container: image: ros:noetic-robot steps: - uses: actions/checkout@v2 - - name: Build - # Build your program with the given configuration - run: cd ${{github.workspace}} && . /opt/ros/noetic/setup.sh && catkin build && catkin build + - name: Build and run tests + run: ./ci.sh - - name: Test - working-directory: ${{github.workspace}}/build - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest -C ${{env.BUILD_TYPE}} - diff --git a/ci.sh b/ci.sh new file mode 100755 index 00000000..fd23e37a --- /dev/null +++ b/ci.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Should be run from the root directory of the repo. +BUILD_DIR=build + +cmake -B ${BUILD_DIR} -DCATKIN_ENABLE_TESTING=1 + +# Build. +make -C ${BUILD_DIR} + +# Build the tests. +make -C ${BUILD_DIR} tests + +# Run the tests. +make -C ${BUILD_DIR} test + +# Summarize test results (also sets the exit status for the script) +catkin_test_results + From 014f17d7a314b2977281d1fe9a86ab7b006234e5 Mon Sep 17 00:00:00 2001 From: Jon Binney Date: Sat, 19 Jun 2021 12:41:09 -0400 Subject: [PATCH 2/4] Source ROS setup file before running CI script --- .github/workflows/ros1_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ros1_ci.yml b/.github/workflows/ros1_ci.yml index 53920706..41b27822 100644 --- a/.github/workflows/ros1_ci.yml +++ b/.github/workflows/ros1_ci.yml @@ -17,5 +17,5 @@ jobs: - uses: actions/checkout@v2 - name: Build and run tests - run: ./ci.sh + run: . /opt/ros/noetic/setup.sh && ./ci.sh From a951994d4248d59012a77b0481d7526ea05da80b Mon Sep 17 00:00:00 2001 From: Jon Binney Date: Sat, 19 Jun 2021 12:44:37 -0400 Subject: [PATCH 3/4] Fail CI script on any command error --- ci.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci.sh b/ci.sh index fd23e37a..34231702 100755 --- a/ci.sh +++ b/ci.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Exit with any error. +set -e + # Should be run from the root directory of the repo. BUILD_DIR=build From 77d01e9891af2708c4d8480323f757576a710fff Mon Sep 17 00:00:00 2001 From: Jon Binney Date: Sat, 19 Jun 2021 12:48:01 -0400 Subject: [PATCH 4/4] Run CI script in noetic perception docker image The robot image doesn't have laser_geometry, which we need. --- .github/workflows/ros1_ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ros1_ci.yml b/.github/workflows/ros1_ci.yml index 41b27822..2b34fab8 100644 --- a/.github/workflows/ros1_ci.yml +++ b/.github/workflows/ros1_ci.yml @@ -11,7 +11,8 @@ jobs: runs-on: ubuntu-latest container: - image: ros:noetic-robot + # The perception docker images includes laser_geometry, which we need. + image: ros:noetic-perception steps: - uses: actions/checkout@v2