Improve CI

- Allow downloading of pre-commit + clang-tidy fixes
- Use clang compiler for clang-tidy job
- Adapt to improved lcov-action
This commit is contained in:
Robert Haschke 2021-10-22 16:49:17 +02:00
parent 7ec874572c
commit 9ca8f5a1e3
2 changed files with 26 additions and 16 deletions

View File

@ -36,14 +36,17 @@ jobs:
env:
CATKIN_LINT: true
CLANG_TIDY_ARGS: --fix --fix-errors --format-style=file
DOCKER_IMAGE: moveit/moveit:${{ matrix.env.IMAGE }}
UNDERLAY: /root/ws_moveit/install
DOWNSTREAM_WORKSPACE: "github:ubi-agni/mtc_demos#master github:TAMS-Group/mtc_pour#master"
CCACHE_DIR: ${{ github.workspace }}/.ccache
BASEDIR: /home/runner/work
DOCKER_IMAGE: moveit/moveit:${{ matrix.env.IMAGE }}
BASEDIR: ${{ github.workspace }}/.work
CACHE_PREFIX: "${{ matrix.env.IMAGE }}${{ contains(matrix.env.TARGET_CMAKE_ARGS, '--coverage') && '-ccov' || '' }}"
# perform full clang-tidy check only on manual trigger (workflow_dispatch), PRs do check changed files, otherwise nothing
CLANG_TIDY_BASE_REF: ${{ github.event_name != 'workflow_dispatch' && (github.base_ref || github.ref) || '' }}
CC: ${{ matrix.env.CLANG_TIDY && 'clang' }}
CXX: ${{ matrix.env.CLANG_TIDY && 'clang++' }}
name: "${{ matrix.env.IMAGE }}${{ matrix.env.NAME && ' • ' || ''}}${{ matrix.env.NAME }}${{ matrix.env.CATKIN_LINT && ' • catkin_lint' || ''}}${{ matrix.env.CLANG_TIDY && ' • clang-tidy' || '' }}"
runs-on: ubuntu-latest
@ -51,7 +54,7 @@ jobs:
- uses: actions/checkout@v2
- name: Cache ccache
uses: pat-s/always-upload-cache@v2.1.3
uses: pat-s/always-upload-cache@v2.1.5
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }}-${{ github.run_id }}
@ -59,25 +62,26 @@ jobs:
ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }}
ccache-${{ env.CACHE_PREFIX }}
- name: industrial_ci
- id: ici
name: Run industrial_ci
uses: ros-industrial/industrial_ci@master
env: ${{ matrix.env || env }}
env: ${{ matrix.env }}
- name: Upload test artifacts (on failure)
uses: actions/upload-artifact@v2
if: failure()
if: failure() && (steps.ici.outputs.run_target_test || steps.ici.outputs.target_test_results)
with:
name: test-results
name: test-results-${{ matrix.env.IMAGE }}
path: ${{ env.BASEDIR }}/target_ws/**/test_results/**/*.xml
- name: Collect coverage information
uses: rhaschke/lcov-action@master
if: ${{ contains(matrix.env.TARGET_CMAKE_ARGS, '--coverage') }}
- name: Generate codecov report
uses: rhaschke/lcov-action@main
if: contains(matrix.env.TARGET_CMAKE_ARGS, '--coverage') && steps.ici.outputs.target_test_results == '0'
with:
workdir: ${{ env.BASEDIR }}
dir: target_ws
ignore: '"/usr/*" "/opt/*" "/root/ws_moveit/*" "*/target_ws/build/*" "*/target_ws/install/*" "*/test/*"'
docker: $DOCKER_IMAGE
workdir: ${{ env.BASEDIR }}/target_ws
ignore: '"*/target_ws/build/*" "*/target_ws/install/*" "*/test/*"'
- name: Upload codecov report
uses: codecov/codecov-action@v1
if: ${{ contains(matrix.env.TARGET_CMAKE_ARGS, '--coverage') }}
uses: codecov/codecov-action@v2
if: contains(matrix.env.TARGET_CMAKE_ARGS, '--coverage') && steps.ici.outputs.target_test_results == '0'
with:
files: ${{ env.BASEDIR }}/coverage.info
files: ${{ env.BASEDIR }}/target_ws/coverage.info

View File

@ -21,3 +21,9 @@ jobs:
with:
distro: noetic
- uses: pre-commit/action@v2.0.0
id: precommit
- name: Upload pre-commit changes
if: failure() && steps.precommit.outcome == 'failure'
uses: rhaschke/upload-git-patch-action@main
with:
name: pre-commit