Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI scripts #17

Merged
merged 3 commits into from Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 4 additions & 12 deletions .travis.yml
@@ -1,9 +1,6 @@
dist: bionic
services: docker
language: bash
addons:
apt:
packages:
- python-pip

env:
global:
Expand All @@ -16,21 +13,16 @@ branches:
- master

before_install:
- pip install --user gh-pr-comment

install: true

- curl -sL https://raw.githubusercontent.com/at-wat/gh-pr-comment/master/install.sh | sh -s
script:
- cp ~/.local/bin/gh-pr-comment .travis/
- docker build
-t mcl-3dl-msgs
-f .travis/Dockerfile
--pull=true ${TRAVIS_BUILD_DIR}
--build-arg ROS_DISTRO=${ROS_DISTRO_TARGET}
|| (gh-pr-comment "[#${TRAVIS_BUILD_NUMBER}] FAILED on ${ROS_DISTRO_TARGET}" "docker build failed"; false)
- docker run --rm -it
-e TRAVIS_PULL_REQUEST
-e TRAVIS_PULL_REQUEST_SLUG
-e TRAVIS_BOT_GITHUB_TOKEN
-e GITHUB_API_URL_BASE
-e TRAVIS_BUILD_NUMBER
$(sh <(curl -s https://raw.githubusercontent.com/at-wat/gh-pr-comment/master/env.sh))
mcl-3dl-msgs /catkin_ws/src/${PACKAGE_NAME}/.travis/test.sh
12 changes: 10 additions & 2 deletions .travis/Dockerfile
@@ -1,17 +1,24 @@
ARG ROS_DISTRO=kinetic
FROM ros:${ROS_DISTRO}-ros-core

RUN sed -e \
's|http://archive\.ubuntu\.com|http://us-east-1.ec2.archive.ubuntu.com|' \
-i /etc/apt/sources.list

RUN apt-get -qq update \
&& apt-get install -y --no-install-recommends \
build-essential \
libxml2-utils \
python-pip \
python-rosdep \
sudo \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN pip install gh-pr-comment catkin_lint
RUN pip install catkin_lint

RUN rosdep update \
RUN rosdep init \
&& rosdep update \
&& mkdir -p /catkin_ws/src \
&& cd /catkin_ws/src \
&& . /opt/ros/${ROS_DISTRO}/setup.sh \
Expand All @@ -24,3 +31,4 @@ RUN apt-get -qq update \
&& rm -rf /var/lib/apt/lists/*

COPY . /catkin_ws/src/mcl_3dl_msgs
COPY .travis/gh-pr-comment /usr/local/bin/
14 changes: 8 additions & 6 deletions .travis/test.sh
Expand Up @@ -5,14 +5,16 @@ set -o errexit
source /opt/ros/${ROS_DISTRO}/setup.bash
cd /catkin_ws

md_codeblock='```'

pkgs=$(find . -name package.xml | xargs -n1 dirname)
catkin_lint $pkgs \
|| (gh-pr-comment "[#${TRAVIS_BUILD_NUMBER}] FAILED on ${ROS_DISTRO}" \
"<details><summary>catkin_lint failed</summary>

\`\`\`
${md_codeblock}
$(catkin_lint $pkgs 2>&1)
\`\`\`
${md_codeblock}
</details>"; false)


Expand All @@ -33,15 +35,15 @@ catkin_make run_tests ${CM_OPTIONS} \
if [ catkin_test_results ];
then
result_text="
\`\`\`
${md_codeblock}
$(catkin_test_results --all | grep -v Skipping || true)
\`\`\`
${md_codeblock}
"
else
result_text="
\`\`\`
${md_codeblock}
$(catkin_test_results --all | grep -v Skipping || true)
\`\`\`
${md_codeblock}
$(find build/test_results/ -name *.xml | xargs -n 1 -- bash -c 'echo; echo \#\#\# $0; echo; echo \\\`\\\`\\\`; xmllint --format $0; echo \\\`\\\`\\\`;')
"
fi
Expand Down