Skip to content

Commit

Permalink
Merge pull request #10 from gergondet/topic/StepByStep
Browse files Browse the repository at this point in the history
[mc_rtc_ticker] Step by step
  • Loading branch information
gergondet authored Jul 1, 2020
2 parents 79018de + c65674a commit 5de3a97
Show file tree
Hide file tree
Showing 13 changed files with 491 additions and 110 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ jobs:
github:
- path: jrl-umi3218/mc_rtc_data
github: |
- path: gabime/spdlog
ref: v1.6.1
options: -DSPDLOG_BUILD_EXAMPLE:BOOL=OFF -DSPDLOG_BUILD_SHARED:BOOL=ON
- path: humanoid-path-planner/hpp-spline
ref: v4.7.0
options: -DBUILD_PYTHON_INTERFACE:BOOL=OFF
Expand Down
212 changes: 140 additions & 72 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,28 @@
---
name: Package mc-rtc-ros

# 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:
repository_dispatch:
types: [package-master, package-release]
types:
- package-master
- package-release
pull_request:
branches:
- "**"
push:
paths-ignore:
- ".gitlab-ci.yml"
- ".jrl-ci"
- README.md
- ".github/workflows/build.yml"
branches:
- master
- "**"
tags:
- v*

- 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
- uses: actions/checkout@v2
with:
submodules: recursive
if: startsWith(github.ref, 'refs/tags/')
Expand All @@ -56,57 +46,81 @@ jobs:
- 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: >
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 }}
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
tag: "${{ env.RELEASE_TAG }}"
if: startsWith(github.ref, 'refs/tags/')
# This job build binary packages for Ubuntu
build-packages:
needs: check-tag
strategy:
fail-fast: false
matrix:
dist: [xenial, bionic]
arch: [i386, amd64]
dist:
- xenial
- bionic
- focal
arch:
- i386
- amd64
exclude:
- dist: bionic
arch: i386
- dist: focal
arch: i386
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup environment
- name: Choose extra mirror
run: |
set -e
set -x
if [ "${{ github.event.action }}" == "package-master" ]
# We upload in all conditions except when building on PR or branch other than master
export PACKAGE_UPLOAD=true
if ${{ startsWith(github.ref, 'refs/tags/') }}
then
export USE_HEAD=false
elif [ "${{ github.event.action }}" == "package-master" ]
then
export REF=master
export USE_HEAD=true
elif [ "${{ github.event.action }}" == "package-release" ]
then
export USE_HEAD=false
export REF=`git tag --sort=committerdate --list 'v[0-9]*'|tail -1`
git checkout $REF
git submodule sync && git submodule update
else
export REF=`echo ${{ github.ref }} | sed -e 's@refs/[a-z]*/@@'`
export USE_HEAD=true
if [ $REF != "master" ]
then
export PACKAGE_UPLOAD=false
fi
fi
if [ $REF == "master" ]
if $USE_HEAD
then
echo "::set-env name=BINTRAY_REPO::multi-contact-head"
echo "::set-env name=BINTRAY_VERSION::HEAD"
echo "::set-env name=EXTRA_MIRROR::https://dl.bintray.com/gergondet/multi-contact-head"
echo "::set-env name=PACKAGE_JOB::package-master"
else
echo "::set-env name=BINTRAY_REPO::multi-contact-release"
echo "::set-env name=BINTRAY_VERSION::${REF}"
echo "::set-env name=EXTRA_MIRROR::https://dl.bintray.com/gergondet/multi-contact-release"
echo "::set-env name=PACKAGE_JOB::package-release"
fi
echo "::set-env name=PACKAGE_UPLOAD::${PACKAGE_UPLOAD}"
- name: Setup ROS packages
run: |
set -x
export PACKAGES_OUT=/tmp/packages-${{ matrix.dist }}-${{ matrix.arch }}
export ROS_DISTRO=""
export PYTHON_EXECUTABLE=/usr/bin/python
if [ "${{ matrix.dist }}" = "xenial" ]
then
export ROS_DISTRO="kinetic"
Expand All @@ -117,6 +131,13 @@ jobs:
export ROS_DISTRO="melodic"
export PACKAGES_OUT=${PACKAGES_OUT}-${ROS_DISTRO}
fi
if [ "${{ matrix.dist }}" = "focal" ]
then
export PYTHON_EXECUTABLE=/usr/bin/python3
export ROS_DISTRO="noetic"
sed -i -e"s/python2.7/python3/" debian/rules.ros
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}" != "" ]
Expand All @@ -127,6 +148,7 @@ jobs:
cat debian/control
mv debian/rules.ros debian/rules
sed -i -e"s/@ROS_DISTRO@/${ROS_DISTRO}/" debian/rules
sed -i -e"s#@PYTHON_EXECUTABLE@#${PYTHON_EXECUTABLE}#" debian/rules
cat debian/rules
sed -e"s/@ROS_DISTRO@/${ROS_DISTRO}/" debian/ros-ROS_DISTRO-mc-convex-visualization.install | tee -a debian/ros-${ROS_DISTRO}-mc-convex-visualization.install
sed -e"s/@ROS_DISTRO@/${ROS_DISTRO}/" debian/ros-ROS_DISTRO-mc-log-visualization.install | tee -a debian/ros-${ROS_DISTRO}-mc-log-visualization.install
Expand All @@ -138,96 +160,142 @@ jobs:
- 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"
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
path: "${{ env.PACKAGES_OUT }}"
if: env.PACKAGE_UPLOAD == 'true'
upload-packages:
needs: build-packages
strategy:
max-parallel: 1
fail-fast: false
matrix:
dist: [xenial, bionic]
arch: [i386, amd64]
dist:
- xenial
- bionic
- focal
arch:
- i386
- amd64
exclude:
- dist: bionic
arch: i386
- dist: focal
arch: i386
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Set upload parameters
- name: Choose extra mirror
run: |
if [ "${{ github.event.action }}" == "package-master" ]
# We upload in all conditions except when building on PR or branch other than master
export PACKAGE_UPLOAD=true
if ${{ startsWith(github.ref, 'refs/tags/') }}
then
export REF=master
export USE_HEAD=false
elif [ "${{ github.event.action }}" == "package-master" ]
then
export USE_HEAD=true
elif [ "${{ github.event.action }}" == "package-release" ]
then
export USE_HEAD=false
export REF=`git tag --sort=committerdate --list 'v[0-9]*'|tail -1`
git checkout $REF
git submodule sync && git submodule update
else
export REF=`echo ${{ github.ref }} | sed -e 's@refs/[a-z]*/@@'`
export USE_HEAD=true
if [ $REF != "master" ]
then
export PACKAGE_UPLOAD=false
fi
fi
if [ $REF == "master" ]
if $USE_HEAD
then
echo "::set-env name=BINTRAY_REPO::multi-contact-head"
echo "::set-env name=BINTRAY_VERSION::HEAD"
echo "::set-env name=EXTRA_MIRROR::https://dl.bintray.com/gergondet/multi-contact-head"
echo "::set-env name=PACKAGE_JOB::package-master"
else
echo "::set-env name=BINTRAY_REPO::multi-contact-release"
echo "::set-env name=BINTRAY_VERSION::${REF}"
echo "::set-env name=EXTRA_MIRROR::https://dl.bintray.com/gergondet/multi-contact-release"
echo "::set-env name=PACKAGE_JOB::package-release"
fi
echo "::set-env name=PACKAGE_UPLOAD::${PACKAGE_UPLOAD}"
- name: Download packages
uses: actions/download-artifact@v1
with:
name: packages-${{ matrix.dist }}-${{ matrix.arch }}
if: env.PACKAGE_UPLOAD == 'true'
- name: Upload
uses: jrl-umi3218/github-actions/upload-package@master
with:
dist: ${{ matrix.dist }}
arch: ${{ matrix.arch }}
dist: "${{ matrix.dist }}"
arch: "${{ matrix.arch }}"
subject: gergondet
repo: ${{ env.BINTRAY_REPO }}
repo: "${{ env.BINTRAY_REPO }}"
package: |
name: mc-rtc-ros
desc: "mc_rtc tools based on the ROS framework"
licenses: [BSD 2-Clause]
vcs_url: https://github.com/jrl-umi3218/mc_rtc_ros
version: ${{ env.BINTRAY_VERSION }}
version: "${{ env.BINTRAY_VERSION }}"
path: packages-${{ matrix.dist }}-${{ matrix.arch }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
# This job forces a mirror sync
BINTRAY_API_KEY: "${{ secrets.BINTRAY_API_KEY }}"
GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}"
if: env.PACKAGE_UPLOAD == 'true'
mirror-sync:
needs: upload-packages
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Set repository parameters
- name: Choose extra mirror
run: |
if [ "${{ github.event.action }}" == "package-master" ]
# We upload in all conditions except when building on PR or branch other than master
export PACKAGE_UPLOAD=true
if ${{ startsWith(github.ref, 'refs/tags/') }}
then
export USE_HEAD=false
elif [ "${{ github.event.action }}" == "package-master" ]
then
export REF=master
export USE_HEAD=true
elif [ "${{ github.event.action }}" == "package-release" ]
then
export USE_HEAD=false
export REF=`git tag --sort=committerdate --list 'v[0-9]*'|tail -1`
git checkout $REF
git submodule sync && git submodule update
else
export REF=`echo ${{ github.ref }} | sed -e 's@refs/[a-z]*/@@'`
export USE_HEAD=true
if [ $REF != "master" ]
then
export PACKAGE_UPLOAD=false
fi
fi
if [ $REF == "master" ]
if $USE_HEAD
then
echo "::set-env name=BINTRAY_REPO::multi-contact-head"
echo "::set-env name=BINTRAY_VERSION::HEAD"
echo "::set-env name=EXTRA_MIRROR::https://dl.bintray.com/gergondet/multi-contact-head"
echo "::set-env name=PACKAGE_JOB::package-master"
else
echo "::set-env name=BINTRAY_REPO::multi-contact-release"
echo "::set-env name=BINTRAY_VERSION::${REF}"
echo "::set-env name=EXTRA_MIRROR::https://dl.bintray.com/gergondet/multi-contact-release"
echo "::set-env name=PACKAGE_JOB::package-release"
fi
echo "::set-env name=PACKAGE_UPLOAD::${PACKAGE_UPLOAD}"
- name: Request mirror sync
run: |
curl -ugergondet:${{ secrets.BINTRAY_API_KEY }} --header "X-GPG-PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}" -X POST https://api.bintray.com/calc_metadata/gergondet/${{ env.BINTRAY_REPO }}
run: 'curl -ugergondet:${{ secrets.BINTRAY_API_KEY }} --header "X-GPG-PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}" -X POST https://api.bintray.com/calc_metadata/gergondet/${{ env.BINTRAY_REPO }}
'
if: env.PACKAGE_UPLOAD == 'true'
Loading

0 comments on commit 5de3a97

Please sign in to comment.