Skip to content

Commit 37c0701

Browse files
author
Vatan Aksoy Tezer
authored
Migrate to github actions (#634)
* Migrate to github actions * Fix formating errors
1 parent fa945cb commit 37c0701

File tree

29 files changed

+1537
-722
lines changed

29 files changed

+1537
-722
lines changed

.github/workflows/ci.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git).
2+
# For troubleshooting, see readme (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst)
3+
4+
name: CI
5+
6+
on:
7+
workflow_dispatch:
8+
pull_request:
9+
push:
10+
11+
jobs:
12+
default:
13+
strategy:
14+
matrix:
15+
env:
16+
- IMAGE: master-source
17+
- IMAGE: noetic-source
18+
env:
19+
DOCKER_IMAGE: moveit/moveit:${{ matrix.env.IMAGE }}
20+
UNDERLAY: /root/ws_moveit/install
21+
CATKIN_LINT: true
22+
CCACHE_DIR: ${{ github.workspace }}/.ccache
23+
BASEDIR: ${{ github.workspace }}/.work
24+
CLANG_TIDY_BASE_REF: ${{ github.base_ref || github.ref }}
25+
26+
name: ${{ matrix.env.IMAGE }}${{ matrix.env.CATKIN_LINT && ' + catkin_lint' || ''}}${{ matrix.env.CLANG_TIDY && ' + clang-tidy' || '' }}
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v2
30+
# The target directory cache doesn't include the source directory because
31+
# that comes from the checkout. See "prepare target_ws for cache" task below
32+
- name: cache target_ws
33+
uses: pat-s/[email protected]
34+
with:
35+
path: ${{ env.BASEDIR }}/target_ws
36+
key: ${{ env.CACHE_PREFIX }}-${{ github.run_id }}
37+
restore-keys: ${{ env.CACHE_PREFIX }}
38+
env:
39+
CACHE_PREFIX: target_ws-${{ matrix.env.IMAGE }}-${{ hashFiles('**/CMakeLists.txt', '**/package.xml') }}
40+
- name: cache ccache
41+
uses: pat-s/[email protected]
42+
with:
43+
path: ${{ env.CCACHE_DIR }}
44+
key: ${{ env.CACHE_PREFIX }}-${{ github.sha }}-${{ github.run_id }}
45+
restore-keys: |
46+
${{ env.CACHE_PREFIX }}-${{ github.sha }}
47+
${{ env.CACHE_PREFIX }}
48+
env:
49+
CACHE_PREFIX: ccache-${{ matrix.env.IMAGE }}
50+
51+
- name: industrial_ci
52+
uses: ros-industrial/industrial_ci@master
53+
env: ${{ matrix.env }}
54+
55+
- name: upload test artifacts (on failure)
56+
uses: actions/upload-artifact@v2
57+
if: failure()
58+
with:
59+
name: test-results
60+
path: ${{ env.BASEDIR }}/target_ws/**/test_results/**/*.xml
61+
- name: prepare target_ws for cache
62+
if: ${{ always() }}
63+
run: |
64+
du -sh ${{ env.BASEDIR }}/target_ws
65+
sudo find ${{ env.BASEDIR }}/target_ws -wholename '*/test_results/*' -delete
66+
sudo rm -rf ${{ env.BASEDIR }}/target_ws/src ${{ env.BASEDIR }}/target_ws/logs
67+
du -sh ${{ env.BASEDIR }}/target_ws

.github/workflows/deploy.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build+Test+Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
default:
11+
name: Build + Test + Deploy Website
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: ros-tooling/[email protected]
16+
with:
17+
required-ros-distributions: noetic
18+
- uses: actions/setup-python@v2
19+
- uses: ruby/setup-ruby@v1
20+
with:
21+
ruby-version: '2.7'
22+
- name: "Build+Test: Run htmlproofer.sh"
23+
run: ./htmlproofer.sh
24+
- name: Deploy
25+
if: ${{ success() && github.event_name == 'push'}}
26+
uses: peaceiris/actions-gh-pages@v3
27+
with:
28+
github_token: ${{ secrets.GITHUB_TOKEN }}
29+
publish_dir: ./build/html

.github/workflows/format.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This is a format job. Pre-commit has a first-party GitHub action, so we use
2+
# that: https://github.com/pre-commit/action
3+
4+
name: Format (pre-commit)
5+
6+
on:
7+
workflow_dispatch:
8+
pull_request:
9+
push:
10+
11+
jobs:
12+
pre-commit:
13+
name: pre-commit
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/setup-python@v2
18+
- name: Install clang-format-10
19+
run: sudo apt-get install clang-format-10
20+
- uses: rhaschke/[email protected]
21+
with:
22+
distro: noetic
23+
- uses: pre-commit/[email protected]

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ doc/html
55
build
66
Gemfile
77
native_build
8-
*.gdb
8+
*.gdb

.pre-commit-config.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# To use:
2+
#
3+
# pre-commit run -a
4+
#
5+
# Or:
6+
#
7+
# pre-commit install # (runs every time you commit in git)
8+
#
9+
# To update this file:
10+
#
11+
# pre-commit autoupdate
12+
#
13+
# See https://github.com/pre-commit/pre-commit
14+
15+
repos:
16+
# Standard hooks
17+
- repo: https://github.com/pre-commit/pre-commit-hooks
18+
rev: v3.4.0
19+
hooks:
20+
- id: check-added-large-files
21+
- id: check-case-conflict
22+
- id: check-json
23+
- id: check-merge-conflict
24+
- id: check-symlinks
25+
- id: check-toml
26+
- id: check-yaml
27+
- id: debug-statements
28+
- id: destroyed-symlinks
29+
- id: detect-private-key
30+
- id: end-of-file-fixer
31+
- id: mixed-line-ending
32+
- id: pretty-format-json
33+
- id: trailing-whitespace
34+
35+
- repo: https://github.com/psf/black
36+
rev: 20.8b1
37+
hooks:
38+
- id: black
39+
40+
- repo: local
41+
hooks:
42+
- id: clang-format
43+
name: clang-format
44+
description: Format files with ClangFormat.
45+
entry: clang-format-10
46+
language: system
47+
files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|js|m|proto|vert)$
48+
args: ['-fallback-style=none', '-i']
49+
- id: catkin_lint
50+
name: catkin_lint
51+
description: Check package.xml and cmake files
52+
entry: catkin_lint .
53+
language: system
54+
always_run: true
55+
pass_filenames: false

.travis.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ These tutorials use the [reStructuredText](http://www.sphinx-doc.org/en/stable/r
1010

1111
All content in this repository is open source and released under the [BSD License v3](https://opensource.org/licenses/BSD-3-Clause). Each individual source code file should contain a copy of the license.
1212

13-
This repository is currently built automatically by two systems. Travis builds the documentation for Melodic and ROS Build Farm builds the documentation for older versions:
14-
- [![Travis Status](https://travis-ci.org/ros-planning/moveit_tutorials.svg?branch=master)](https://travis-ci.org/ros-planning/moveit_tutorials) [Github Pages + Travis](https://ros-planning.github.io/moveit_tutorials/): latest
15-
- [![ROS Melodic Build Farm Status](http://build.ros.org/buildStatus/icon?job=Mdoc__moveit_tutorials__ubuntu_bionic_amd64)](http://build.ros.org/job/Mdoc__moveit_tutorials__ubuntu_bionic_amd64/) [ROS Melodic Build Farm](http://docs.ros.org/melodic/api/moveit_tutorials/html/)
16-
- [![ROS Kinetic Build Farm Status](http://build.ros.org/buildStatus/icon?job=Kdoc__moveit_tutorials__ubuntu_xenial_amd64)](http://build.ros.org/job/Kdoc__moveit_tutorials__ubuntu_xenial_amd64/) [ROS Kinetic Build Farm](http://docs.ros.org/kinetic/api/moveit_tutorials/html/)
13+
This repository is currently built automatically by two systems. Github Actions builds the documentation for Noetic, and ROS Build Farm builds the documentation for older versions:
14+
15+
- [ROS Noetic](https://ros-planning.github.io/moveit_tutorials/): [![CI](https://github.com/ros-planning/moveit_tutorials/actions/workflows/ci.yaml/badge.svg?branch=master)](https://github.com/ros-planning/moveit_tutorials/actions/workflows/ci.yaml?query=branch%3Amaster) [![Deploy](https://github.com/ros-planning/moveit_tutorials/actions/workflows/deploy.yaml/badge.svg?branch=master)](https://github.com/ros-planning/moveit_tutorials/actions/workflows/deploy.yaml?query=branch%3Amaster) [![Formatting](https://github.com/ros-planning/moveit_tutorials/actions/workflows/format.yaml/badge.svg?branch=master)](https://github.com/ros-planning/moveit_tutorials/actions/workflows/format.yaml?query=branch%3Amaster)
16+
- [ROS Melodic](http://docs.ros.org/melodic/api/moveit_tutorials/html/): [![build farm](http://build.ros.org/buildStatus/icon?job=Mdoc__moveit_tutorials__ubuntu_bionic_amd64)](http://build.ros.org/job/Mdoc__moveit_tutorials__ubuntu_bionic_amd64/)
17+
- [ROS Kinetic](http://docs.ros.org/kinetic/api/moveit_tutorials/html/): [![build farm](http://build.ros.org/buildStatus/icon?job=Kdoc__moveit_tutorials__ubuntu_xenial_amd64)](http://build.ros.org/job/Kdoc__moveit_tutorials__ubuntu_xenial_amd64/)
1718

1819
## Versions
1920

@@ -48,7 +49,7 @@ We rely on the community to keep these tutorials up to date and bug free. If you
4849

4950
**Code Formatting**
5051

51-
* These tutorials use the same [style guidelines](http://moveit.ros.org/documentation/contributing/code/) as the MoveIt project. When modifying or adding to these tutorials, it is required that code is auto formatted using [clang-format](http://moveit.ros.org/documentation/contributing/code/).
52+
* These tutorials use the same [style guidelines](http://moveit.ros.org/documentation/contributing/code/) as the MoveIt project. When modifying or adding to these tutorials, it is required that code is auto formatted using [clang-format](http://moveit.ros.org/documentation/contributing/code/). To check and apply our style guidelines we use [pre-commit](https://pre-commit.com/).
5253
* Tutorials should exemplify best coding practices. If a contribution wouldn't pass review in the MoveIt project, then it shouldn't pass review in the tutorials.
5354
* Relevant code should be included and explained using the ``.. tutorial-formatter::`` tag.
5455
* Irrelevant code should be excluded from the generated html using the ``BEGIN_TUTORIAL``, ``END_TUTORIAL``, ``BEGIN_SUB_TUTORIAL``, and ``END_SUB_TUTORIAL`` tags.
@@ -62,6 +63,20 @@ We rely on the community to keep these tutorials up to date and bug free. If you
6263
* Tutorials should flow from show to tell with videos and demos at the beginning followed by explanations.
6364
* New tutorials should match the formatting, style and flow of existing tutorials whenever possible.
6465

66+
**pre-commit**
67+
68+
pre-commit is a tool that is used in ``moveit_tutorials`` to check and apply style guidelines automatically. To install pre-commit into your system:
69+
70+
pip3 install pre-commit
71+
72+
In you catkin workspace, under ``moveit_tutorials`` directory you can install the git hooks like this:
73+
74+
cd $CATKIN_WS/src/moveit_tutorials && pre-commit install
75+
76+
With this pre-commit will automatically run and check a list of styling including clang-format, end of files and trailing whitespaces whenever you run ``git commit``. To run pre-commit any time other than ``git commit`` you can use the following command:
77+
78+
cd $CATKIN_WS/src/moveit_tutorials && pre-commit run -a
79+
6580
### Directory Structure
6681

6782
* Each tutorial should live in its own subdirectory within the `./doc/ <>` directory.

0 commit comments

Comments
 (0)