-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
519 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
--- | ||
name: Package mc_panda | ||
on: | ||
repository_dispatch: | ||
types: | ||
- package-master | ||
- package-release | ||
pull_request: | ||
branches: | ||
- "**" | ||
push: | ||
paths-ignore: | ||
- README.md | ||
- ".github/workflows/build.yml" | ||
branches: | ||
- "**" | ||
tags: | ||
- v* | ||
jobs: | ||
check-tag: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
if: startsWith(github.ref, 'refs/tags/') | ||
- name: Check version coherency | ||
run: | | ||
set -x | ||
export VERSION=`echo ${{ github.ref }} | sed -e 's@refs/tags/v@@'` | ||
echo "REJECTION=PROJECT_VERSION in CMakeLists.txt does not match tag" >> $GITHUB_ENV | ||
grep -q "project(mc_panda .* VERSION ${VERSION}.*)" CMakeLists.txt | ||
echo "REJECTION=Upstream version in debian/changelog does not match tag" >> $GITHUB_ENV | ||
head -n 1 debian/changelog | grep -q "mc-panda (${VERSION}" | ||
echo "REJECTION=" >> $GITHUB_ENV | ||
export TAG=`echo ${{ github.ref }} | sed -e 's@refs/tags/@@'` | ||
echo "RELEASE_TAG=${TAG}" >> $GITHUB_ENV | ||
if: startsWith(github.ref, 'refs/tags/') | ||
- 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: startsWith(github.ref, 'refs/tags/') | ||
build-packages: | ||
needs: check-tag | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
dist: | ||
- bionic | ||
- focal | ||
arch: | ||
- amd64 | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: Choose extra mirror | ||
run: | | ||
# 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 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 $USE_HEAD | ||
then | ||
echo "CLOUDSMITH_REPO=mc-rtc/head" >> $GITHUB_ENV | ||
echo "PACKAGE_JOB=package-master" >> $GITHUB_ENV | ||
else | ||
echo "CLOUDSMITH_REPO=mc-rtc/stable" >> $GITHUB_ENV | ||
echo "PACKAGE_JOB=package-release" >> $GITHUB_ENV | ||
fi | ||
echo "PACKAGE_UPLOAD=${PACKAGE_UPLOAD}" >> $GITHUB_ENV | ||
- name: Setup ROS packages | ||
run: | | ||
set -x | ||
export ROS_PYTHON=python2.7 | ||
export ROS_DISTRO="" | ||
if [ "${{ matrix.dist }}" = "xenial" ] | ||
then | ||
export ROS_DISTRO="kinetic" | ||
fi | ||
if [ "${{ matrix.dist }}" = "bionic" ] | ||
then | ||
export ROS_DISTRO="melodic" | ||
fi | ||
if [ "${{ matrix.dist }}" = "focal" ] | ||
then | ||
export ROS_DISTRO="noetic" | ||
export ROS_PYTHON=python3 | ||
export MC_LOG_UI_PYTHON_EXECUTABLE=python3 | ||
fi | ||
echo "ROS_DISTRO=${ROS_DISTRO}" >> $GITHUB_ENV | ||
sed -i -e"s/@ROS_DISTRO@/${ROS_DISTRO}/g" debian/control | ||
cat debian/control | ||
sed -i -e"s/@ROS_DISTRO@/${ROS_DISTRO}/g" debian/rules | ||
sed -i -e"s/@ROS_PYTHON@/${ROS_PYTHON}/g" debian/rules | ||
cat debian/rules | ||
- name: Build package | ||
uses: jrl-umi3218/github-actions/build-package-native@master | ||
with: | ||
dist: "${{ matrix.dist }}" | ||
arch: "${{ matrix.arch }}" | ||
ros-distro: "${{ env.ROS_DISTRO }}" | ||
cloudsmith-repo: "${{ env.CLOUDSMITH_REPO }}" | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: packages-${{ matrix.dist }}-${{ matrix.arch }} | ||
path: "/tmp/packages-${{ matrix.dist }}-${{ matrix.arch }}/" | ||
if: env.PACKAGE_UPLOAD == 'true' | ||
upload-packages: | ||
needs: build-packages | ||
strategy: | ||
max-parallel: 1 | ||
fail-fast: false | ||
matrix: | ||
dist: | ||
- bionic | ||
- focal | ||
arch: | ||
- amd64 | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: Choose extra mirror | ||
run: | | ||
# 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 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 $USE_HEAD | ||
then | ||
echo "CLOUDSMITH_REPO=mc-rtc/head" >> $GITHUB_ENV | ||
echo "PACKAGE_JOB=package-master" >> $GITHUB_ENV | ||
else | ||
echo "CLOUDSMITH_REPO=mc-rtc/stable" >> $GITHUB_ENV | ||
echo "PACKAGE_JOB=package-release" >> $GITHUB_ENV | ||
fi | ||
echo "PACKAGE_UPLOAD=${PACKAGE_UPLOAD}" >> $GITHUB_ENV | ||
- 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: ubuntu/${{ matrix.dist }} | ||
repo: "${{ env.CLOUDSMITH_REPO }}" | ||
path: packages-${{ matrix.dist }}-${{ matrix.arch }} | ||
CLOUDSMITH_API_KEY: "${{ secrets.CLOUDSMITH_API_KEY }}" | ||
if: env.PACKAGE_UPLOAD == 'true' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
name: Package mc_panda | ||
|
||
# On any branch/pull request it will: | ||
# - Build packages for selected Debian/Ubuntu distros | ||
# | ||
# On master, it will additionally: | ||
# - Build packages for selected Debian/Ubuntu distro | ||
# - Upload the packages to https://cloudsmith.io/~mc-rtc/repos/head/packages/ | ||
# | ||
# 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://cloudsmith.io/~mc-rtc/repos/stable/packages/ | ||
# | ||
# On package-master trigger, it will rebuild and upload the latest master package | ||
# | ||
# On package-release trigger, it will rebuild and upload the latest release package | ||
|
||
on: | ||
repository_dispatch: | ||
types: [package-master, package-release] | ||
pull_request: | ||
branches: | ||
- "**" | ||
push: | ||
paths-ignore: | ||
# Changes to those files don't mandate rebuilding a package | ||
- "README.md" | ||
- ".github/workflows/build.yml" | ||
branches: | ||
- '**' | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
# For a given tag vX.Y.Z, this checks: | ||
# - 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@v2 | ||
with: | ||
submodules: recursive | ||
if: startsWith(github.ref, 'refs/tags/') | ||
- name: Check version coherency | ||
run: | | ||
set -x | ||
export VERSION=`echo ${{ github.ref }} | sed -e 's@refs/tags/v@@'` | ||
echo "REJECTION=PROJECT_VERSION in CMakeLists.txt does not match tag" >> $GITHUB_ENV | ||
grep -q "project(mc_panda .* VERSION ${VERSION}.*)" CMakeLists.txt | ||
echo "REJECTION=Upstream version in debian/changelog does not match tag" >> $GITHUB_ENV | ||
head -n 1 debian/changelog | grep -q "mc-panda (${VERSION}" | ||
echo "REJECTION=" >> $GITHUB_ENV | ||
export TAG=`echo ${{ github.ref }} | sed -e 's@refs/tags/@@'` | ||
echo "RELEASE_TAG=${TAG}" >> $GITHUB_ENV | ||
if: startsWith(github.ref, 'refs/tags/') | ||
- 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: startsWith(github.ref, 'refs/tags/') | ||
# This job build binary packages for Ubuntu | ||
build-packages: | ||
needs: check-tag | ||
strategy: | ||
fail-fast: false | ||
matrix: &package-matrix | ||
dist: [bionic, focal] | ||
arch: [amd64] | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- &choose-extra-mirror | ||
name: Choose extra mirror | ||
run: | | ||
# 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 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 $USE_HEAD | ||
then | ||
echo "CLOUDSMITH_REPO=mc-rtc/head" >> $GITHUB_ENV | ||
echo "PACKAGE_JOB=package-master" >> $GITHUB_ENV | ||
else | ||
echo "CLOUDSMITH_REPO=mc-rtc/stable" >> $GITHUB_ENV | ||
echo "PACKAGE_JOB=package-release" >> $GITHUB_ENV | ||
fi | ||
echo "PACKAGE_UPLOAD=${PACKAGE_UPLOAD}" >> $GITHUB_ENV | ||
- name: Setup ROS packages | ||
run: | | ||
set -x | ||
export ROS_PYTHON=python2.7 | ||
export ROS_DISTRO="" | ||
if [ "${{ matrix.dist }}" = "xenial" ] | ||
then | ||
export ROS_DISTRO="kinetic" | ||
fi | ||
if [ "${{ matrix.dist }}" = "bionic" ] | ||
then | ||
export ROS_DISTRO="melodic" | ||
fi | ||
if [ "${{ matrix.dist }}" = "focal" ] | ||
then | ||
export ROS_DISTRO="noetic" | ||
export ROS_PYTHON=python3 | ||
export MC_LOG_UI_PYTHON_EXECUTABLE=python3 | ||
fi | ||
echo "ROS_DISTRO=${ROS_DISTRO}" >> $GITHUB_ENV | ||
sed -i -e"s/@ROS_DISTRO@/${ROS_DISTRO}/g" debian/control | ||
cat debian/control | ||
sed -i -e"s/@ROS_DISTRO@/${ROS_DISTRO}/g" debian/rules | ||
sed -i -e"s/@ROS_PYTHON@/${ROS_PYTHON}/g" debian/rules | ||
cat debian/rules | ||
- name: Build package | ||
uses: jrl-umi3218/github-actions/build-package-native@master | ||
with: | ||
dist: ${{ matrix.dist }} | ||
arch: ${{ matrix.arch }} | ||
ros-distro: ${{ env.ROS_DISTRO }} | ||
cloudsmith-repo: ${{ env.CLOUDSMITH_REPO }} | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: packages-${{ matrix.dist }}-${{ matrix.arch }} | ||
path: /tmp/packages-${{ matrix.dist }}-${{ matrix.arch }}/ | ||
if: env.PACKAGE_UPLOAD == 'true' | ||
# This job upload binary packages for Ubuntu | ||
upload-packages: | ||
needs: build-packages | ||
strategy: | ||
max-parallel: 1 | ||
fail-fast: false | ||
matrix: *package-matrix | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: Set upload parameters | ||
<<: *choose-extra-mirror | ||
- 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: ubuntu/${{ matrix.dist }} | ||
repo: ${{ env.CLOUDSMITH_REPO }} | ||
path: packages-${{ matrix.dist }}-${{ matrix.arch }} | ||
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} | ||
if: env.PACKAGE_UPLOAD == 'true' |
Oops, something went wrong.