Skip to content

Commit

Permalink
Migrate to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerjw committed Apr 6, 2021
1 parent c166f8e commit 9171e39
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 26 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This is a format job. Pre-commit has a first-party GitHub action, so we use
# that: https://github.com/pre-commit/action

name: Format

on:
workflow_dispatch:
pull_request:
push:

jobs:
pre-commit:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install clang-format-10
run: sudo apt-get install clang-format-10
- name: Install catkin-lint
run: |
lsb_release -sc
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get -q update
sudo apt-get -q install python3-rosdep
sudo rosdep init
rosdep update
sudo apt-get -q install catkin-lint
export ROS_DISTRO=noetic
- uses: pre-commit/[email protected]
67 changes: 67 additions & 0 deletions .github/workflows/industrial_ci_action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git).
# For troubleshooting, see readme (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst)

name: BuildAndTest

on:
workflow_dispatch:
pull_request:
push:
branches:
- master

jobs:
industrial_ci:
strategy:
matrix:
env:
- ROS_DISTRO: noetic
ROS_REPO: main
CLANG_TIDY: true
- ROS_DISTRO: noetic
ROS_REPO: testing
env:
TARGET_CMAKE_ARGS: -DCMAKE_BUILD_TYPE=Release
CCACHE_DIR: ${{ github.workspace }}/.ccache
BASEDIR: ${{ github.workspace }}/.work
CACHE_PREFIX: "${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }}${{ matrix.env.CCOV && '-ccov' || '' }}"
CLANG_TIDY: true
CLANG_TIDY_BASE_REF: "${{ github.base_ref || github.ref }}"

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# The target directory cache doesn't include the source directory because
# that comes from the checkout. See "prepare target_ws for cache" task below
- name: cache target_ws
if: ${{ ! matrix.env.CCOV }}
uses: pat-s/[email protected]
with:
path: ${{ env.BASEDIR }}/target_ws
key: target_ws-${{ env.CACHE_PREFIX }}-${{ hashFiles('**/CMakeLists.txt', '**/package.xml') }}-${{ github.run_id }}
restore-keys: |
target_ws-${{ env.CACHE_PREFIX }}-${{ hashFiles('**/CMakeLists.txt', '**/package.xml') }}
- name: cache ccache
uses: pat-s/[email protected]
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }}-${{ github.run_id }}
restore-keys: |
ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }}
ccache-${{ env.CACHE_PREFIX }}-
- name: industrial_ci
uses: 'tylerjw/industrial_ci@clang-tidy-modified-filter'
env: ${{ matrix.env }}
- name: upload test artifacts (on failure)
uses: actions/upload-artifact@v2
if: failure()
with:
name: test-results
path: ${{ env.BASEDIR }}/target_ws/**/test_results/**/*.xml
- name: prepare target_ws for cache
if: ${{ always() && ! matrix.env.CCOV }}
run: |
du -sh ${{ env.BASEDIR }}/target_ws
sudo find ${{ env.BASEDIR }}/target_ws -wholename '*/test_results/*' -delete
sudo rm -rf ${{ env.BASEDIR }}/target_ws/src
du -sh ${{ env.BASEDIR }}/target_ws
56 changes: 56 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# To use:
#
# pre-commit run -a
#
# Or:
#
# pre-commit install # (runs every time you commit in git)
#
# To update this file:
#
# pre-commit autoupdate
#
# See https://github.com/pre-commit/pre-commit

repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: pretty-format-json
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black

- repo: local
hooks:
- id: clang-format
name: clang-format
description: Format files with ClangFormat.
entry: clang-format-10
language: system
files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|js|m|proto|vert)$
args: ['-fallback-style=none', '-i']
- id: catkin_lint
name: catkin_lint
description: Check package.xml and cmake files
entry: catkin_lint .
language: system
always_run: true
pass_filenames: false
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ add_library(${PROJECT_NAME}
src/imarker_robot_state.cpp
src/imarker_end_effector.cpp
)
target_compile_options(${PROJECT_NAME} PRIVATE
"-Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls")
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION})
add_dependencies(${PROJECT_NAME} graph_msgs_generate_messages_cpp)
target_link_libraries(${PROJECT_NAME}
Expand All @@ -62,6 +64,8 @@ target_link_libraries(${PROJECT_NAME}

# Demo executable
add_executable(${PROJECT_NAME}_demo src/${PROJECT_NAME}_demo.cpp)
target_compile_options(${PROJECT_NAME}_demo PRIVATE
"-Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls")
target_link_libraries(${PROJECT_NAME}_demo
${catkin_LIBRARIES} ${PROJECT_NAME}
)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This open source project was developed at [PickNik Robotics](https://picknik.ai/

## Status:

* [![Build Status](https://travis-ci.org/ros-planning/moveit_visual_tools.svg)](https://travis-ci.org/ros-planning/moveit_visual_tools) Travis CI
* [![Format](https://github.com/ros-planning/moveit_visual_tools/actions/workflows/format.yaml/badge.svg?branch=master)](https://github.com/ros-planning/moveit_visual_tools/actions/workflows/format.yaml?branch=master) [![BuildAndTest](https://github.com/ros-planning/moveit_visual_tools/actions/workflows/industrial_ci_action.yaml/badge.svg?branch=master)](https://github.com/ros-planning/moveit_visual_tools/actions/workflows/industrial_ci_action.yaml?branch=master) GitHub Actions
* [![Build Status](http://build.ros.org/buildStatus/icon?job=Kbin_uX64__moveit_visual_tools__ubuntu_xenial_amd64__binary)](http://build.ros.org/view/Kbin_uX64/job/Kbin_uX64__moveit_visual_tools__ubuntu_xenial_amd64__binary/) ROS Buildfarm - AMD64 Xenial Debian Build - Ubuntu 16.04 LTS
* [![Build Status](http://build.ros.org/buildStatus/icon?job=Kdev__moveit_visual_tools__ubuntu_xenial_amd64)](http://build.ros.org/view/Kdev/job/Kdev__moveit_visual_tools__ubuntu_xenial_amd64/) ROS Buildfarm - AMD64 Xenial Devel Build - Ubuntu 16.04 LTS
* [![Build Status](http://build.ros.org/buildStatus/icon?job=Msrc_uB__moveit_visual_tools__ubuntu_bionic__source)](http://build.ros.org/job/Msrc_uB__moveit_visual_tools__ubuntu_bionic__source/) ROS Buildfarm - AMD64 Bionic Source Build - Ubuntu 18.04 LTS
Expand Down

0 comments on commit 9171e39

Please sign in to comment.