Skip to content

Commit

Permalink
Use GitHub actions (#14)
Browse files Browse the repository at this point in the history
* [ci/packaging] Enable GitHub Actions

* [ci/macOS] Install gfortran as a cask dependency

* [ci] Rely on the fact that install-dependencies installs gfortran

Works around very strange bug on 16.04 runner

* [packaging] Correctly check debian/changelog

* [clang-format] Apply clang-format and add it to CI

* [ci] Upload documentation to gh-pages

* [packaging] Use correct repository before pushing to jrl-umi3218

* [README] Update README
  • Loading branch information
gergondet authored Nov 29, 2019
1 parent 434e9f6 commit 09c9ab0
Show file tree
Hide file tree
Showing 33 changed files with 848 additions and 387 deletions.
110 changes: 110 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Allman
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 0
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^(<mc_[a-z]*/)'
Priority: 1
- Regex: '^(<Tasks/)'
Priority: 2
- Regex: '^(<mc_rbdyn_urdf/)'
Priority: 3
- Regex: '^(<RBDyn/)'
Priority: 4
- Regex: '^(<SpaceVecAlg/)'
Priority: 5
- Regex: '^(<sch-core/)'
Priority: 6
- Regex: '^(<boost/)'
Priority: 7
- Regex: '^(<(nanomsg|geos|.*_msgs|ros|tf2.*)/)'
Priority: 8
- Regex: '.*'
Priority: 9
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: true
IndentPPDirectives: AfterHash
IndentWidth: 2
IndentWrappedFunctionNames: true
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 150
PenaltyReturnTypeOnItsOwnLine: 300
PointerAlignment: Middle
RawStringFormats:
- Delimiter: pb
Language: TextProto
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 2
UseTab: Never
...

18 changes: 18 additions & 0 deletions .clang-format-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

source .clang-format-common.sh

out=0
tmpfile=$(mktemp /tmp/clang-format-check.XXXXXX)
for f in ${src_files}; do
$clang_format -style=file $f > $tmpfile
if ! [[ -z `diff $tmpfile $f` ]]; then
echo "Wrong formatting in $f"
out=1
fi
done
rm -f $tmpfile
if [[ $out -eq 1 ]]; then
echo "You can run ./.clang-format-fix.sh to fix the issues locally, then commit/push again"
fi
exit $out
15 changes: 15 additions & 0 deletions .clang-format-common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This script is meant to be sourced from other scripts

# Check for clang-format, prefer 6.0 if available
if [[ -x "$(command -v clang-format-6.0)" ]]; then
clang_format=clang-format-6.0
elif [[ -x "$(command -v clang-format)" ]]; then
clang_format=clang-format
else
echo "clang-format or clang-format-6.0 must be installed"
exit 1
fi

# Find all source files in the project minus those that are auto-generated or we do not maintain
src_files=`find src tests -type f \( -name '*.cpp' -or -name '*.h' \)`

7 changes: 7 additions & 0 deletions .clang-format-fix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

source .clang-format-common.sh

for f in ${src_files}; do
$clang_format -style=file -i $f
done
83 changes: 83 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI of eigen-qld

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'

jobs:

clang-format:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Install clang-format-6.0
run: |
sudo apt-get -qq update
sudo apt-get -qq remove clang-6.0 libclang1-6.0 libclang-common-6.0-dev libllvm6.0
sudo apt-get -qq install clang-format-6.0 clang-format
- name: Run clang-format-check
run: |
./.clang-format-check.sh
build:
needs: clang-format
strategy:
fail-fast: false
matrix:
os: [ubuntu-16.04, ubuntu-18.04, macos-latest, windows-latest]
build-type: [Debug, RelWithDebInfo]
compiler: [gcc, clang]
exclude:
# Only default compiler on macos-latest and windows-latest
- os: macos-latest
compiler: clang
- os: windows-latest
compiler: clang

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Install dependencies
uses: jrl-umi3218/github-actions/install-dependencies@master
with:
compiler: ${{ matrix.compiler }}
build-type: ${{ matrix.build-type }}
ubuntu: |
apt: cython cython3 python-nose python3-nose python-numpy python3-numpy python-coverage python3-coverage python-setuptools python3-setuptools libeigen3-dev doxygen doxygen-latex libboost-all-dev
macos: |
cask: gfortran
brew: eigen boost
pip: Cython coverage nose numpy
windows: |
pip: Cython coverage nose numpy
github:
- path: eigenteam/eigen-git-mirror
ref: 3.3.7
github: |
- path: jrl-umi3218/Eigen3ToPython
- name: Build and test
uses: jrl-umi3218/github-actions/build-cmake-project@master
with:
compiler: ${{ matrix.compiler }}
build-type: ${{ matrix.build-type }}
- name: Upload documentation
# Only run on master branch and for one configuration
if: matrix.os == 'ubuntu-18.04' && matrix.build-type == 'RelWithDebInfo' && matrix.compiler == 'gcc' && github.ref == 'refs/heads/master'
uses: jrl-umi3218/github-actions/upload-documentation@master
with:
GH_USER: gergondet
GH_PAGES_TOKEN: ${{ secrets.GH_PAGES_TOKEN }}
- name: Slack Notification
if: failure()
uses: archive/github-actions-slack@master
with:
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: '#ci'
slack-text: >
[eigen-qld] Build *${{ matrix.os }}/${{ matrix.build-type }}* failed on ${{ github.ref }}
3 changes: 3 additions & 0 deletions .github/workflows/eigen-qld.recipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# git-build-recipe format 0.4 deb-version {debversion}+{time}+{git-commit}
https://github.com/jrl-umi3218/eigen-qld @REF@
run git submodule update --init
148 changes: 148 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
name: Package eigen-qld

# 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 "set(PROJECT_VERSION ${VERSION})" CMakeLists.txt
echo "::set-env name=REJECTION::Upstream version in debian/changelog does not match tag"
head -n 1 debian/changelog | grep -q "eigen-qld (${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]
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Prepare recipe
run: |
set -x
cp .github/workflows/eigen-qld.recipe /tmp/eigen-qld.recipe
export REF=`echo ${{ github.ref }} | sed -e 's@refs/[a-z]*/@@'`
sed -i "s#@REF@#${REF}#" /tmp/eigen-qld.recipe
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
echo "Prepared recipe"
echo "###############"
cat /tmp/eigen-qld.recipe
- name: Build package
uses: jrl-umi3218/github-actions/build-package@master
with:
dist: ${{ matrix.dist }}
arch: ${{ matrix.arch }}
recipe: /tmp/eigen-qld.recipe
other-mirrors: ${{ env.EXTRA_MIRROR }}
other-gpg-keys: "0x892EA6EE273707C6495A6FB6220D644C64666806"
- uses: actions/upload-artifact@v1
with:
name: packages-${{ matrix.dist }}-${{ matrix.arch }}
path: /tmp/packages-${{ matrix.dist }}-${{ matrix.arch }}/
# 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]
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: eigen-qld
desc: "eigen-qld allows to use the QLD QP solver with the Eigen3 library"
licenses: [BSD 2-Clause]
vcs_url: https://github.com/jrl-umi3218/eigen-qld
version: ${{ env.BINTRAY_VERSION }}
path: packages-${{ matrix.dist }}-${{ matrix.arch }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "cmake"]
path = cmake
url = https://github.com/jrl-umi3218/jrl-cmakemodules
[submodule ".jrl-ci"]
path = .jrl-ci
url = https://github.com/jrl-umi3218/jrl-travis
1 change: 0 additions & 1 deletion .jrl-ci
Submodule .jrl-ci deleted from 282ffb
Loading

0 comments on commit 09c9ab0

Please sign in to comment.