From 9ca8f5a1e376564f6083afe2b3eb8bfadde4d51b Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Fri, 22 Oct 2021 16:49:17 +0200 Subject: [PATCH] Improve CI - Allow downloading of pre-commit + clang-tidy fixes - Use clang compiler for clang-tidy job - Adapt to improved lcov-action --- .github/workflows/ci.yaml | 36 +++++++++++++++++++---------------- .github/workflows/format.yaml | 6 ++++++ 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cc03b5ed..c80d6f4e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml index 1219ab03..05f532be 100644 --- a/.github/workflows/format.yaml +++ b/.github/workflows/format.yaml @@ -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