Skip to content

Commit

Permalink
Automatically run prerelease-test on CI (#365)
Browse files Browse the repository at this point in the history
* Automatically run pre-release test

* Split job to avoid time-limit
  • Loading branch information
at-wat authored Aug 15, 2019
1 parent fbee5e0 commit a26750a
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 3 deletions.
18 changes: 15 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ branches:
before_install:
- .travis/load_cache.sh
- pip install --user gh-pr-comment

install: true

script:
- docker build
--cache-from ${DOCKER_CACHE_REGISTRY}:${ROS_DISTRO_TARGET}
Expand All @@ -45,3 +42,18 @@ script:
$(bash <(curl -s https://codecov.io/env))
${DOCKER_CACHE_TARGET}:${ROS_DISTRO_TARGET} /catkin_ws/src/${PACKAGE_NAME}/.travis/test.sh
- bash -c "[ x${COVERAGE_TEST} != xtrue ] && .travis/save_cache.sh || true"

jobs:
include:
- stage: prerelease-test
if: head_branch =~ ^release-.*$
env:
- ROS_DISTRO_TARGET=kinetic COVERAGE_TEST=false
before_install: pip install --user gh-pr-comment
script: .travis/prerelease_test.sh
- stage: prerelease-test
if: head_branch =~ ^release-.*$
env:
- ROS_DISTRO_TARGET=melodic COVERAGE_TEST=false
before_install: pip install --user gh-pr-comment
script: .travis/prerelease_test.sh
42 changes: 42 additions & 0 deletions .travis/prerelease_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

set -eu

if [[ ! "${TRAVIS_PULL_REQUEST_BRANCH}" =~ ^release-.*$ ]]; then
echo "Skipping prerelease test"
exit 0
fi

case ${ROS_DISTRO_TARGET} in
kinetic )
UBUNTU_DIST_TARGET=xenial
;;
melodic )
UBUNTU_DIST_TARGET=bionic
;;
* )
echo "Unknown ROS_DISTRO_TARGET: ${ROS_DISTRO_TARGET}"
exit 1
;;
esac

echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/ros-latest.list
sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends python3-ros-buildfarm python3-pip git
sudo pip3 install git+https://github.com/ros/catkin

mkdir -p /tmp/prerelease_job
cd /tmp/prerelease_job

generate_prerelease_script.py \
https://raw.githubusercontent.com/ros-infrastructure/ros_buildfarm_config/production/index.yaml \
${ROS_DISTRO_TARGET} default ubuntu ${UBUNTU_DIST_TARGET} amd64 \
--custom-repo \
neonavigation__custom-2:git:https://github.com/at-wat/neonavigation.git:${TRAVIS_PULL_REQUEST_BRANCH} \
--level 1 \
--output-dir ./

./prerelease.sh \
&& gh-pr-comment "[#${TRAVIS_BUILD_NUMBER}-prerelease] PASSED on ${ROS_DISTRO_TARGET}" "" \
|| (gh-pr-comment "[#${TRAVIS_BUILD_NUMBER}-prerelease] FAILED on ${ROS_DISTRO_TARGET}" ""; false)

0 comments on commit a26750a

Please sign in to comment.