Skip to content

Commit 91e53b7

Browse files
committed
Add README and CI
1 parent 9c987de commit 91e53b7

File tree

6 files changed

+514
-0
lines changed

6 files changed

+514
-0
lines changed

.github/workflows/build.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: CI of mc_panda_lirmm
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
schedule:
11+
# Run on Sunday, Tuesday and Thursday nights
12+
- cron: '0 23 * * 0,1,4'
13+
14+
jobs:
15+
build:
16+
strategy:
17+
matrix:
18+
os: [ubuntu-18.04, ubuntu-20.04]
19+
runs-on: ${{ matrix.os }}
20+
steps:
21+
- uses: actions/checkout@v2
22+
with:
23+
submodules: recursive
24+
- name: Install ROS dependencies
25+
run: |
26+
set -x
27+
set -e
28+
if [ "${{ matrix.os }}" = "ubuntu-18.04" ]
29+
then
30+
export ROS_DISTRO="melodic"
31+
else
32+
export ROS_DISTRO="noetic"
33+
fi
34+
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
35+
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
36+
sudo apt-get update -qq
37+
sudo apt-get -qq remove libomp5-9 || true
38+
sudo apt-get install -qq ros-${ROS_DISTRO}-libfranka ros-${ROS_DISTRO}-franka-ros
39+
. /opt/ros/${ROS_DISTRO}/setup.bash
40+
echo "ROS_DISTRO=${ROS_DISTRO}" >> $GITHUB_ENV
41+
echo "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}" >> $GITHUB_ENV
42+
echo "ROS_MASTER_URI=${ROS_MASTER_URI}" >> $GITHUB_ENV
43+
echo "ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}" >> $GITHUB_ENV
44+
echo "PYTHONPATH=${PYTHONPATH}" >> $GITHUB_ENV
45+
echo "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" >> $GITHUB_ENV
46+
echo "PATH=${PATH}" >> $GITHUB_ENV
47+
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV
48+
- name: Install mc_rtc
49+
run: |
50+
set -x
51+
set -e
52+
curl -1sLf 'https://dl.cloudsmith.io/public/mc-rtc/head/setup.deb.sh' | sudo -E bash
53+
sudo apt-get install -qq libmc-rtc-dev mc-rtc-utils python3-mc-rtc ros-${ROS_DISTRO}-mc-rtc-plugin mc-openrtm jvrc-choreonoid libcnoid-dev
54+
- name: Build and test
55+
uses: jrl-umi3218/github-actions/build-cmake-project@master
56+
with:
57+
compiler: gcc
58+
build-type: RelWithDebInfo
59+
- name: Slack Notification
60+
if: failure()
61+
uses: archive/github-actions-slack@master
62+
with:
63+
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_TOKEN }}
64+
slack-channel: '#ci'
65+
slack-text: >
66+
[mc_panda] Build *${{ matrix.os }}/${{ matrix.build-type }}* failed on ${{ github.ref }}

.github/workflows/package.yml

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
---
2+
name: Package mc_panda_lirmm
3+
on:
4+
repository_dispatch:
5+
types:
6+
- package-master
7+
- package-release
8+
pull_request:
9+
branches:
10+
- "**"
11+
push:
12+
paths-ignore:
13+
- README.md
14+
- ".github/workflows/build.yml"
15+
branches:
16+
- "**"
17+
tags:
18+
- v*
19+
jobs:
20+
check-tag:
21+
runs-on: ubuntu-18.04
22+
steps:
23+
- uses: actions/checkout@v2
24+
with:
25+
submodules: recursive
26+
if: startsWith(github.ref, 'refs/tags/')
27+
- name: Check version coherency
28+
run: |
29+
set -x
30+
export VERSION=`echo ${{ github.ref }} | sed -e 's@refs/tags/v@@'`
31+
echo "REJECTION=PROJECT_VERSION in CMakeLists.txt does not match tag" >> $GITHUB_ENV
32+
grep -q "project(mc_panda_lirmm .* VERSION ${VERSION}.*)" CMakeLists.txt
33+
echo "REJECTION=Upstream version in debian/changelog does not match tag" >> $GITHUB_ENV
34+
head -n 1 debian/changelog | grep -q "mc-panda (${VERSION}"
35+
echo "REJECTION=" >> $GITHUB_ENV
36+
export TAG=`echo ${{ github.ref }} | sed -e 's@refs/tags/@@'`
37+
echo "RELEASE_TAG=${TAG}" >> $GITHUB_ENV
38+
if: startsWith(github.ref, 'refs/tags/')
39+
- name: Delete tag
40+
run: |
41+
set -x
42+
curl --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -X DELETE https://api.github.com/repos/${{ github.repository }}/git/${{ github.ref }}
43+
if: failure()
44+
- name: Notify tag deletion
45+
uses: archive/github-actions-slack@master
46+
with:
47+
slack-bot-user-oauth-access-token: "${{ secrets.SLACK_BOT_TOKEN }}"
48+
slack-channel: "#ci"
49+
slack-text: |
50+
Tag *${{ github.ref }}* in *${{ github.repository }}* was deleted:
51+
${{ env.REJECTION}}
52+
if: failure()
53+
- name: Create release
54+
uses: jrl-umi3218/github-actions/create-release@master
55+
with:
56+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
57+
tag: "${{ env.RELEASE_TAG }}"
58+
if: startsWith(github.ref, 'refs/tags/')
59+
build-packages:
60+
needs: check-tag
61+
strategy:
62+
fail-fast: false
63+
matrix:
64+
dist:
65+
- bionic
66+
- focal
67+
arch:
68+
- amd64
69+
runs-on: ubuntu-18.04
70+
steps:
71+
- uses: actions/checkout@v2
72+
with:
73+
submodules: recursive
74+
- name: Choose extra mirror
75+
run: |
76+
# We upload in all conditions except when building on PR or branch other than master
77+
export PACKAGE_UPLOAD=true
78+
if ${{ startsWith(github.ref, 'refs/tags/') }}
79+
then
80+
export USE_HEAD=false
81+
elif [ "${{ github.event.action }}" == "package-master" ]
82+
then
83+
export USE_HEAD=true
84+
elif [ "${{ github.event.action }}" == "package-release" ]
85+
then
86+
export USE_HEAD=false
87+
export REF=`git tag --sort=committerdate --list 'v[0-9]*'|tail -1`
88+
git checkout $REF
89+
git submodule sync && git submodule update
90+
else
91+
export REF=`echo ${{ github.ref }} | sed -e 's@refs/[a-z]*/@@'`
92+
export USE_HEAD=true
93+
if [ $REF != "master" ]
94+
then
95+
export PACKAGE_UPLOAD=false
96+
fi
97+
fi
98+
if $USE_HEAD
99+
then
100+
echo "CLOUDSMITH_REPO=mc-rtc/head" >> $GITHUB_ENV
101+
echo "PACKAGE_JOB=package-master" >> $GITHUB_ENV
102+
else
103+
echo "CLOUDSMITH_REPO=mc-rtc/stable" >> $GITHUB_ENV
104+
echo "PACKAGE_JOB=package-release" >> $GITHUB_ENV
105+
fi
106+
echo "PACKAGE_UPLOAD=${PACKAGE_UPLOAD}" >> $GITHUB_ENV
107+
- name: Setup ROS packages
108+
run: |
109+
set -x
110+
export ROS_PYTHON=python2.7
111+
export ROS_DISTRO=""
112+
if [ "${{ matrix.dist }}" = "xenial" ]
113+
then
114+
export ROS_DISTRO="kinetic"
115+
fi
116+
if [ "${{ matrix.dist }}" = "bionic" ]
117+
then
118+
export ROS_DISTRO="melodic"
119+
fi
120+
if [ "${{ matrix.dist }}" = "focal" ]
121+
then
122+
export ROS_DISTRO="noetic"
123+
export ROS_PYTHON=python3
124+
export MC_LOG_UI_PYTHON_EXECUTABLE=python3
125+
fi
126+
echo "ROS_DISTRO=${ROS_DISTRO}" >> $GITHUB_ENV
127+
sed -i -e"s/@ROS_DISTRO@/${ROS_DISTRO}/g" debian/control
128+
cat debian/control
129+
sed -i -e"s/@ROS_DISTRO@/${ROS_DISTRO}/g" debian/rules
130+
sed -i -e"s/@ROS_PYTHON@/${ROS_PYTHON}/g" debian/rules
131+
cat debian/rules
132+
- name: Build package
133+
uses: jrl-umi3218/github-actions/build-package-native@master
134+
with:
135+
dist: "${{ matrix.dist }}"
136+
arch: "${{ matrix.arch }}"
137+
ros-distro: "${{ env.ROS_DISTRO }}"
138+
cloudsmith-repo: "${{ env.CLOUDSMITH_REPO }}"
139+
- uses: actions/upload-artifact@v1
140+
with:
141+
name: packages-${{ matrix.dist }}-${{ matrix.arch }}
142+
path: "/tmp/packages-${{ matrix.dist }}-${{ matrix.arch }}/"
143+
if: env.PACKAGE_UPLOAD == 'true'
144+
upload-packages:
145+
needs: build-packages
146+
strategy:
147+
max-parallel: 1
148+
fail-fast: false
149+
matrix:
150+
dist:
151+
- bionic
152+
- focal
153+
arch:
154+
- amd64
155+
runs-on: ubuntu-18.04
156+
steps:
157+
- uses: actions/checkout@v2
158+
with:
159+
submodules: recursive
160+
- name: Choose extra mirror
161+
run: |
162+
# We upload in all conditions except when building on PR or branch other than master
163+
export PACKAGE_UPLOAD=true
164+
if ${{ startsWith(github.ref, 'refs/tags/') }}
165+
then
166+
export USE_HEAD=false
167+
elif [ "${{ github.event.action }}" == "package-master" ]
168+
then
169+
export USE_HEAD=true
170+
elif [ "${{ github.event.action }}" == "package-release" ]
171+
then
172+
export USE_HEAD=false
173+
export REF=`git tag --sort=committerdate --list 'v[0-9]*'|tail -1`
174+
git checkout $REF
175+
git submodule sync && git submodule update
176+
else
177+
export REF=`echo ${{ github.ref }} | sed -e 's@refs/[a-z]*/@@'`
178+
export USE_HEAD=true
179+
if [ $REF != "master" ]
180+
then
181+
export PACKAGE_UPLOAD=false
182+
fi
183+
fi
184+
if $USE_HEAD
185+
then
186+
echo "CLOUDSMITH_REPO=mc-rtc/head" >> $GITHUB_ENV
187+
echo "PACKAGE_JOB=package-master" >> $GITHUB_ENV
188+
else
189+
echo "CLOUDSMITH_REPO=mc-rtc/stable" >> $GITHUB_ENV
190+
echo "PACKAGE_JOB=package-release" >> $GITHUB_ENV
191+
fi
192+
echo "PACKAGE_UPLOAD=${PACKAGE_UPLOAD}" >> $GITHUB_ENV
193+
- name: Download packages
194+
uses: actions/download-artifact@v1
195+
with:
196+
name: packages-${{ matrix.dist }}-${{ matrix.arch }}
197+
if: env.PACKAGE_UPLOAD == 'true'
198+
- name: Upload
199+
uses: jrl-umi3218/github-actions/upload-package@master
200+
with:
201+
dist: ubuntu/${{ matrix.dist }}
202+
repo: "${{ env.CLOUDSMITH_REPO }}"
203+
path: packages-${{ matrix.dist }}-${{ matrix.arch }}
204+
CLOUDSMITH_API_KEY: "${{ secrets.CLOUDSMITH_API_KEY }}"
205+
if: env.PACKAGE_UPLOAD == 'true'

0 commit comments

Comments
 (0)