Skip to content

Commit

Permalink
Merge pull request #116 from ros-perception/feature/ci-script
Browse files Browse the repository at this point in the history
Bash script to run tests in CI
  • Loading branch information
jonbinney authored Jun 19, 2021
2 parents 2369b64 + 77d01e9 commit 353392e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
26 changes: 6 additions & 20 deletions .github/workflows/ros1_ci.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,22 @@
name: CMake
name: Build and run ROS tests

on:
push:
branches: [ kinetic-devel ]
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
# The perception docker images includes laser_geometry, which we need.
image: ros:noetic-perception

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: . /opt/ros/noetic/setup.sh && ./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}}

22 changes: 22 additions & 0 deletions ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Exit with any error.
set -e

# 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

0 comments on commit 353392e

Please sign in to comment.