Skip to content

Commit

Permalink
[packaging] Setup packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
gergondet committed Dec 9, 2019
1 parent f0a9161 commit 0abe0e5
Show file tree
Hide file tree
Showing 13 changed files with 287 additions and 3 deletions.
174 changes: 174 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
name: Package mc-rtc-data

# This workflow only runs when pushing to master or pushing a tag
#
# On master, it will:
# - Build packages for selected Debian/Ubuntu distro
# - Upload the packages to https://dl.bintray.com/gergondet/multi-contact-head
#
# On tagged versions it will:
# - Create a GitHub release draft
# - Attach the sources to the release
# - Build packages for selected Debian/Ubuntu distro
# - Upload the packages to https://dl.bintray.com/gergondet/multi-contact
# - Finalize the release

on:
push:
branches:
- master
tags:
- v*

jobs:
# For a given tag vX.Y.Z, this checks:
# - set(PROJECT_VERSION X.Y.Z) in CMakeLists.txt
# - version X.Y.Z in debian/changelog
# If these checks fail, the tag is automatically deleted
#
# This job does not run on the master branch
check-tag:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
if: github.ref != 'refs/heads/master'
- name: Check version coherency
run: |
set -x
export VERSION=`echo ${{ github.ref }} | sed -e 's@refs/tags/v@@'`
echo "::set-env name=REJECTION::PROJECT_VERSION in CMakeLists.txt does not match tag"
grep -q "project(mc_rtc_data VERSION ${VERSION})" CMakeLists.txt
echo "::set-env name=REJECTION::PROJECT_VERSION in mc_rtc_data/CMakeLists.txt does not match tag"
grep -q "project(mc_rtc_data VERSION ${VERSION})" mc_rtc_data/CMakeLists.txt
echo "::set-env name=REJECTION::PROJECT_VERSION in mc_rtc_data/package.xml does not match tag"
grep -q "<version>${VERSION}</version>" mc_rtc_data/package.xml
echo "::set-env name=REJECTION::Upstream version in debian/changelog does not match tag"
head -n 1 debian/changelog | grep -q "mc-rtc-data (${VERSION}"
echo "::set-env name=REJECTION::"
export TAG=`echo ${{ github.ref }} | sed -e 's@refs/tags/@@'`
echo "::set-env name=RELEASE_TAG::${TAG}"
if: github.ref != 'refs/heads/master'
- name: Delete tag
run: |
set -x
curl --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -X DELETE https://api.github.com/repos/${{ github.repository }}/git/${{ github.ref }}
if: failure()
- name: Notify tag deletion
uses: archive/github-actions-slack@master
with:
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: '#ci'
slack-text: >
Tag *${{ github.ref }}* in *${{ github.repository }}* was deleted:
${{ env.REJECTION}}
if: failure()
- name: Create release
uses: jrl-umi3218/github-actions/create-release@master
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.RELEASE_TAG }}
if: github.ref != 'refs/heads/master'
# This job build binary packages for Ubuntu
build-packages:
needs: check-tag
strategy:
fail-fast: false
matrix:
dist: [xenial, bionic, focal]
arch: [i386, amd64]
exclude:
- dist: focal
arch: i386
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Setup environment
run: |
set -x
export REF=`echo ${{ github.ref }} | sed -e 's@refs/[a-z]*/@@'`
if [ $REF == "master" ]
then
echo "::set-env name=EXTRA_MIRROR::https://dl.bintray.com/gergondet/multi-contact-head"
else
echo "::set-env name=EXTRA_MIRROR::https://dl.bintray.com/gergondet/multi-contact-release"
fi
export PACKAGES_OUT=/tmp/packages-${{ matrix.dist }}-${{ matrix.arch }}
export ROS_DISTRO=""
if [ "${{ matrix.dist }}" = "xenial" ]
then
export ROS_DISTRO="kinetic"
export PACKAGES_OUT=${PACKAGES_OUT}-${ROS_DISTRO}
fi
if [ "${{ matrix.dist }}" = "bionic" -a "${{ matrix.arch }}" = "amd64" ]
then
export ROS_DISTRO="melodic"
export PACKAGES_OUT=${PACKAGES_OUT}-${ROS_DISTRO}
fi
echo "::set-env name=ROS_DISTRO::${ROS_DISTRO}"
echo "::set-env name=PACKAGES_OUT::${PACKAGES_OUT}"
if [ "${ROS_DISTRO}" != "" ]
then
sed -e"s/@ROS_DISTRO@/${ROS_DISTRO}/" debian/control.ros | tee -a debian/control
sed -e"s/@ROS_DISTRO@/${ROS_DISTRO}/" debian/ros-ROS_DISTRO-mc-rtc-data.links | tee -a debian/ros-${ROS_DISTRO}-mc-rtc-data.links
fi
- name: Build package
uses: jrl-umi3218/github-actions/build-package-native@master
with:
dist: ${{ matrix.dist }}
arch: ${{ matrix.arch }}
ros-distro: ${{ env.ROS_DISTRO }}
other-mirrors: ${{ env.EXTRA_MIRROR }}
other-gpg-keys: "0x892EA6EE273707C6495A6FB6220D644C64666806"
- uses: actions/upload-artifact@v1
with:
name: packages-${{ matrix.dist }}-${{ matrix.arch }}
path: ${{ env.PACKAGES_OUT }}
# This job upload binary packages for Ubuntu
upload-packages:
needs: build-packages
strategy:
max-parallel: 1
fail-fast: false
matrix:
dist: [xenial, bionic, focal]
arch: [i386, amd64]
exclude:
- dist: focal
arch: i386
runs-on: ubuntu-18.04
steps:
- name: Set upload parameters
run: |
export REF=`echo ${{ github.ref }} | sed -e 's@refs/[a-z]*/@@'`
if [ $REF == "master" ]
then
echo "::set-env name=BINTRAY_REPO::multi-contact-head"
echo "::set-env name=BINTRAY_VERSION::HEAD"
else
echo "::set-env name=BINTRAY_REPO::multi-contact-release"
echo "::set-env name=BINTRAY_VERSION::${REF}"
fi
- name: Download packages
uses: actions/download-artifact@v1
with:
name: packages-${{ matrix.dist }}-${{ matrix.arch }}
- name: Upload
uses: jrl-umi3218/github-actions/upload-package@master
with:
dist: ${{ matrix.dist }}
arch: ${{ matrix.arch }}
subject: gergondet
repo: ${{ env.BINTRAY_REPO }}
package: |
name: mc-rtc-data
desc: "Data files for environments and robots description for mc_rtc"
licenses: [BSD 2-Clause]
vcs_url: https://github.com/jrl-umi3218/Tasks
version: ${{ env.BINTRAY_VERSION }}
path: packages-${{ matrix.dist }}-${{ matrix.arch }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1)
cmake_policy(SET CMP0048 NEW)
project(mc_rtc_ros_data VERSION 1.0.0)
project(mc_rtc_data VERSION 1.0.0)

enable_testing()

Expand Down
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mc-rtc-data (1.0.0-1ubuntu1) unstable; urgency=medium

* Initial release

-- Pierre Gergondet <[email protected]> Mon, 09 Dec 2019 17:20:41 +0800
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
20 changes: 20 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Source: mc-rtc-data
Priority: optional
Maintainer: Pierre Gergondet <[email protected]>
Standards-Version: 3.9.5
Section: misc
Homepage: https://github.com/jrl-umi3218/mc_rtc_data
Vcs-git: https://github.com/jrl-umi3218/mc_rtc_data
Vcs-Browser: https://github.com/jrl-umi3218/mc_rtc_data
Build-Depends: debhelper (>= 9),
cmake

Package: mc-rtc-data
Architecture: all
Section: misc
Depends: ${misc:Depends}
Description: Environments/Robots description for mc_rtc
Data files for environments and robots description for mc_rtc
.
This package contains data (meshes, urdf, rsdf and convex files) and
CMake config file to help locate the data.
11 changes: 11 additions & 0 deletions debian/control.ros
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

Package: ros-@ROS_DISTRO@-mc-rtc-data
Architecture: all
Section: misc
Depends: ${misc:Depends},
mc-rtc-data,
ros-@ROS_DISTRO@-ros-base
Description: Environments/Robots description for mc_rtc (ROS)
Data files for environments and robots description for mc_rtc
.
This package creates symbolic links to the regular package
52 changes: 52 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: mc-rtc-data
Source: https://github.com/jrl-umi3218/mc_rtc_data

Files: *
Copyright: 2012-2019 CNRS-UM LIRMM
2012-2019 CNRS-AIST JRL
License: BSD-2-Clause
BSD 2-Clause License
.
Copyright (c) 2012-2019, CNRS-UM LIRMM, CNRS-AIST JRL
All rights reserved.
.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Files: debian/*
Copyright: 2016-2018 Pierre Gergondet <[email protected]>
License: GPL-2+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
2 changes: 2 additions & 0 deletions debian/mc-rtc-data.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
usr/lib/cmake/*
usr/share/mc_rtc/*
3 changes: 3 additions & 0 deletions debian/ros-ROS_DISTRO-mc-rtc-data.links
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/usr/share/mc_rtc/mc_env_description /opt/ros/@ROS_DISTRO@/share/mc_env_description
/usr/share/mc_rtc/mc_int_obj_description /opt/ros/@ROS_DISTRO@/share/mc_int_obj_description
/usr/share/mc_rtc/jvrc_description /opt/ros/@ROS_DISTRO@/share/jvrc_description
13 changes: 13 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

TMP = $(CURDIR)/debian/tmp

%:
dh $@

override_dh_auto_install:
dh_auto_install --destdir=$(TMP)
1 change: 1 addition & 0 deletions debian/source.lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mc-rtc-data source: pear-package-without-pkg-php-tools-builddep
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)
5 changes: 3 additions & 2 deletions mc_rtc_data/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 2.8.3)
project(mc_rtc_data)
cmake_minimum_required(VERSION 3.1)
cmake_policy(SET CMP0048 NEW)
project(mc_rtc_data VERSION 1.0.0)
find_package(catkin REQUIRED)
catkin_metapackage()

0 comments on commit 0abe0e5

Please sign in to comment.